3 namespace Drupal\superfish\Plugin\Block;
5 use Drupal\system\Plugin\Block\SystemMenuBlock;
6 use Drupal\Core\Menu\MenuTreeParameters;
7 use Drupal\Core\Form\FormStateInterface;
8 use Drupal\Component\Utility\Html;
9 use Drupal\Core\Menu\MenuActiveTrailInterface;
10 use Drupal\Core\Menu\MenuLinkTreeInterface;
11 use Symfony\Component\DependencyInjection\ContainerInterface;
14 * Provides a "Superfish" block.
18 * admin_label = @Translation("Superfish"),
20 * category = @Translation("Superfish"),
21 * deriver = "Drupal\system\Plugin\Derivative\SystemMenuBlock"
24 class SuperfishBlock extends SystemMenuBlock {
27 * The active menu trail service.
29 * @var \Drupal\Core\Menu\MenuActiveTrailInterface
31 protected $menuActiveTrail;
34 * Constructs a new SuperfishBlock.
36 * @param array $configuration
37 * A configuration array containing information about the plugin instance.
38 * @param string $plugin_id
39 * The plugin_id for the plugin instance.
40 * @param array $plugin_definition
41 * The plugin implementation definition.
42 * @param \Drupal\Core\Menu\MenuLinkTreeInterface $menu_tree
43 * The menu tree service.
44 * @param \Drupal\Core\Menu\MenuActiveTrailInterface $menu_active_trail
45 * The active menu trail service.
47 public function __construct(array $configuration, $plugin_id, $plugin_definition, MenuLinkTreeInterface $menu_tree, MenuActiveTrailInterface $menu_active_trail) {
48 parent::__construct($configuration, $plugin_id, $plugin_definition, $menu_tree, $menu_active_trail);
49 $this->menuActiveTrail = $menu_active_trail;
55 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
60 $container->get('menu.link_tree'),
61 $container->get('menu.active_trail')
66 * Overrides \Drupal\block\BlockBase::blockForm().
68 public function blockForm($form, FormStateInterface $form_state) {
69 $form = parent::blockForm($form, $form_state);
70 $defaults = $this->defaultConfiguration();
73 '#title' => $this->t('Block settings'),
76 $description = sprintf('<em>(%s: %s)</em>',
78 $this->t('Horizontal (single row)')
80 $form['sf']['superfish_type'] = [
82 '#title' => $this->t('Menu type'),
83 '#description' => $description,
84 '#default_value' => $this->configuration['menu_type'],
86 'horizontal' => $this->t('Horizontal (single row)'),
87 'navbar' => $this->t('Horizontal (double row)'),
88 'vertical' => $this->t('Vertical (stack)'),
91 $description = sprintf('<em>(%s: %s)</em>',
95 $form['sf']['superfish_style'] = [
97 '#title' => $this->t('Style'),
98 '#description' => $description,
99 '#default_value' => $this->configuration['style'],
101 'none' => $this->t('None'),
102 'default' => $this->t('Default'),
103 'black' => $this->t('Black'),
104 'blue' => $this->t('Blue'),
105 'coffee' => $this->t('Coffee'),
106 'white' => $this->t('White'),
109 $form['sf']['superfish_arrow'] = [
110 '#type' => 'checkbox',
111 '#title' => $this->t('Add arrows to parent menus'),
112 '#default_value' => $this->configuration['arrow'],
114 $form['sf']['superfish_shadow'] = [
115 '#type' => 'checkbox',
116 '#title' => $this->t('Drop shadows'),
117 '#default_value' => $this->configuration['shadow'],
119 if (count(superfish_effects()) == 4) {
120 $easing_instructions = $this->t('jQuery Easing plugin is not installed.');
123 $easing_instructions = $this->t("The plugin provides a handful number of animation effects, they can be used by uploading the 'jquery.easing.js' file to the libraries directory within the 'easing' directory (for example: libraries/easing/jquery.easing.js). Refresh this page after the plugin is uploaded, this will make more effects available in the above list.");
125 $description = sprintf('<em>(%s: %s)</em><br>%s<br>',
127 $this->t('Vertical'),
130 $form['sf']['superfish_slide'] = [
132 '#title' => $this->t('Slide-in effect'),
133 '#description' => $description,
134 '#default_value' => $this->configuration['slide'],
135 '#options' => superfish_effects(),
137 $form['sf-plugins'] = [
138 '#type' => 'details',
139 '#title' => $this->t('Superfish plugins'),
142 $description = sprintf('%s <em>(%s: %s)</em>',
143 $this->t('Relocates sub-menus when they would otherwise appear outside the browser window area.'),
147 $form['sf-plugins']['superfish_supposition'] = [
148 '#type' => 'checkbox',
149 '#title' => $this->t('jQuery Supposition'),
150 '#description' => $description,
151 '#default_value' => $this->configuration['supposition'],
153 $description = sprintf('%s <em>(%s: %s)</em>',
154 $this->t("Prevents accidental firing of animations by waiting until the user's mouse slows down enough, hence determinig user's <em>intent</em>."),
158 $form['sf-plugins']['superfish_hoverintent'] = [
159 '#type' => 'checkbox',
160 '#title' => $this->t('jQuery hoverIntent'),
161 '#description' => $description,
162 '#default_value' => $this->configuration['hoverintent'],
164 $description = sprintf('%s <em>(%s)</em>',
165 $this->t('<strong>sf-Touchscreen</strong> provides touchscreen compatibility.'),
166 $this->t('The first click on a parent hyperlink shows its children and the second click opens the hyperlink.')
168 $form['sf-plugins']['sf-touchscreen'] = [
169 '#type' => 'details',
170 '#title' => $this->t('sf-Touchscreen'),
171 '#description' => $description,
174 $default = sprintf('%s <em>(%s)</em>',
178 $form['sf-plugins']['sf-touchscreen']['superfish_touch'] = [
180 '#default_value' => $this->configuration['touch'],
183 1 => $this->t('Enable jQuery sf-Touchscreen plugin for this menu.'),
184 2 => $this->t("Enable jQuery sf-Touchscreen plugin for this menu depending on the user's Web browser <strong>window width</strong>."),
185 3 => $this->t("Enable jQuery sf-Touchscreen plugin for this menu depending on the user's Web browser <strong>user agent</strong>."),
188 $default = sprintf('%s <em>(%s)</em>',
189 $this->t('Hiding the sub-menu on the second tap, adding cloned parent links to the top of sub-menus as well.'),
192 $form['sf-plugins']['sf-touchscreen']['superfish_touchbh'] = [
194 '#title' => 'Select a behaviour',
195 '#description' => $this->t('Using this plugin, the first click or tap will expand the sub-menu, here you can choose what a second click or tap should do.'),
196 '#default_value' => $this->configuration['touchbh'],
198 0 => $this->t('Opening the parent menu item link on the second tap.'),
199 1 => $this->t('Hiding the sub-menu on the second tap.'),
203 $description = sprintf('%s<br><br>%s<br><code><meta name="viewport" content="width=device-width, initial-scale=1.0" /></code>',
204 $this->t("sf-Touchscreen will be enabled only if the width of user's Web browser window is smaller than the below value."),
205 $this->t('Please note that in most cases such a meta tag is necessary for this feature to work properly:')
207 $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-windowwidth'] = [
208 '#type' => 'details',
209 '#title' => $this->t('Window width settings'),
210 '#description' => $description,
213 $description = sprintf('%s <em>(%s: 768)</em>',
214 $this->t('Also known as "Breakpoint".'),
217 $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-windowwidth']['superfish_touchbp'] = [
219 '#description' => $description,
220 '#default_value' => $this->configuration['touchbp'],
221 '#field_suffix' => $this->t('pixels'),
224 $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-useragent'] = [
225 '#type' => 'details',
226 '#title' => $this->t('User agent settings'),
229 $default = sprintf('%s <em>(%s) (%s)</em>',
230 $this->t('Use the pre-defined list of the <strong>user agents</strong>.'),
232 $this->t('Recommended')
234 $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-useragent']['superfish_touchua'] = [
236 '#default_value' => $this->configuration['touchua'],
239 1 => $this->t('Use the custom list of the <strong>user agents</strong>.'),
242 if (isset($_SERVER['HTTP_USER_AGENT'])) {
243 $user_agent = sprintf('<br><strong>%s</strong> %s',
244 $this->t('UA string of the current Web browser:'),
245 $_SERVER['HTTP_USER_AGENT']
251 $description = sprintf('%s <em>(%s: %s)</em><br>%s:<ul>
252 <li>iPhone*Android*iPad <em><sup>(%s)</sup></em></li>
253 <li>Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2
254 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.0 * Mozilla/5.0
255 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10
256 (KHTML, like Gecko) Mobile/7B405</li>
258 $this->t('Could be partial or complete. (Asterisk separated)'),
261 $this->t('Examples'),
262 $this->t('Recommended'),
265 $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-useragent']['superfish_touchual'] = [
266 '#type' => 'textfield',
267 '#title' => $this->t('Custom list of the user agents'),
268 '#description' => $description,
269 '#default_value' => $this->configuration['touchual'],
271 '#maxlength' => 2000,
273 $description = sprintf('<em>(%s: %s)</em>',
275 $this->t('Client-side (JavaScript)')
277 $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-useragent']['superfish_touchuam'] = [
279 '#title' => $this->t('<strong>User agent</strong> detection method'),
280 '#description' => $description,
281 '#default_value' => $this->configuration['touchuam'],
283 0 => $this->t('Client-side (JavaScript)'),
284 1 => $this->t('Server-side (PHP)'),
287 $form['sf-plugins']['sf-smallscreen'] = [
288 '#type' => 'details',
289 '#title' => $this->t('sf-Smallscreen'),
290 '#description' => $this->t('<strong>sf-Smallscreen</strong> provides small-screen compatibility for your menus.'),
293 $default = sprintf('%s <em>(%s)</em>',
294 $this->t("Enable jQuery sf-Smallscreen plugin for this menu depending on the user's Web browser <strong>window width</strong>."),
297 $form['sf-plugins']['sf-smallscreen']['superfish_small'] = [
299 '#default_value' => $this->configuration['small'],
301 0 => sprintf('%s.', $this->t('Disable')),
302 1 => $this->t('Enable jQuery sf-Smallscreen plugin for this menu.'),
304 3 => $this->t("Enable jQuery sf-Smallscreen plugin for this menu depending on the user's Web browser <strong>user agent</strong>."),
307 $description = sprintf('%s<br><br>%s<br><code><meta name="viewport" content="width=device-width, initial-scale=1.0" /></code>',
308 $this->t("sf-Smallscreen will be enabled only if the width of user's Web browser window is smaller than the below value."),
309 $this->t('Please note that in most cases such a meta tag is necessary for this feature to work properly:')
311 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-windowwidth'] = [
312 '#type' => 'details',
313 '#title' => $this->t('Window width settings'),
314 '#description' => $description,
317 $description = sprintf('%s <em>(%s: 768)</em>',
318 $this->t('Also known as "Breakpoint".'),
321 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-windowwidth']['superfish_smallbp'] = [
323 '#description' => $description,
324 '#default_value' => $this->configuration['smallbp'],
325 '#field_suffix' => $this->t('pixels'),
328 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-useragent'] = [
329 '#type' => 'details',
330 '#title' => $this->t('User agent settings'),
333 $default = sprintf('%s <em>(%s) (%s)</em>',
334 $this->t('Use the pre-defined list of the <strong>user agents</strong>.'),
336 $this->t('Recommended')
338 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-useragent']['superfish_smallua'] = [
340 '#default_value' => $this->configuration['smallua'],
343 1 => $this->t('Use the custom list of the <strong>user agents</strong>.'),
346 if (isset($_SERVER['HTTP_USER_AGENT'])) {
347 $user_agent = sprintf('<br><strong>%s</strong> %s',
348 $this->t('UA string of the current Web browser:'),
349 $_SERVER['HTTP_USER_AGENT']
355 $description = sprintf('%s <em>(%s: %s)</em><br>%s:<ul>
356 <li>iPhone*Android*iPad <em><sup>(%s)</sup></em></li>
357 <li>Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2
358 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.0 * Mozilla/5.0
359 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10
360 (KHTML, like Gecko) Mobile/7B405</li>
362 $this->t('Could be partial or complete. (Asterisk separated)'),
365 $this->t('Examples'),
366 $this->t('Recommended'),
369 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-useragent']['superfish_smallual'] = [
370 '#type' => 'textfield',
371 '#title' => $this->t('Custom list of the user agents'),
372 '#description' => $description,
373 '#default_value' => $this->configuration['smallual'],
375 '#maxlength' => 2000,
377 $description = sprintf('<em>(%s: %s)</em>',
379 $this->t('Client-side (JavaScript)')
381 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-useragent']['superfish_smalluam'] = [
383 '#title' => $this->t('<strong>User agent</strong> detection method'),
384 '#description' => $description,
385 '#default_value' => $this->configuration['smalluam'],
387 0 => $this->t('Client-side (JavaScript)'),
388 1 => $this->t('Server-side (PHP)'),
391 $default = sprintf('%s <em>(%s)</em>',
392 $this->t('Convert the menu to an accordion menu.'),
395 $form['sf-plugins']['sf-smallscreen']['superfish_smallact'] = [
397 '#title' => $this->t('Select a type'),
398 '#default_value' => $this->configuration['smallact'],
401 0 => $this->t('Convert the menu to a <select> element.'),
404 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select'] = [
405 '#type' => 'details',
406 '#title' => $this->t('<select> settings'),
409 $description = sprintf('%s <em>(%s: %s)</em><br>%s: <em> - %s - </em>',
410 $this->t('By default the first item in the <select> element will be the name of the parent menu or the title of this block, you can change this by setting a custom title.'),
414 $this->t('Main Menu')
416 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['superfish_smallset'] = [
417 '#type' => 'textfield',
418 '#title' => $this->t('<select> title'),
419 '#description' => $description,
420 '#default_value' => $this->configuration['smallset'],
424 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['superfish_smallasa'] = [
425 '#type' => 'checkbox',
426 '#title' => $this->t('Add <em>selected</em> attribute to the <option> element with the class <strong>active</strong> .'),
427 '#description' => $this->t('Makes pre-selected the item linked to the active page when the page loads.'),
428 '#default_value' => $this->configuration['smallasa'],
430 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more'] = [
431 '#type' => 'details',
432 '#title' => $this->t('More'),
435 $title = sprintf('%s <em>(%s: %s)</em>',
436 $this->t('Copy the main <ul> classes to the <select>.'),
440 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallcmc'] = [
441 '#type' => 'checkbox',
443 '#default_value' => $this->configuration['smallcmc'],
445 $description = sprintf('%s <em>(%s: %s)</em>',
446 $this->t('Comma separated'),
450 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallecm'] = [
451 '#type' => 'textfield',
452 '#title' => $this->t('Exclude these classes from the <select> element'),
453 '#description' => $description,
454 '#default_value' => $this->configuration['smallecm'],
456 '#maxlength' => 1000,
459 ':input[name="superfish_smallcmc"]' => [
466 $title = sprintf('%s <em>(%s: %s)</em>',
467 $this->t('Copy the hyperlink classes to the <option> elements of the <select>.'),
471 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallchc'] = [
472 '#type' => 'checkbox',
474 '#default_value' => $this->configuration['smallchc'],
476 $description = sprintf('%s <em>(%s: %s)</em>',
477 $this->t('Comma separated'),
481 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallech'] = [
482 '#type' => 'textfield',
483 '#title' => $this->t('Exclude these classes from the <option> elements of the <select>'),
484 '#description' => $description,
485 '#default_value' => $this->configuration['smallech'],
487 '#maxlength' => 1000,
490 ':input[name="superfish_smallchc"]' => [
496 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallicm'] = [
497 '#type' => 'textfield',
498 '#title' => $this->t('Include these classes in the <select> element'),
499 '#description' => $description,
500 '#default_value' => $this->configuration['smallicm'],
502 '#maxlength' => 1000,
504 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallich'] = [
505 '#type' => 'textfield',
506 '#title' => $this->t('Include these classes in the <option> elements of the <select>'),
507 '#description' => $description,
508 '#default_value' => $this->configuration['smallich'],
510 '#maxlength' => 1000,
512 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-accordion'] = [
513 '#type' => 'details',
514 '#title' => $this->t('Accordion settings'),
517 $description = sprintf('%s <em>(%s: %s)</em><br>%s: <em>%s</em>.',
518 $this->t('By default the caption of the accordion toggle switch will be the name of the parent menu or the title of this block, you can change this by setting a custom title.'),
524 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-accordion']['superfish_smallamt'] = [
525 '#type' => 'textfield',
526 '#title' => $this->t('Accordion menu title'),
527 '#description' => $description,
528 '#default_value' => $this->configuration['smallamt'],
532 $default = sprintf('%s <em>(%s)</em>',
533 $this->t('Use parent menu items as buttons, add cloned parent links to sub-menus as well.'),
536 $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-accordion']['superfish_smallabt'] = [
538 '#title' => $this->t('Accordion button type'),
539 '#default_value' => $this->configuration['smallabt'],
541 0 => $this->t('Use parent menu items as buttons.'),
543 2 => $this->t('Create new links next to parent menu item links and use them as buttons.'),
546 $form['sf-plugins']['sf-supersubs'] = [
547 '#type' => 'details',
548 '#title' => $this->t('Supersubs'),
549 '#description' => $this->t('<strong>Supersubs</strong> makes it possible to define custom widths for your menus.'),
552 $form['sf-plugins']['sf-supersubs']['superfish_supersubs'] = [
553 '#type' => 'checkbox',
554 '#title' => $this->t('Enable Supersubs for this menu.'),
555 '#default_value' => $this->configuration['supersubs'],
557 $description = sprintf('%s <em>(%s: 12)</em>',
558 $this->t('Minimum width for sub-menus, in <strong>em</strong> units.'),
561 $form['sf-plugins']['sf-supersubs']['superfish_minwidth'] = [
563 '#title' => $this->t('Minimum width'),
564 '#description' => $description,
565 '#default_value' => $this->configuration['minwidth'],
568 $description = sprintf('%s <em>(%s: 27)</em>',
569 $this->t('Maximum width for sub-menus, in <strong>em</strong> units.'),
572 $form['sf-plugins']['sf-supersubs']['superfish_maxwidth'] = [
574 '#title' => $this->t('Maximum width'),
575 '#description' => $description,
576 '#default_value' => $this->configuration['maxwidth'],
579 $form['sf-multicolumn'] = [
580 '#type' => 'details',
581 '#description' => $this->t('Please refer to the Superfish module documentation for how you should setup multi-column sub-menus.'),
582 '#title' => $this->t('Multi-column sub-menus'),
585 $form['sf-multicolumn']['superfish_multicolumn'] = [
586 '#type' => 'checkbox',
587 '#title' => $this->t('Enable multi-column sub-menus.'),
588 '#default_value' => $this->configuration['multicolumn'],
590 $description = sprintf('%s <em>(%s: 1)</em>',
591 $this->t('The depth of the first instance of multi-column sub-menus.'),
594 $form['sf-multicolumn']['superfish_multicolumn_depth'] = [
596 '#title' => $this->t('Start from depth'),
597 '#description' => $description,
598 '#default_value' => $this->configuration['multicolumn_depth'],
599 '#options' => array_combine(range(1, 10), range(1, 10)),
601 $description = sprintf('%s <em>(%s: 1)</em>',
602 $this->t('The amount of sub-menu levels that will be included in the multi-column sub-menu.'),
605 $form['sf-multicolumn']['superfish_multicolumn_levels'] = [
607 '#title' => $this->t('Levels'),
608 '#description' => $description,
609 '#default_value' => $this->configuration['multicolumn_levels'],
610 '#options' => array_combine(range(1, 10), range(1, 10)),
612 $form['sf-advanced'] = [
613 '#type' => 'details',
614 '#title' => $this->t('Advanced settings'),
617 $form['sf-advanced']['sf-settings'] = [
618 '#type' => 'details',
619 '#title' => $this->t('Superfish'),
622 $description = sprintf('%s <em>(%s: fast)</em>',
623 $this->t('The speed of the animation either in <strong>milliseconds</strong> or pre-defined values (<strong>slow, normal, fast</strong>).'),
626 $form['sf-advanced']['sf-settings']['superfish_speed'] = [
627 '#type' => 'textfield',
628 '#title' => $this->t('Animation speed'),
629 '#description' => $description,
630 '#default_value' => $this->configuration['speed'],
633 $description = sprintf('%s <em>(%s: 800)</em>',
634 $this->t('The delay in <strong>milliseconds</strong> that the mouse can remain outside a sub-menu without it closing.'),
637 $form['sf-advanced']['sf-settings']['superfish_delay'] = [
639 '#title' => $this->t('Mouse delay'),
640 '#description' => $description,
641 '#default_value' => $this->configuration['delay'],
644 $description = sprintf('%s <em>(%s: 1)</em><br>%s',
645 $this->t('The amount of sub-menu levels that remain open or are restored using the ".active-trail" class.'),
647 $this->t('Change this setting <strong>only and only</strong> if you are <strong>totally sure</strong> of what you are doing.')
649 $form['sf-advanced']['sf-settings']['superfish_pathlevels'] = [
651 '#title' => $this->t('Path levels'),
652 '#description' => $description,
653 '#default_value' => $this->configuration['pathlevels'],
654 '#options' => array_combine(range(0, 10), range(0, 10)),
656 $form['sf-advanced']['sf-hyperlinks'] = [
657 '#type' => 'details',
658 '#title' => $this->t('Hyperlinks'),
661 $description = sprintf('%s <em>(%s: %s)</em>',
662 $this->t('By enabling this option, only parent menu items with <em>Expanded</em> option enabled will have their submenus appear.'),
666 $form['sf-advanced']['sf-hyperlinks']['superfish_expanded'] = [
667 '#type' => 'checkbox',
668 '#title' => $this->t('Take "Expanded" option into effect.'),
669 '#description' => $description,
670 '#default_value' => $this->configuration['expanded'],
672 $description = sprintf('%s <em>(%s: %s)</em>',
673 $this->t('Add cloned parent links to the top of sub-menus.'),
677 $form['sf-advanced']['sf-hyperlinks']['superfish_clone_parent'] = [
678 '#type' => 'checkbox',
679 '#title' => $description,
680 '#default_value' => $this->configuration['clone_parent'],
682 $description = sprintf('%s <em>(%s: %s)</em>',
683 $this->t('Disable hyperlink descriptions ("title" attribute)'),
687 $form['sf-advanced']['sf-hyperlinks']['superfish_hide_linkdescription'] = [
688 '#type' => 'checkbox',
689 '#title' => $description,
690 '#default_value' => $this->configuration['hide_linkdescription'],
692 $description = sprintf('%s <em>(%s: %s)</em>',
693 $this->t('Insert hyperlink descriptions ("title" attribute) into hyperlink texts.'),
697 $form['sf-advanced']['sf-hyperlinks']['superfish_add_linkdescription'] = [
698 '#type' => 'checkbox',
699 '#title' => $description,
700 '#default_value' => $this->configuration['add_linkdescription'],
702 $title = sprintf('%s <em>(sf-depth-1, sf-depth-2, sf-depth-3, ...)</em> <em>(%s: %s)</em>',
703 $this->t('Add item depth classes to menu items and their hyperlinks.'),
707 $form['sf-advanced']['sf-hyperlinks']['superfish_itemdepth'] = [
708 '#type' => 'checkbox',
710 '#default_value' => $this->configuration['link_depth_class'],
712 $form['sf-advanced']['sf-custom-classes'] = [
713 '#type' => 'details',
714 '#title' => $this->t('Custom classes'),
717 $description = sprintf('%s <em>(%s: %s)</em><br>%s: top-menu category-science',
718 $this->t('(Space separated, without dots)'),
723 $form['sf-advanced']['sf-custom-classes']['superfish_ulclass'] = [
724 '#type' => 'textfield',
725 '#title' => $this->t('For the main UL'),
726 '#description' => $description,
727 '#default_value' => $this->configuration['custom_list_class'],
729 '#maxlength' => 1000,
731 $description = sprintf('%s <em>(%s: %s)</em><br>%s: science-sub',
732 $this->t('(Space separated, without dots)'),
737 $form['sf-advanced']['sf-custom-classes']['superfish_liclass'] = [
738 '#type' => 'textfield',
739 '#title' => $this->t('For the list items'),
740 '#description' => $description,
741 '#default_value' => $this->configuration['custom_item_class'],
743 '#maxlength' => 1000,
745 $description = sprintf('%s <em>(%s: %s)</em><br>%s: science-link',
746 $this->t('(Space separated, without dots)'),
751 $form['sf-advanced']['sf-custom-classes']['superfish_hlclass'] = [
752 '#type' => 'textfield',
753 '#title' => $this->t('For the hyperlinks'),
754 '#description' => $description,
755 '#default_value' => $this->configuration['custom_link_class'],
757 '#maxlength' => 1000,
763 * Overrides \Drupal\block\BlockBase::blockValiate().
765 public function blockValidate($form, FormStateInterface $form_state) {
766 $touch = $form_state->getValue([
769 'sf-touchscreen-useragent',
772 $touchbp = $form_state->getValue([
775 'sf-touchscreen-windowwidth',
778 $touchua = $form_state->getValue([
781 'sf-touchscreen-useragent',
784 $touchual = $form_state->getValue([
787 'sf-touchscreen-useragent',
788 'superfish_touchual',
790 $small = $form_state->getValue([
793 'sf-smallscreen-useragent',
796 $smallbp = $form_state->getValue([
799 'sf-smallscreen-windowwidth',
802 $smallua = $form_state->getValue([
805 'sf-smallscreen-useragent',
808 $smallual = $form_state->getValue([
811 'sf-smallscreen-useragent',
812 'superfish_smallual',
814 $minwidth = $form_state->getValue([
817 'superfish_minwidth',
819 $maxwidth = $form_state->getValue([
822 'superfish_maxwidth',
824 $speed = $form_state->getValue([
829 $delay = $form_state->getValue([
835 if (!is_numeric($speed) && !in_array($speed, ['slow', 'normal', 'fast'])) {
836 $form_state->setErrorByName('superfish_speed', t('Unacceptable value entered for the "Animation speed" option.'));
838 if (!is_numeric($delay)) {
839 $form_state->setErrorByName('superfish_delay', t('Unacceptable value entered for the "Mouse delay" option.'));
841 if ($touch == 2 && $touchbp == '') {
842 $form_state->setErrorByName('superfish_touchbp', t('"sfTouchscreen Breakpoint" option cannot be empty.'));
844 if (!is_numeric($touchbp)) {
845 $form_state->setErrorByName('superfish_touchbp', t('Unacceptable value enterd for the "sfTouchscreen Breakpoint" option.'));
847 if ($touch == 3 && $touchua == 1 && $touchual == '') {
848 $form_state->setErrorByName('superfish_touchual', t('List of the touch-screen user agents cannot be empty.'));
850 if ($small == 2 && $smallbp == '') {
851 $form_state->setErrorByName('superfish_smallbp', t('"sfSmallscreen Breakpoint" option cannot be empty.'));
853 if (!is_numeric($smallbp)) {
854 $form_state->setErrorByName('superfish_smallbp', t('Unacceptable value entered for the "sfSmallscreen Breakpoint" option.'));
856 if ($small == 3 && $smallua == 1 && $smallual == '') {
857 $form_state->setErrorByName('superfish_smallual', t('List of the small-screen user agents cannot be empty.'));
860 $supersubs_error = FALSE;
861 if (!is_numeric($minwidth)) {
862 $form_state->setErrorByName('superfish_minwidth', t('Unacceptable value entered for the "Supersubs minimum width" option.'));
863 $supersubs_error = TRUE;
865 if (!is_numeric($maxwidth)) {
866 $form_state->setErrorByName('superfish_maxwidth', t('Unacceptable value entered for the "Supersubs maximum width" option.'));
867 $supersubs_error = TRUE;
869 if ($supersubs_error !== TRUE && $minwidth > $maxwidth) {
870 $form_state->setErrorByName('superfish_maxwidth', t('Supersubs "maximum width" has to be bigger than the "minimum width".'));
875 * Overrides \Drupal\block\BlockBase::blockSubmit().
877 public function blockSubmit($form, FormStateInterface $form_state) {
879 $this->configuration['level'] = $form_state->getValue('level');
880 $this->configuration['depth'] = $form_state->getValue('depth');
881 $this->configuration['menu_type'] = $form_state->getValue([
885 $this->configuration['style'] = $form_state->getValue([
889 $this->configuration['arrow'] = $form_state->getValue([
893 $this->configuration['shadow'] = $form_state->getValue([
897 $this->configuration['slide'] = $form_state->getValue([
902 $this->configuration['supposition'] = $form_state->getValue([
904 'superfish_supposition',
906 $this->configuration['hoverintent'] = $form_state->getValue([
908 'superfish_hoverintent',
911 $this->configuration['touch'] = $form_state->getValue([
916 $this->configuration['touchbh'] = $form_state->getValue([
921 $this->configuration['touchbp'] = $form_state->getValue([
924 'sf-touchscreen-windowwidth',
927 $this->configuration['touchua'] = $form_state->getValue([
930 'sf-touchscreen-useragent',
933 $this->configuration['touchual'] = $form_state->getValue([
936 'sf-touchscreen-useragent',
937 'superfish_touchual',
939 $this->configuration['touchuam'] = $form_state->getValue([
942 'sf-touchscreen-useragent',
943 'superfish_touchuam',
946 $this->configuration['small'] = $form_state->getValue([
951 $this->configuration['smallact'] = $form_state->getValue([
954 'superfish_smallact',
956 $this->configuration['smallbp'] = $form_state->getValue([
959 'sf-smallscreen-windowwidth',
962 $this->configuration['smallua'] = $form_state->getValue([
965 'sf-smallscreen-useragent',
968 $this->configuration['smallual'] = $form_state->getValue([
971 'sf-smallscreen-useragent',
972 'superfish_smallual',
974 $this->configuration['smalluam'] = $form_state->getValue([
977 'sf-smallscreen-useragent',
978 'superfish_smalluam',
980 $this->configuration['smallset'] = $form_state->getValue([
983 'sf-smallscreen-select',
984 'superfish_smallset',
986 $this->configuration['smallasa'] = $form_state->getValue([
989 'sf-smallscreen-select',
990 'superfish_smallasa',
992 $this->configuration['smallcmc'] = $form_state->getValue([
995 'sf-smallscreen-select',
996 'sf-smallscreen-select-more',
997 'superfish_smallcmc',
999 $this->configuration['smallecm'] = $form_state->getValue([
1002 'sf-smallscreen-select',
1003 'sf-smallscreen-select-more',
1004 'superfish_smallecm',
1006 $this->configuration['smallchc'] = $form_state->getValue([
1009 'sf-smallscreen-select',
1010 'sf-smallscreen-select-more',
1011 'superfish_smallchc',
1013 $this->configuration['smallech'] = $form_state->getValue([
1016 'sf-smallscreen-select',
1017 'sf-smallscreen-select-more',
1018 'superfish_smallech',
1020 $this->configuration['smallicm'] = $form_state->getValue([
1023 'sf-smallscreen-select',
1024 'sf-smallscreen-select-more',
1025 'superfish_smallicm',
1027 $this->configuration['smallich'] = $form_state->getValue([
1030 'sf-smallscreen-select',
1031 'sf-smallscreen-select-more',
1032 'superfish_smallich',
1034 $this->configuration['smallamt'] = $form_state->getValue([
1037 'sf-smallscreen-accordion',
1038 'superfish_smallamt',
1040 $this->configuration['smallabt'] = $form_state->getValue([
1043 'sf-smallscreen-accordion',
1044 'superfish_smallabt',
1047 $this->configuration['supersubs'] = $form_state->getValue([
1050 'superfish_supersubs',
1052 $this->configuration['minwidth'] = $form_state->getValue([
1055 'superfish_minwidth',
1057 $this->configuration['maxwidth'] = $form_state->getValue([
1060 'superfish_maxwidth',
1062 $this->configuration['multicolumn'] = $form_state->getValue([
1064 'superfish_multicolumn',
1066 $this->configuration['multicolumn_depth'] = $form_state->getValue([
1068 'superfish_multicolumn_depth',
1070 $this->configuration['multicolumn_levels'] = $form_state->getValue([
1072 'superfish_multicolumn_levels',
1075 $this->configuration['speed'] = $form_state->getValue([
1080 $this->configuration['delay'] = $form_state->getValue([
1085 $this->configuration['pathlevels'] = $form_state->getValue([
1088 'superfish_pathlevels',
1090 $this->configuration['expanded'] = $form_state->getValue([
1093 'superfish_expanded',
1095 $this->configuration['clone_parent'] = $form_state->getValue([
1098 'superfish_clone_parent',
1100 $this->configuration['hide_linkdescription'] = $form_state->getValue([
1103 'superfish_hide_linkdescription',
1105 $this->configuration['add_linkdescription'] = $form_state->getValue([
1108 'superfish_add_linkdescription',
1110 $this->configuration['link_depth_class'] = $form_state->getValue([
1113 'superfish_itemdepth',
1115 $this->configuration['custom_list_class'] = $form_state->getValue([
1117 'sf-custom-classes',
1118 'superfish_ulclass',
1120 $this->configuration['custom_item_class'] = $form_state->getValue([
1122 'sf-custom-classes',
1123 'superfish_liclass',
1125 $this->configuration['custom_link_class'] = $form_state->getValue([
1127 'sf-custom-classes',
1128 'superfish_hlclass',
1133 * Implements \Drupal\block\BlockBase::build().
1135 public function build() {
1139 // Block settings which will be passed to the Superfish themes.
1141 $sfsettings['level'] = $this->configuration['level'];
1142 $sfsettings['depth'] = $this->configuration['depth'];
1143 $sfsettings['menu_type'] = $this->configuration['menu_type'];
1144 $sfsettings['style'] = $this->configuration['style'];
1145 $sfsettings['expanded'] = $this->configuration['expanded'];
1146 $sfsettings['itemdepth'] = $this->configuration['link_depth_class'];
1147 $sfsettings['ulclass'] = $this->configuration['custom_list_class'];
1148 $sfsettings['liclass'] = $this->configuration['custom_item_class'];
1149 $sfsettings['hlclass'] = $this->configuration['custom_link_class'];
1150 $sfsettings['clone_parent'] = $this->configuration['clone_parent'];
1151 $sfsettings['hide_linkdescription'] = $this->configuration['hide_linkdescription'];
1152 $sfsettings['add_linkdescription'] = $this->configuration['add_linkdescription'];
1153 $sfsettings['multicolumn'] = $this->configuration['multicolumn'];
1154 $sfsettings['multicolumn_depth'] = ($this->configuration['menu_type'] == 'navbar' && $this->configuration['multicolumn_depth'] == 1) ? 2 : $this->configuration['multicolumn_depth'];
1155 $sfsettings['multicolumn_levels'] = $this->configuration['multicolumn_levels'] + $sfsettings['multicolumn_depth'];
1157 // jQuery plugin options which will be passed to the Drupal behavior.
1159 $sfoptions['pathClass'] = ($sfsettings['menu_type'] == 'navbar') ? 'active-trail' : '';
1160 $sfoptions['pathLevels'] = ($this->configuration['pathlevels'] != 1) ? $this->configuration['pathlevels'] : '';
1161 $sfoptions['delay'] = ($this->configuration['delay'] != 800) ? $this->configuration['delay'] : '';
1162 $sfoptions['animation']['opacity'] = 'show';
1163 $slide = $this->configuration['slide'];
1164 if (strpos($slide, '_')) {
1165 $slide = explode('_', $slide);
1166 switch ($slide[1]) {
1168 $sfoptions['animation']['height'] = ['show', $slide[0]];
1172 $sfoptions['animation']['width'] = ['show', $slide[0]];
1176 $sfoptions['animation']['height'] = ['show', $slide[0]];
1177 $sfoptions['animation']['width'] = ['show', $slide[0]];
1181 $build['#attached']['library'][] = 'superfish/superfish_easing';
1186 $sfoptions['animation']['height'] = 'show';
1190 $sfoptions['animation']['width'] = 'show';
1194 $sfoptions['animation']['height'] = 'show';
1195 $sfoptions['animation']['width'] = 'show';
1200 $speed = $this->configuration['speed'];
1201 if ($speed != 'normal') {
1202 if (is_numeric($speed)) {
1203 $sfoptions['speed'] = (int) $speed;
1205 elseif (in_array($speed, ['slow', 'normal', 'fast'])) {
1206 $sfoptions['speed'] = $speed;
1209 if ($this->configuration['arrow'] == 0) {
1210 $sfoptions['autoArrows'] = FALSE;
1212 if ($this->configuration['shadow'] == 0) {
1213 $sfoptions['dropShadows'] = FALSE;
1216 if ($this->configuration['hoverintent']) {
1217 $build['#attached']['library'][] = 'superfish/superfish_hoverintent';
1220 $sfoptions['disableHI'] = TRUE;
1222 $sfoptions = sf_array_filter($sfoptions);
1224 // Options for Superfish sub-plugins.
1226 $touchscreen = $this->configuration['touch'];
1228 $build['#attached']['library'][] = 'superfish/superfish_touchscreen';
1229 $behaviour = $this->configuration['touchbh'];
1230 $sfplugins['touchscreen']['behaviour'] = ($behaviour != 2) ? $behaviour : '';
1231 switch ($touchscreen) {
1233 $sfplugins['touchscreen']['mode'] = 'always_active';
1237 $sfplugins['touchscreen']['mode'] = 'window_width';
1238 $tsbp = $this->configuration['touchbp'];
1239 $sfplugins['touchscreen']['breakpoint'] = ($tsbp != 768) ? (float) $tsbp : '';
1243 // Which method to use for UA detection.
1244 $tsuam = $this->configuration['touchuam'];
1245 $tsua = $this->configuration['touchua'];
1251 $sfplugins['touchscreen']['mode'] = 'useragent_predefined';
1255 $sfplugins['touchscreen']['mode'] = 'useragent_custom';
1256 $tsual = drupal_strtolower($this->configuration['touchual']);
1257 if (strpos($tsual, '*')) {
1258 $tsual = str_replace('*', '|', $tsual);
1260 $sfplugins['touchscreen']['useragent'] = $tsual;
1268 if (isset($_SERVER['HTTP_USER_AGENT'])) {
1269 $hua = drupal_strtolower($_SERVER['HTTP_USER_AGENT']);
1271 // Use the pre-defined list of mobile UA strings.
1273 if (preg_match('/(android|bb\d+|meego)|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $hua)) {
1274 $sfplugins['touchscreen']['mode'] = 'always_active';
1275 if ($behaviour == 2) {
1276 $sfsettings['clone_parent'] = 1;
1281 // Use the custom list of UA strings.
1283 $tsual = drupal_strtolower($this->configuration['touchual']);
1285 if (strpos($tsual, '*')) {
1286 $tsual = explode('*', $tsual);
1287 foreach ($tsual as $ua) {
1288 $tsuac[] = (strpos($hua, $ua)) ? 1 : 0;
1292 $tsuac[] = (strpos($hua, $tsual)) ? 1 : 0;
1294 if (in_array(1, $tsuac)) {
1295 $sfplugins['touchscreen']['mode'] = 'always_active';
1296 if ($behaviour == 2) {
1297 $sfsettings['clone_parent'] = 1;
1312 $smallscreen = $this->configuration['small'];
1314 $build['#attached']['library'][] = 'superfish/superfish_smallscreen';
1315 switch ($smallscreen) {
1317 $sfplugins['smallscreen']['mode'] = 'always_active';
1321 $sfplugins['smallscreen']['mode'] = 'window_width';
1322 $ssbp = $this->configuration['smallbp'];
1324 $sfplugins['smallscreen']['breakpoint'] = (float) $ssbp;
1327 $sfplugins['smallscreen']['breakpoint'] = '';
1332 // Which method to use for UA detection.
1333 $ssuam = $this->configuration['smalluam'];
1334 $ssua = $this->configuration['smallua'];
1340 $sfplugins['smallscreen']['mode'] = 'useragent_predefined';
1344 $sfplugins['smallscreen']['mode'] = 'useragent_custom';
1345 $ssual = drupal_strtolower($this->configuration['smallual']);
1346 if (strpos($ssual, '*')) {
1347 $ssual = str_replace('*', '|', $ssual);
1349 $sfplugins['smallscreen']['useragent'] = $ssual;
1357 if (isset($_SERVER['HTTP_USER_AGENT'])) {
1358 $hua = drupal_strtolower($_SERVER['HTTP_USER_AGENT']);
1360 // Use the pre-defined list of mobile UA strings.
1362 if (preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $hua)) {
1363 $sfplugins['smallscreen']['mode'] = 'always_active';
1367 // Use the custom list of UA strings.
1369 $ssual = $this->configuration['smallual'];
1370 $ssual = drupal_strtolower($ssual);
1372 if (strpos($ssual, '*')) {
1373 $ssual = explode('*', $ssual);
1374 foreach ($ssual as $ua) {
1375 $ssuac[] = (strpos($hua, $ua)) ? 1 : 0;
1379 $ssuac[] = (strpos($hua, $ssual)) ? 1 : 0;
1381 if (in_array(1, $ssuac)) {
1382 $sfplugins['smallscreen']['mode'] = 'always_active';
1394 $type = $this->configuration['smallact'];
1397 $asa = $this->configuration['smallasa'];
1398 $cmc = $this->configuration['smallcmc'];
1399 $chc = $this->configuration['smallchc'];
1400 $ecm = $this->configuration['smallecm'];
1401 $ech = $this->configuration['smallech'];
1402 $icm = $this->configuration['smallicm'];
1403 $ich = $this->configuration['smallich'];
1405 $sfplugins['smallscreen']['type'] = 'select';
1406 $sfplugins['smallscreen']['addSelected'] = ($asa == 1) ? TRUE : '';
1407 $sfplugins['smallscreen']['menuClasses'] = ($cmc == 1) ? TRUE : '';
1409 $sfplugins['smallscreen']['hyperlinkClasses'] = TRUE;
1411 if ($cmc == 1 && !empty($ecm)) {
1412 $sfplugins['smallscreen']['excludeClass_menu'] = $ecm;
1414 if ($chc == 1 && !empty($ech)) {
1415 $sfplugins['smallscreen']['excludeClass_hyperlink'] = $ech;
1418 $sfplugins['smallscreen']['includeClass_menu'] = $icm;
1421 $sfplugins['smallscreen']['includeClass_hyperlink'] = $ich;
1426 $ab = $this->configuration['smallabt'];
1427 $sfplugins['smallscreen']['accordionButton'] = ($ab != 1) ? $ab : '';
1428 if ($this->t('Expand') != 'Expand') {
1429 $sfplugins['smallscreen']['expandText'] = $this->t('Expand');
1431 if ($this->t('Collapse') != 'Collapse') {
1432 $sfplugins['smallscreen']['collapseText'] = $this->t('Collapse');
1439 if ($this->configuration['supposition']) {
1440 $sfplugins['supposition'] = TRUE;
1441 $build['#attached']['library'][] = 'superfish/superfish_supposition';
1444 if ($this->configuration['supersubs']) {
1445 $build['#attached']['library'][] = 'superfish/superfish_supersubs';
1446 $minwidth = $this->configuration['minwidth'];
1447 $maxwidth = $this->configuration['maxwidth'];
1448 $sfplugins['supersubs']['minWidth'] = ($minwidth != 12) ? $minwidth : '';
1449 $sfplugins['supersubs']['maxWidth'] = ($maxwidth != 27) ? $maxwidth : '';
1450 if (empty($sfplugins['supersubs']['minWidth']) &&
1451 empty($sfplugins['supersubs']['maxWidth'])) {
1452 $sfplugins['supersubs'] = TRUE;
1456 // Attaching the requires JavaScript and CSS files.
1457 $build['#attached']['library'][] = 'superfish/superfish';
1458 if ($sfsettings['style'] != 'none') {
1459 $style = 'superfish/superfish_style_' . $sfsettings['style'];
1460 $build['#attached']['library'][] = $style;
1463 // Title for the small-screen menu.
1468 $title = $this->configuration['smallset'];
1472 $title = $this->configuration['smallamt'];
1476 $sfplugins['smallscreen']['title'] = $title ? $title : $this->label();
1478 $sfplugins = sf_array_filter($sfplugins);
1481 $menu_name = $this->getDerivativeId();
1484 $level = $this->configuration['level'];
1485 // Menu display depth.
1486 $depth = $sfsettings['depth'];
1489 * By not setting the any expanded parents we don't limit the loading of the
1491 * Calling MenuLinkTreeInterface::getCurrentRouteMenuTreeParameters we
1492 * would be doing so.
1493 * We don't actually need the parents expanded as we do different rendering.
1496 $maxdepth = min($level + ($depth - 1), $this->menuTree->maxDepth());
1501 $parameters = (new MenuTreeParameters())
1502 ->setMinDepth($level)
1503 ->setMaxDepth($maxdepth)
1504 ->setActiveTrail($this->menuActiveTrail->getActiveTrailIds($menu_name))
1505 ->onlyEnabledLinks();
1507 $tree = $this->menuTree->load($menu_name, $parameters);
1509 ['callable' => 'menu.default_tree_manipulators:checkAccess'],
1510 ['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'],
1512 $tree = $this->menuTree->transform($tree, $manipulators);
1515 $id = Html::getUniqueId('superfish-' . $menu_name);
1517 // Preparing the Drupal behavior.
1518 $build['#attached']['drupalSettings']['superfish'][$id]['id'] = $id;
1519 if (isset($sfoptions)) {
1520 $build['#attached']['drupalSettings']['superfish'][$id]['sf'] = $sfoptions;
1523 $build['#attached']['drupalSettings']['superfish'][$id]['sf'] = [];
1525 if (!empty($sfplugins)) {
1526 $build['#attached']['drupalSettings']['superfish'][$id]['plugins'] = $sfplugins;
1529 // Calling the theme.
1530 $build['content'] = [
1531 '#theme' => 'superfish',
1532 '#menu_name' => $menu_name,
1535 '#settings' => $sfsettings,
1537 // Build the original menu tree to calculate cache tags and contexts.
1538 $treeBuild = $this->menuTree->build($tree);
1539 $build['#cache'] = $treeBuild['#cache'];
1545 * Overrides \Drupal\block\BlockBase::defaultConfiguration().
1547 public function defaultConfiguration() {
1548 return parent::defaultConfiguration() + [
1551 'menu_type' => 'horizontal',
1557 'slide' => 'vertical',
1586 'multicolumn_depth' => 1,
1587 'multicolumn_levels' => 0,
1590 'clone_parent' => 0,
1591 'hide_linkdescription' => 0,
1592 'add_linkdescription' => 0,
1593 'link_depth_class' => 1,
1594 'custom_list_class' => '',
1595 'custom_item_class' => '',
1596 'custom_link_class' => '',