-
Notifications
You must be signed in to change notification settings - Fork 0
/
easyopac_wysiwyg_button.install
54 lines (47 loc) · 1.22 KB
/
easyopac_wysiwyg_button.install
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
<?php
/**
* @file
* Module installation/uninstallation routine.
*/
/**
* Implements hook_install().
*/
function easyopac_wysiwyg_button_install() {
$settings = db_select('wysiwyg', 'w')
->fields('w', ['settings'])
->condition('format', 'ding_wysiwyg')
->condition('editor', 'ckeditor')
->execute()
->fetchField();
$settings = unserialize($settings);
$settings['buttons']['easyopac_button_plugin']['easyopac_button'] = 1;
$settings = serialize($settings);
db_update('wysiwyg')
->fields([
'settings' => $settings,
])
->condition('format', 'ding_wysiwyg')
->condition('editor', 'ckeditor')
->execute();
}
/**
* Implements hook_uninstall().
*/
function easyopac_wysiwyg_button_uninstall() {
$settings = db_select('wysiwyg', 'w')
->fields('w', ['settings'])
->condition('format', 'ding_wysiwyg')
->condition('editor', 'ckeditor')
->execute()
->fetchField();
$settings = unserialize($settings);
unset($settings['buttons']['easyopac_button_plugin']);
$settings = serialize($settings);
db_update('wysiwyg')
->fields([
'settings' => $settings,
])
->condition('format', 'ding_wysiwyg')
->condition('editor', 'ckeditor')
->execute();
}