forked from Wunderkraut-Benelux/WBE_common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwkbe_common.module
83 lines (66 loc) · 1.88 KB
/
wkbe_common.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* @file
* Module file for wkbe common.
*/
/**
* Implements hook_theme_suggestions_HOOK().
*/
function wkbe_common_theme_suggestions_block(array $variables) {
$suggestions = [];
$navigation_blocks = [
'main_navigation_block',
'footer_navigation_block'
];
if (in_array($variables['elements']['#base_plugin_id'], $navigation_blocks)) {
$suggestions[] = 'block__wkbe_navigation';
$suggestions[] = 'block__wkbe_' . $variables['elements']['#base_plugin_id'];
}
return $suggestions;
}
/**
* Implements hook_js_settings_alter().
*/
function wkbe_common_js_settings_alter(&$settings) {
// Drupal core ckeditor settings only allows element settings. Add widget settings.
if (isset($settings['editor'])) {
foreach ($settings['editor']['formats'] as &$format_settings) {
// Don't add settings if the plugin is not enabled.
if (empty($format_settings['editorSettings']['embed_enabled'])) {
continue;
}
$format_settings['editorSettings']['stylesSet'][] = [
'name' => 'Narrow media',
'type' => 'widget',
'widget' => 'embed',
'attributes' => [
'class' => 'narrow-media',
],
];
$format_settings['editorSettings']['stylesSet'][] = [
'name' => 'Left media',
'type' => 'widget',
'widget' => 'embed',
'attributes' => [
'class' => 'align-left',
],
];
$format_settings['editorSettings']['stylesSet'][] = [
'name' => 'Centered media',
'type' => 'widget',
'widget' => 'embed',
'attributes' => [
'class' => 'align-center',
],
];
$format_settings['editorSettings']['stylesSet'][] = [
'name' => 'Right media',
'type' => 'widget',
'widget' => 'embed',
'attributes' => [
'class' => 'align-right',
],
];
}
}
}