-
Notifications
You must be signed in to change notification settings - Fork 2
/
extension.driver.php
35 lines (26 loc) · 1.24 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
<?php
Class Extension_Switch extends Extension{
/*------------------------------------------------------------------------------------------------*/
/* Delegates */
/*------------------------------------------------------------------------------------------------*/
public function getSubscribedDelegates(){
return array(
array(
'page' => '/backend/',
'delegate' => 'InitaliseAdminPageHead',
'callback' => 'dInitaliseAdminPageHead'
)
);
}
public function dInitaliseAdminPageHead(){
$callback = Administration::instance()->getPageCallback();
$context = in_array($callback['context']['page'], array('new', 'edit')) ? 'single' : 'index';
// append assets
if( $context == 'single' ){
Administration::instance()->Page->addStylesheetToHead(URL.'/extensions/switch/assets/switch.bootstrap-switch.css', "screen");
Administration::instance()->Page->addStylesheetToHead(URL.'/extensions/switch/assets/switch.publish_single.css', "screen");
Administration::instance()->Page->addScriptToHead(URL.'/extensions/switch/assets/switch.bootstrap-switch.js', null, false);
Administration::instance()->Page->addScriptToHead(URL.'/extensions/switch/assets/switch.publish_single.js', null, false);
}
}
}