-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextension.driver.php
More file actions
executable file
·40 lines (32 loc) · 1.16 KB
/
extension.driver.php
File metadata and controls
executable file
·40 lines (32 loc) · 1.16 KB
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
<?php
Class extension_showhide_fields extends Extension{
public function about(){
return array('name' => 'Show/Hide Fields',
'version' => '0.1.1',
'author' => array('name' => 'Simone Economo',
'website' => 'http://www.lineheight.net',
'email' => 'my.ekoes@gmail.com'),
'description' => 'Lets you collapse/expand fields inside the section editor'
);
}
public function getSubscribedDelegates(){
return array(
array(
'page' => '/backend/',
'delegate' => 'InitaliseAdminPageHead',
'callback' => '__appendScripts'
),
);
}
public function __isSectionEditor($pageCallback) {
return $pageCallback['driver'] == 'blueprintssections' && is_array($pageCallback['context']);
}
public function __appendScripts($context) {
$callback = $context['parent']->getPageCallback();
if ($this->__isSectionEditor($callback)) {
$context['parent']->Page->addStylesheetToHead(URL . '/extensions/showhide_fields/assets/showhidefields.css', 'screen', 1000);
$context['parent']->Page->addScriptToHead(URL . '/extensions/showhide_fields/assets/showhidefields.js', 1000, false);
}
}
}
?>