forked from symphonycms/profiledevkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.driver.php
43 lines (36 loc) · 1.19 KB
/
extension.driver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
class Extension_ProfileDevKit extends Extension {
/*-------------------------------------------------------------------------
Definition:
-------------------------------------------------------------------------*/
public static $active = false;
public function getSubscribedDelegates() {
return array(
array(
'page' => '/frontend/',
'delegate' => 'FrontendDevKitResolve',
'callback' => 'frontendDevKitResolve'
),
array(
'page' => '/frontend/',
'delegate' => 'ManipulateDevKitNavigation',
'callback' => 'manipulateDevKitNavigation'
)
);
}
public function frontendDevKitResolve($context) {
if (isset($_GET['profile'])) {
require_once(EXTENSIONS . '/profiledevkit/content/content.profile.php');
$context['devkit'] = new Content_ProfileDevkit();
self::$active = true;
}
}
public function manipulateDevKitNavigation($context) {
$xml = $context['xml'];
$item = $xml->createElement('item');
$item->setAttribute('name', __('Profile'));
$item->setAttribute('handle', 'profile');
$item->setAttribute('active', (self::$active ? 'yes' : 'no'));
$xml->documentElement->appendChild($item);
}
}