You are here

public function MultiLevelPushMenu::getJsSettings in Responsive Menus 8

Get Drupal Javscript settings array.

Return value

array The Javascript settings array.

Overrides ResponsiveMenusPluginBase::getJsSettings

File

src/Plugin/ResponsiveMenus/MultiLevelPushMenu.php, line 261

Class

MultiLevelPushMenu
Defines the "mlpm" plugin.

Namespace

Drupal\responsive_menus\Plugin\ResponsiveMenus

Code

public function getJsSettings() {
  $toggle = $this
    ->getSetting('responsive_menus_mlpm_toggle');
  $style = $this
    ->getSetting('responsive_menus_mlpm_decoration');
  $js_settings = [
    'selectors' => $this
      ->getSetting('responsive_menus_mlpm_css_selectors'),
    'media_size' => $this
      ->getSetting('responsive_menus_mlpm_media_size'),
    'move_to' => $this
      ->getSetting('responsive_menus_mlpm_move_to'),
    'nav_block' => $this
      ->getSetting('responsive_menus_mlpm_nav_block'),
    'nav_block_name' => $this
      ->getSetting('responsive_menus_mlpm_nav_block_name'),
    'push' => explode("\n", $this
      ->getSetting('responsive_menus_mlpm_push')),
    'menu_height' => $this
      ->getSetting('responsive_menus_mlpm_menu_height'),
    'direction' => $this
      ->getSetting('responsive_menus_mlpm_direction'),
    'mode' => $this
      ->getSetting('responsive_menus_mlpm_mode'),
    'collapsed' => $this
      ->getSetting('responsive_menus_mlpm_collapsed'),
    'full_collapse' => $this
      ->getSetting('responsive_menus_mlpm_full_collapse'),
    'swipe' => $this
      ->getSetting('responsive_menus_mlpm_swipe'),
    'toggle_container' => $toggle['container'],
    'toggle_text' => isset($toggle['text']) ? check_markup($toggle['text'], 'filtered_html') : '',
    'off_menu' => $toggle['off_menu'],
    'back_text' => $style['back_text'],
    'back_class' => $style['back_class'],
    'back_icon' => $style['back_icon'],
    'group_icon' => $style['group_icon'],
  ];
  return $js_settings;
}