-
Notifications
You must be signed in to change notification settings - Fork 0
/
easyopac_wysiwyg_button.module
50 lines (45 loc) · 1.37 KB
/
easyopac_wysiwyg_button.module
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
<?php
/**
* @file
* easyOPAC Wysiwyg Button module.
*/
/**
* Implements hook_wysiwyg_plugin().
*/
function easyopac_wysiwyg_button_wysiwyg_plugin($editor, $version) {
if ($editor == 'ckeditor') {
return [
'easyopac_button_plugin' => [
'path' => drupal_get_path('module', 'easyopac_wysiwyg_button') . '/plugin',
'buttons' => [
'easyopac_button' => t('easyOPAC: Insert button'),
],
'load' => TRUE,
],
];
}
}
/**
* Implements hook_wysiwyg_editor_settings_alter().
*/
function easyopac_wysiwyg_button_wysiwyg_editor_settings_alter(&$settings, $context) {
$preset = variable_get('color_ddbasic_stylesheets', '');
if (!empty($preset)) {
$values['color_ddbasic_stylesheets'] = $preset;
}
$colored_css_url = NULL;
if (!empty($values)) {
foreach ($values['color_ddbasic_stylesheets'] as $color_ddbasic_stylesheet) {
// class.css file contains description of "more-link" class.
if (preg_match('/\/class.css/', $color_ddbasic_stylesheet) === 1) {
$colored_css_url = file_create_url($color_ddbasic_stylesheet);
}
}
}
if ('ding_wysiwyg' === $context['profile']->format) {
if ($colored_css_url) {
$settings['contentsCss'][] = $colored_css_url;
}
$settings['contentsCss'][] = drupal_get_path('module', 'easyopac_wysiwyg_button') . '/css/easyopac_wysiwyg_button.css';
}
}