-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextension.driver.php
executable file
·64 lines (57 loc) · 1.59 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
if(!defined("__IN_SYMPHONY__")) die("<h2>Error</h2><p>You cannot directly access this file</p>");
/*
Copyight: Solutions Nitriques 2011
License: MIT
*/
class extension_auto_collapse_fields extends Extension {
public function about() {
return array(
'name' => 'Auto Colapse Fields',
'version' => '1.1',
'release-date' => '2011-06-16',
'author' => array(
'name' => 'Solutions Nitriques',
'website' => 'http://www.nitriques.com/',
'email' => '[email protected]'
),
'description' => 'Really simple ext that collapses fields when editing a Section',
'compatibility' => array(
'2.2.1' => true,
'2.2' => true
)
);
}
public function getSubscribedDelegates(){
return array(
array(
'page' => '/backend/',
'delegate' => 'InitaliseAdminPageHead',
'callback' => 'appendJS'
)
);
}
public function appendJS($context){
$c = Administration::instance()->getPageCallback();
$c = $c['pageroot'];
if ($c == '/blueprints/sections/') {
Administration::instance()->Page->addElementToHead(
new XMLElement(
'script',
"(function($){
$(function(){
// collapse all fields, only if no errors
if ($('#fields-duplicator .invalid').length < 1) {
$('#fields-duplicator .controls > .collapser:first').trigger('click.duplicator');
}
// expand fields that are in error
// does not work
//$('#fields-duplicator .invalid').closest('li').find('.header>span').trigger('mousedown');
});
})(jQuery);"
), time()+1
);
}
}
}
?>