-
Notifications
You must be signed in to change notification settings - Fork 3
/
extension.driver.php
61 lines (49 loc) · 1.7 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
<?php
if( !defined('__IN_SYMPHONY__') ) die('<h2>Error</h2><p>You cannot directly access this file</p>');
Class extension_selectbox_link_field_combo extends Extension
{
public function getSubscribedDelegates(){
return array(
array(
'page' => '/backend/',
'delegate' => 'AdminPagePreGenerate',
'callback' => 'appendAssets'
)
);
}
public function appendAssets($context){
$callback = Administration::instance()->getPageCallback();
if( $callback['driver'] == 'publish'
&& in_array($callback['context']['page'], array('new', 'edit'))
){
Administration::instance()->Page->addScriptToHead(URL.'/extensions/selectbox_link_field_combo/assets/selectbox_link_field_combo.publish.js', 100);
}
}
public function uninstall(){
if( parent::uninstall() == true ){
Symphony::Database()->query("DROP TABLE `tbl_fields_selectbox_link_combo`");
return true;
}
return false;
}
public function install(){
try{
Symphony::Database()->query("CREATE TABLE IF NOT EXISTS `tbl_fields_selectbox_link_combo` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`allow_multiple_selection` enum('yes','no') NOT NULL default 'no',
`show_association` enum('yes','no') NOT NULL default 'yes',
`parent_field_id` int(11) unsigned NOT NULL,
`related_field_id` VARCHAR(255) NOT NULL,
`relation_field_id` int(11) unsigned NOT NULL,
`limit` int(4) unsigned NOT NULL default '20',
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
)");
}
catch( Exception $e ){
return false;
}
return true;
}
}