You are here

function superfish_block in Superfish 6

Implements hook_block().

File

./superfish.module, line 49
Enables the use of jQuery Superfish plugin for Drupal menus.

Code

function superfish_block($op = 'list', $delta = 0, $edit = array()) {
  global $user;
  switch ($op) {
    case 'list':
      $number = variable_get('superfish_number', 4);
      for ($i = 1; $i <= $number; $i++) {
        $blocks[$i]['info'] = variable_get('superfish_name_' . $i, 'Superfish ' . $i) . ' (Superfish)';
        $blocks[$i]['cache'] = BLOCK_NO_CACHE;
      }
      return $blocks;
      break;
    case 'configure':
      $menu_default = array();

      // Integration with the Domain Access module.
      if (module_exists('domain_conf')) {
        $primary = variable_get('menu_primary_links_source', FALSE);
        $secondary = variable_get('menu_secondary_links_source', FALSE);
        if ($primary) {
          $menu_default['domainaccessmenu1st-' . $primary . ':0'] = t('Domains Access') . ': ' . t('Primary links');
        }
        if ($secondary) {
          $menu_default['domainaccessmenu2nd-' . $secondary . ':0'] = t('Domains Access') . ': ' . t('Secondary links');
        }
      }
      $menu_default += menu_parent_options(menu_get_menus(), 0);
      $form['superfish_name_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Block description'),
        '#description' => t('A brief description of your block. Used on the <a href="@overview">block overview page</a>.', array(
          '@overview' => url('admin/build/block'),
        )),
        '#default_value' => variable_get('superfish_name_' . $delta, 'Superfish ' . $delta),
      );
      $form['sf-menu'] = array(
        '#type' => 'fieldset',
        '#title' => t('Menu'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-menu']['superfish_menu_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Menu parent'),
        '#description' => t('The menu you want to be displayed using Superfish.') . ' <em>(' . t('Default') . ': &lt;Primary links&gt;)</em>',
        '#default_value' => variable_get('superfish_menu_' . $delta, 'primary-links:0'),
        '#options' => $menu_default,
      );
      $form['sf-menu']['superfish_depth_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Menu depth'),
        '#description' => t('The number of child levels starting with the parent selected above. <strong>-1</strong> means all of them, <strong>0</strong> means none of them.') . ' <em>(' . t('Default') . ': -1)</em>',
        '#default_value' => variable_get('superfish_depth_' . $delta, -1),
        '#options' => drupal_map_assoc(range(-1, 50)),
      );
      $form['sf-menu']['superfish_expanded_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Take "Expanded" option into effect.'),
        '#description' => t('By enabling this option only parent menu items with <em>Expanded</em> option enabled will have their submenus appear.') . ' <em>(' . t('Default') . ': ' . t('disabled') . ')</em>',
        '#default_value' => variable_get('superfish_expanded_' . $delta, 0),
      );
      $form['sf-settings'] = array(
        '#type' => 'fieldset',
        '#title' => t('Superfish settings'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-settings']['superfish_type_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Menu type'),
        '#description' => '<em>(' . t('Default') . ': ' . t('Horizontal') . ')</em>',
        '#default_value' => variable_get('superfish_type_' . $delta, 'horizontal'),
        '#options' => array(
          'horizontal' => t('Horizontal'),
          'vertical' => t('Vertical'),
          'navbar' => t('NavBar'),
        ),
      );
      $form['sf-settings']['superfish_style_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Style'),
        '#description' => '<em>(' . t('Default') . ': ' . t('None') . ')</em>',
        '#default_value' => variable_get('superfish_style_' . $delta, 'none'),
        '#options' => superfish_styles(),
      );
      $form['sf-settings']['superfish_speed_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Animation speed'),
        '#description' => t('The speed of the animation either in <strong>milliseconds</strong> or pre-defined values (<strong>slow, normal, fast</strong>).') . ' <em>(' . t('Default') . ': fast)</em>',
        '#default_value' => variable_get('superfish_speed_' . $delta, 'fast'),
        '#size' => 15,
      );
      $form['sf-settings']['superfish_delay_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Mouse delay'),
        '#description' => t('The delay in <strong>milliseconds</strong> that the mouse can remain outside a sub-menu without it closing.') . ' <em>(' . t('Default') . ': 800)</em>',
        '#default_value' => variable_get('superfish_delay_' . $delta, 800),
        '#size' => 15,
      );
      $form['sf-settings']['superfish_pathclass_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Path class'),
        '#description' => t('The class you have applied to list items that lead to the current page.') . ' <em>(' . t('Default') . ': active-trail)</em><br />' . t('Change this <strong>only</strong> if you are <strong>totally sure</strong> of what you are doing.'),
        '#default_value' => variable_get('superfish_pathclass_' . $delta, 'active-trail'),
        '#size' => 15,
      );
      $form['sf-settings']['superfish_pathlevels_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Path levels'),
        '#description' => t('The amount of sub-menu levels that remain open or are restored using <strong>Path class</strong>.') . ' <em>(' . t('Default') . ': 1)</em>',
        '#default_value' => variable_get('superfish_pathlevels_' . $delta, 1),
        '#options' => drupal_map_assoc(range(0, 10)),
      );
      $form['sf-settings']['superfish_slide_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Slide-in effect'),
        '#description' => '<em>(' . t('Default') . ': ' . t('Vertical') . ')</em>',
        '#default_value' => variable_get('superfish_slide_' . $delta, 'vertical'),
        '#options' => array(
          'none' => t('None'),
          'vertical' => t('Vertical'),
          'horizontal' => t('Horizontal'),
          'diagonal' => t('Diagonal'),
        ),
      );
      $form['sf-settings']['superfish_arrow_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Auto-arrows'),
        '#default_value' => variable_get('superfish_arrow_' . $delta, 1),
      );
      $form['sf-settings']['superfish_shadow_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Drop shadows'),
        '#default_value' => variable_get('superfish_shadow_' . $delta, 1),
      );
      $form['sf-settings']['sf-more'] = array(
        '#type' => 'fieldset',
        '#title' => t('More options'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-settings']['sf-more']['superfish_use_item_theme_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Use a theme function for menu items.') . ' <em>(' . t('Default') . ': ' . t('enabled') . ')</em><br /><small>' . t('(Disabling this feature can result in performance improvements, depending on the number of items in the menu.)') . '</small>',
        '#default_value' => variable_get('superfish_use_item_theme_' . $delta, 1),
      );
      $form['sf-settings']['sf-more']['superfish_clone_parent_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Add cloned parent links to the top of sub-menus.') . ' <em>(' . t('Default') . ': ' . t('disabled') . ')</em>',
        '#default_value' => variable_get('superfish_clone_parent_' . $delta, 0),
      );
      $form['sf-plugins'] = array(
        '#type' => 'fieldset',
        '#title' => t('Superfish plugins'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-plugins']['superfish_bgf_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Use jQuery BgiFrame plugin for this menu.'),
        '#description' => t('Helps ease the pain when having to deal with IE z-index issues.') . ' <em>(' . t('Default') . ': ' . t('disabled') . ')</em>',
        '#default_value' => variable_get('superfish_bgf_' . $delta, 0),
      );
      $form['sf-plugins']['superfish_spp_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Use jQuery Supposition plugin for this menu.') . ' <sup>(' . t('Beta') . ')</sup>',
        '#description' => t('Relocates sub-menus when they would otherwise appear outside the browser window area.') . ' <em>(' . t('Default') . ': ' . t('enabled') . ')</em>',
        '#default_value' => variable_get('superfish_spp_' . $delta, 1),
      );
      $form['sf-plugins']['superfish_hid_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable hoverIntent detection.'),
        '#description' => t('Prevents accidental firing of animations by waiting until the user\'s mouse slows down enough, hence determinig user\'s <em>intent</em>.') . ' <em>(' . t('Default') . ': ' . t('enabled') . ')</em>',
        '#default_value' => variable_get('superfish_hid_' . $delta, 1),
      );
      $form['sf-plugins']['superfish_amw_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Use sf-AutomaticWidth plugin for this menu.'),
        '#description' => t('Automatically adjusts the menu width to maximum possible.') . ' <em>(' . t('Default') . ': ' . t('disabled') . ')</em><br />' . t('This is limited to Horizontal and NavBar types.'),
        '#default_value' => variable_get('superfish_amw_' . $delta, 0),
      );
      $form['sf-plugins']['sf-touchscreen'] = array(
        '#type' => 'fieldset',
        '#title' => t('sf-Touchscreen') . ' <sup>(' . t('Beta') . ')</sup>',
        '#description' => t('<strong>sf-Touchscreen</strong> provides touchscreen compatibility for your menus.') . ' <sup>(' . t('The first click on a parent hyperlink shows its children and the second click opens the hyperlink.') . ')</sup>',
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-plugins']['sf-touchscreen']['superfish_touch_' . $delta] = array(
        '#type' => 'radios',
        '#default_value' => variable_get('superfish_touch_' . $delta, 0),
        '#options' => array(
          0 => t('Disable') . '. <sup>(' . t('Default') . ')</sup>',
          1 => t('Enable jQuery sf-Touchscreen plugin for this menu.'),
          2 => t('Enable jQuery sf-Touchscreen plugin for this menu depending on the user\'s Web browser <strong>window width</strong>.'),
          3 => t('Enable jQuery sf-Touchscreen plugin for this menu depending on the user\'s Web browser <strong>user agent</strong>.'),
        ),
      );
      $form['sf-plugins']['sf-touchscreen']['superfish_touchbh_' . $delta] = array(
        '#type' => 'radios',
        '#title' => t('Select a behaviour'),
        '#description' => t('Using this plugin, the first click or tap will expand the sub-menu, below you can choose what a second click or tap should do.'),
        '#default_value' => variable_get('superfish_touchbh_' . $delta, 2),
        '#options' => array(
          0 => t('Opening the parent menu item link on the second tap.'),
          1 => t('Hiding the sub-menu on the second tap.'),
          2 => t('Hiding the sub-menu on the second tap, adding cloned parent links to the top of sub-menus as well.') . '. <sup>(' . t('Default') . ')</sup>',
        ),
      );
      $form['sf-plugins']['sf-touchscreen']['superfish_touchdh_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Also disable the <em>hover</em> event for all its sub-menus.'),
        '#default_value' => variable_get('superfish_touchdh_' . $delta, 0),
      );
      $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-windowwidth'] = array(
        '#type' => 'fieldset',
        '#title' => t('Window width settings'),
        '#description' => t('sf-Touchscreen will be enabled only if the width of user\'s Web browser window is smaller than the below value.') . '<br /><br />' . t('Please note that in most cases such a meta tag is necessary for this feature to work properly:') . '<br /><code>&lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;</code>',
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-windowwidth']['superfish_touchbp_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Breakpoint'),
        '#description' => '<em>(' . t('Default') . ': 768px)</em>',
        '#default_value' => variable_get('superfish_touchbp_' . $delta, 768),
        '#size' => 10,
        '#prefix' => '<div class="clearfix"></div><div class="sf-breakpoint" style="float:left;">',
        '#suffix' => '</div>',
      );
      $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-windowwidth']['superfish_touchbpu_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Unit'),
        '#default_value' => variable_get('superfish_touchbpu_' . $delta, 'px'),
        '#options' => array(
          'px' => 'px',
          'em' => 'em',
        ),
        '#prefix' => '<div class="sf-breakpoint-unit" style="float:left;">',
        '#suffix' => '</div><div class="clearfix"></div>',
      );
      $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-useragent'] = array(
        '#type' => 'fieldset',
        '#title' => t('User agent settings'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-useragent']['superfish_touchua_' . $delta] = array(
        '#type' => 'radios',
        '#default_value' => variable_get('superfish_touchua_' . $delta, 0),
        '#options' => array(
          0 => t('Use the pre-defined list of the <strong>user agents</strong>.') . ' <sup>(' . t('Default') . ') (' . t('Recommended') . ')</sup>',
          1 => t('Use the custom list of the <strong>user agents</strong>.'),
        ),
      );
      $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-useragent']['superfish_touchual_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Custom list of the user agents'),
        '#description' => t('Could be partial or complete. (Asterisk separated)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Examples') . ':<ul><li>iPhone*Android*iPad <sup>(' . t('Recommended') . ')</sup></li><li>Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.0 * Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405</li></ul>' . (isset($_SERVER['HTTP_USER_AGENT']) ? '<br />' . t('<strong>UA string of the current Web browser:</strong>') . ' ' . $_SERVER['HTTP_USER_AGENT'] : ''),
        '#default_value' => variable_get('superfish_touchual_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 2000,
      );
      $form['sf-plugins']['sf-touchscreen']['sf-touchscreen-useragent']['superfish_touchuam_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('<strong>User agent</strong> detection method'),
        '#description' => '<em>(' . t('Default') . ': ' . t('Client-side (JavaScript)') . ')</em>',
        '#default_value' => variable_get('superfish_touchuam_' . $delta, 0),
        '#options' => array(
          0 => t('Client-side (JavaScript)'),
          1 => t('Server-side (PHP)'),
        ),
      );
      $form['sf-plugins']['sf-smallscreen'] = array(
        '#type' => 'fieldset',
        '#title' => t('sf-Smallscreen') . ' <sup>(' . t('Beta') . ')</sup>',
        '#description' => t('<strong>sf-Smallscreen</strong> provides small-screen compatibility for your menus.') . ' <sup>(' . t('Converts the dropdown into a &lt;select&gt; element.') . ')</sup>',
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-plugins']['sf-smallscreen']['superfish_small_' . $delta] = array(
        '#type' => 'radios',
        '#default_value' => variable_get('superfish_small_' . $delta, 2),
        '#options' => array(
          0 => t('Disable') . '.',
          1 => t('Enable jQuery sf-Smallscreen plugin for this menu.'),
          2 => t('Enable jQuery sf-Smallscreen plugin for this menu depending on the user\'s Web browser <strong>window width</strong>.') . ' <sup>(' . t('Default') . ')</sup>',
          3 => t('Enable jQuery sf-Smallscreen plugin for this menu depending on the user\'s Web browser <strong>user agent</strong>.'),
        ),
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-windowwidth'] = array(
        '#type' => 'fieldset',
        '#title' => t('Window width settings'),
        '#description' => t('sf-Smallscreen will be enabled only if the width of user\'s Web browser window is smaller than the below value.') . '<br /><br />' . t('Please note that in most cases such a meta tag is necessary for this feature to work properly:') . '<br /><code>&lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;</code>',
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-windowwidth']['superfish_smallbp_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Breakpoint'),
        '#description' => '<em>(' . t('Default') . ': 768px)</em>',
        '#default_value' => variable_get('superfish_smallbp_' . $delta, 768),
        '#size' => 10,
        '#prefix' => '<div class="clearfix"></div><div class="sf-breakpoint" style="float:left;">',
        '#suffix' => '</div>',
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-windowwidth']['superfish_smallbpu_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Unit'),
        '#default_value' => variable_get('superfish_smallbpu_' . $delta, 'px'),
        '#options' => array(
          'px' => 'px',
          'em' => 'em',
        ),
        '#prefix' => '<div class="sf-breakpoint-unit" style="float:left;">',
        '#suffix' => '</div><div class="clearfix"></div>',
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-useragent'] = array(
        '#type' => 'fieldset',
        '#title' => t('User agent settings'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-useragent']['superfish_smallua_' . $delta] = array(
        '#type' => 'radios',
        '#default_value' => variable_get('superfish_smallua_' . $delta, 0),
        '#options' => array(
          0 => t('Use the pre-defined list of the <strong>user agents</strong>.') . ' <sup>(' . t('Default') . ') (' . t('Recommended') . ')</sup>',
          1 => t('Use the custom list of the <strong>user agents</strong>.'),
        ),
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-useragent']['superfish_smallual_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Custom list of the user agents'),
        '#description' => t('Could be partial or complete. (Asterisk separated)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Examples') . ':<ul><li>iPhone*Android*iPad <sup>(' . t('Recommended') . ')</sup></li><li>Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.0 * Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405</li></ul>' . (isset($_SERVER['HTTP_USER_AGENT']) ? '<br />' . t('<strong>UA string of the current Web browser:</strong>') . ' ' . $_SERVER['HTTP_USER_AGENT'] : ''),
        '#default_value' => variable_get('superfish_smallual_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 2000,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-useragent']['superfish_smalluam_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('<strong>User agent</strong> detection method'),
        '#description' => '<em>(' . t('Default') . ': ' . t('Client-side (JavaScript)') . ')</em>',
        '#default_value' => variable_get('superfish_smalluam_' . $delta, 0),
        '#options' => array(
          0 => t('Client-side (JavaScript)'),
          1 => t('Server-side (PHP)'),
        ),
      );
      $form['sf-plugins']['sf-smallscreen']['superfish_smallact_' . $delta] = array(
        '#type' => 'radios',
        '#title' => t('Select a type'),
        '#default_value' => variable_get('superfish_smallact_' . $delta, 1),
        '#options' => array(
          0 => t('Convert the menu to a &lt;select&gt; element.'),
          1 => t('Convert the menu to an accordion menu.') . ' <sup>(' . t('Default') . ')</sup>',
        ),
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select'] = array(
        '#type' => 'fieldset',
        '#title' => t('&lt;select&gt; settings'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['superfish_smallset_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('&lt;select&gt; title'),
        '#description' => t('By default the first item in the &lt;select&gt; element will be the name of the parent menu or the title of this block, you can change this by setting a custom title.') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Example') . ': <em> - ' . t('Main Menu') . ' - </em>.',
        '#default_value' => variable_get('superfish_smallset_' . $delta, ''),
        '#size' => 50,
        '#maxlength' => 500,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['superfish_smallasa_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Add <em>selected</em> attribute to the &lt;option&gt; element with the class <strong>active</strong> .'),
        '#description' => t('Makes pre-selected the item linked to the active page when the page loads.'),
        '#default_value' => variable_get('superfish_smallasa_' . $delta, 0),
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more'] = array(
        '#type' => 'fieldset',
        '#title' => t('More'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallcmc_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Copy the main &lt;ul&gt; classes to the &lt;select&gt;.') . ' <sup><em>(' . t('Default') . ': ' . t('disabled') . ')</em></sup>',
        '#default_value' => variable_get('superfish_smallcmc_' . $delta, 0),
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallecm_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Exclude these classes from the &lt;select&gt; element'),
        '#description' => t('Comma separated') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em>',
        '#default_value' => variable_get('superfish_smallecm_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
        '#states' => array(
          'enabled' => array(
            ':input[name="superfish_smallcmc_' . $delta . '"]' => array(
              'checked' => TRUE,
            ),
          ),
        ),
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallchc_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Copy the hyperlink classes to the &lt;option&gt; elements of the &lt;select&gt;.') . ' <sup><em>(' . t('Default') . ': ' . t('disabled') . ')</em></sup>',
        '#default_value' => variable_get('superfish_smallchc_' . $delta, 0),
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallech_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Exclude these classes from the &lt;option&gt; elements of the &lt;select&gt;'),
        '#description' => t('Comma separated') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em>',
        '#default_value' => variable_get('superfish_smallech_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
        '#states' => array(
          'enabled' => array(
            ':input[name="superfish_smallchc_' . $delta . '"]' => array(
              'checked' => TRUE,
            ),
          ),
        ),
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallicm_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Include these classes in the &lt;select&gt; element'),
        '#description' => t('Comma separated') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em>',
        '#default_value' => variable_get('superfish_smallicm_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-select']['sf-smallscreen-select-more']['superfish_smallich_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Include these classes in the &lt;option&gt; elements of the &lt;select&gt;'),
        '#description' => t('Comma separated') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em>',
        '#default_value' => variable_get('superfish_smallich_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-accordion'] = array(
        '#type' => 'fieldset',
        '#title' => t('Accordion settings'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-accordion']['superfish_smallamt_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Accordion menu title'),
        '#description' => 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.') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Example') . ': <em>' . t('Menu') . '</em>.',
        '#default_value' => variable_get('superfish_smallamt_' . $delta, ''),
        '#size' => 50,
        '#maxlength' => 500,
      );
      $form['sf-plugins']['sf-smallscreen']['sf-smallscreen-accordion']['superfish_smallabt_' . $delta] = array(
        '#type' => 'radios',
        '#title' => t('Accordion button type'),
        '#default_value' => variable_get('superfish_smallabt_' . $delta, 1),
        '#options' => array(
          0 => t('Use parent menu items as buttons.'),
          1 => t('Use parent menu items as buttons, add cloned parent links to sub-menus as well.') . ' <sup>(' . t('Default') . ')</sup>',
          2 => t('Create new links next to parent menu item links and use them as buttons.'),
        ),
      );
      $form['sf-plugins']['sf-supersubs'] = array(
        '#type' => 'fieldset',
        '#title' => t('Supersubs'),
        '#description' => t('<strong>Supersubs</strong> makes it possible to define custom widths for your menus.'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-plugins']['sf-supersubs']['superfish_supersubs_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable Supersubs for this menu.'),
        '#default_value' => variable_get('superfish_supersubs_' . $delta, 1),
      );
      $form['sf-plugins']['sf-supersubs']['superfish_supersubs_emm_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Do not use Supersubs for multi-column sub-menus.'),
        '#default_value' => variable_get('superfish_supersubs_emm_' . $delta, 0),
      );
      $form['sf-plugins']['sf-supersubs']['superfish_minwidth_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Minimum width'),
        '#description' => t('Minimum width for sub-menus, in <strong>em</strong> units.') . ' <em>(' . t('Default') . ': 12)</em>',
        '#default_value' => variable_get('superfish_minwidth_' . $delta, 12),
        '#size' => 10,
      );
      $form['sf-plugins']['sf-supersubs']['superfish_maxwidth_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Maximum width'),
        '#description' => t('Maximum width for sub-menus, in <strong>em</strong> units.') . ' <em>(' . t('Default') . ': 27)</em>',
        '#default_value' => variable_get('superfish_maxwidth_' . $delta, 27),
        '#size' => 10,
      );
      $form['sf-megamenu'] = array(
        '#type' => 'fieldset',
        '#title' => t('Multi-column sub-menus') . ' <sup>(' . t('Beta') . ')</sup>',
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-megamenu']['superfish_multicolumn_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable multi-column sub-menus.'),
        '#default_value' => variable_get('superfish_multicolumn_' . $delta, 0),
      );
      $form['sf-megamenu']['superfish_mcexclude_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Exclude below menu items'),
        '#description' => t('Enter the ID number of the parent menu item you <strong>do not</strong> want multi-column sub-menus for. (Comma separated)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Example') . ': 5,10,20',
        '#default_value' => variable_get('superfish_mcexclude_' . $delta, ''),
        '#size' => 50,
      );
      $form['sf-megamenu']['superfish_mcdepth_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Start from depth'),
        '#description' => t('The depth of the first instance of multi-column sub-menus.') . ' <em>(' . t('Default') . ': 1)</em>',
        '#default_value' => variable_get('superfish_mcdepth_' . $delta, 1),
        '#options' => drupal_map_assoc(range(1, 10)),
      );
      $form['sf-megamenu']['superfish_mclevels_' . $delta] = array(
        '#type' => 'select',
        '#title' => t('Levels'),
        '#description' => t('The amount of sub-menu levels that will be included in the multi-column sub-menu.') . ' <em>(' . t('Default') . ': 1)</em>',
        '#default_value' => variable_get('superfish_mclevels_' . $delta, 1),
        '#options' => drupal_map_assoc(range(1, 10)),
      );
      $form['sf-advanced-html'] = array(
        '#type' => 'fieldset',
        '#title' => t('Advanced HTML settings'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-advanced-html']['sf-hyperlinks'] = array(
        '#type' => 'fieldset',
        '#title' => t('Hyperlinks'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-advanced-html']['sf-hyperlinks']['superfish_hhldescription_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Hide hyperlink descriptions ("title" attribute)') . ' <em>(' . t('Default') . ': ' . t('disabled') . ')</em>',
        '#description' => t('(Enabling this feature makes the below settings ineffective.)'),
        '#default_value' => variable_get('superfish_hhldescription_' . $delta, 0),
      );
      $form['sf-advanced-html']['sf-hyperlinks']['sf-hyperlinktexts'] = array(
        '#type' => 'fieldset',
        '#title' => t('Hyperlink texts'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-advanced-html']['sf-hyperlinks']['sf-hyperlinktexts']['superfish_hldescription_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Insert hyperlink descriptions ("title" attribute) into hyperlink texts.'),
        '#default_value' => variable_get('superfish_hldescription_' . $delta, 0),
      );
      $form['sf-advanced-html']['sf-hyperlinks']['sf-hyperlinktexts']['superfish_hldmenus_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Limit to below menu items'),
        '#description' => t('Enter menu item ID\'s. Leave empty to include all menus. (Comma separated)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Example') . ': 5,10,20',
        '#default_value' => variable_get('superfish_hldmenus_' . $delta, ''),
        '#size' => 50,
      );
      $form['sf-advanced-html']['sf-hyperlinks']['sf-hyperlinktexts']['superfish_hldexclude_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Exclude below menu items'),
        '#description' => t('Enter the ID of the menu items you <strong>do not</strong> want to link descriptions for. (Comma separated)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Example') . ': 5,10,20',
        '#default_value' => variable_get('superfish_hldexclude_' . $delta, ''),
        '#size' => 50,
      );
      $form['sf-advanced-html']['sf-html-wrappers'] = array(
        '#type' => 'fieldset',
        '#title' => t('HTML wrappers'),
        '#description' => t('Please consider using CSS pseudo-elements :before &amp; :after before using the features below as improper use of them may break your drop down menu.'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-advanced-html']['sf-html-wrappers']['superfish_wrapmul_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Around the main &lt;UL&gt;'),
        '#description' => t('Insert extra codes <strong>before</strong> and\\or <strong>after</strong> the main UL. (Comma separated).') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Examples') . ': <ul><li>&lt;h3&gt;Discover the universe!&lt;/h3&gt;,</li><li>&lt;h3&gt;Hello there!&lt;/h3&gt;,&lt;div style="clear:both"&gt;&lt;/div&gt;</li><li>,&lt;div style="clear:both"&gt;&lt;/div&gt;</li></ul>',
        '#default_value' => variable_get('superfish_wrapmul_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
      );
      $form['sf-advanced-html']['sf-html-wrappers']['superfish_wrapul_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Around the &lt;LI&gt; content'),
        '#description' => t('Insert extra codes <strong>before</strong> and\\or <strong>after</strong> the ULs. (Comma separated).') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Examples') . ': <ul><li>&lt;h3&gt;Discover the universe!&lt;/h3&gt;,</li><li>&lt;h3&gt;Hello there!&lt;/h3&gt;,&lt;div style="clear:both"&gt;&lt;/div&gt;</li><li>,&lt;div style="clear:both"&gt;&lt;/div&gt;</li></ul>',
        '#default_value' => variable_get('superfish_wrapul_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
      );
      $form['sf-advanced-html']['sf-html-wrappers']['superfish_wraphl_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Around the hyperlinks'),
        '#description' => t('Insert HTML objects <strong>before</strong> and\\or <strong>after</strong> hyperlinks. (Comma separated)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Examples') . ': <ul><li>&lt;span class="background-left"&gt;&lt;span class="background-right"&gt;,&lt;/span&gt;&lt;/span&gt;</li><li>&lt;img src="example.jpg" width="24" height="24" alt="example" title="example" /&gt;,</li><li>,&lt;span class="custom-arrow"&gt;>&lt;/span&gt;</li></ul>',
        '#default_value' => variable_get('superfish_wraphl_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
      );
      $form['sf-advanced-html']['sf-html-wrappers']['superfish_wraphlt_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Around the hyperlinks content'),
        '#description' => t('Insert extra codes <strong>before</strong> and\\or <strong>after</strong> the text in hyperlinks. (Comma separated)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Examples') . ': <ul><li>&lt;span class="background-left"&gt;&lt;span class="background-right"&gt;,&lt;/span&gt;&lt;/span&gt;</li><li>&lt;img src="example.jpg" width="24" height="24" alt="example" title="example" /&gt;,</li><li>,&lt;span class="custom-arrow"&gt;>&lt;/span&gt;</li></ul>',
        '#default_value' => variable_get('superfish_wraphlt_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
      );
      $form['sf-advanced-css'] = array(
        '#type' => 'fieldset',
        '#title' => t('Advanced CSS settings'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['sf-advanced-css']['sf-helper-classes'] = array(
        '#type' => 'fieldset',
        '#title' => t('Helper classes'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-advanced-css']['sf-helper-classes']['superfish_firstlast_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Add <strong>first \\ middle \\ last</strong> classes.'),
        '#default_value' => variable_get('superfish_firstlast_' . $delta, 1),
      );
      $form['sf-advanced-css']['sf-helper-classes']['superfish_zebra_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Add <strong>odd \\ even</strong> classes.'),
        '#default_value' => variable_get('superfish_zebra_' . $delta, 1),
      );
      $form['sf-advanced-css']['sf-helper-classes']['superfish_dfirstlast_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Do <strong>not</strong> add <strong>first \\ middle \\ last</strong> classes to single menu items.'),
        '#default_value' => variable_get('superfish_dfirstlast_' . $delta, 0),
      );
      $form['sf-advanced-css']['sf-helper-classes']['superfish_dzebra_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Do <strong>not</strong> add <strong>odd \\ even</strong> classes to single menu items.'),
        '#default_value' => variable_get('superfish_dzebra_' . $delta, 0),
      );
      $form['sf-advanced-css']['sf-helper-classes']['superfish_itemcount_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Add <strong>item count</strong> class to menu items.') . '<em>(sf-item-1, sf-item-2, sf-item-3, ...)</em>',
        '#default_value' => variable_get('superfish_itemcount_' . $delta, 1),
      );
      $form['sf-advanced-css']['sf-helper-classes']['superfish_itemcounter_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Add <strong>children counter</strong> classes to menu items.') . '<em>(sf-total-children-7 sf-parent-children-4 sf-single-children-3, ...)</em>',
        '#default_value' => variable_get('superfish_itemcounter_' . $delta, 1),
      );
      $form['sf-advanced-css']['sf-helper-classes']['superfish_itemdepth_' . $delta] = array(
        '#type' => 'checkbox',
        '#title' => t('Add <strong>item depth</strong> class to menu items and their hyperlinks.') . '<em>(sf-depth-1, sf-depth-2, sf-depth-3, ...)</em>',
        '#default_value' => variable_get('superfish_itemdepth_' . $delta, 1),
      );
      $form['sf-advanced-css']['sf-custom-classes'] = array(
        '#type' => 'fieldset',
        '#title' => t('Custom classes'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-advanced-css']['sf-custom-classes']['superfish_ulclass_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('For the main UL'),
        '#description' => t('(Space separated, without dots)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Example') . ': top-menu category-science',
        '#default_value' => variable_get('superfish_ulclass_' . $delta, ''),
        '#size' => 50,
        '#maxlength' => 1000,
      );
      $form['sf-advanced-css']['sf-custom-classes']['superfish_liclass_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('For the list items'),
        '#description' => t('(Space separated, without dots)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Example') . ': science-sub',
        '#default_value' => variable_get('superfish_liclass_' . $delta, ''),
        '#size' => 50,
        '#maxlength' => 1000,
      );
      $form['sf-advanced-css']['sf-custom-classes']['superfish_hlclass_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('For the hyperlinks'),
        '#description' => t('(Space separated, without dots)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Example') . ': science-link',
        '#default_value' => variable_get('superfish_hlclass_' . $delta, ''),
        '#size' => 50,
        '#maxlength' => 1000,
      );
      $form['sf-advanced-css']['sf-extra-css'] = array(
        '#type' => 'fieldset',
        '#title' => t('Extra CSS'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['sf-advanced-css']['sf-extra-css']['superfish_pathcss_' . $delta] = array(
        '#type' => 'textfield',
        '#title' => t('Path to CSS file(s)'),
        '#description' => t('Include extra CSS file(s). (Comma separated)') . ' <em>(' . t('Default') . ': ' . t('empty') . ')</em><br />' . t('Examples') . ': <ul><li>sites/all/files/example.css</li><li>sites/all/files/example.css,sites/all/files/example2.css</li></ul>',
        '#default_value' => variable_get('superfish_pathcss_' . $delta, ''),
        '#size' => 100,
        '#maxlength' => 1000,
      );
      return $form;
      break;
    case 'save':
      variable_set('superfish_name_' . $delta, $edit['superfish_name_' . $delta]);
      variable_set('superfish_menu_' . $delta, $edit['superfish_menu_' . $delta]);
      variable_set('superfish_depth_' . $delta, $edit['superfish_depth_' . $delta]);
      variable_set('superfish_type_' . $delta, $edit['superfish_type_' . $delta]);
      variable_set('superfish_style_' . $delta, $edit['superfish_style_' . $delta]);
      variable_set('superfish_speed_' . $delta, $edit['superfish_speed_' . $delta]);
      variable_set('superfish_delay_' . $delta, $edit['superfish_delay_' . $delta]);
      variable_set('superfish_pathclass_' . $delta, $edit['superfish_pathclass_' . $delta]);
      variable_set('superfish_pathlevels_' . $delta, $edit['superfish_pathlevels_' . $delta]);
      variable_set('superfish_slide_' . $delta, $edit['superfish_slide_' . $delta]);
      variable_set('superfish_shadow_' . $delta, $edit['superfish_shadow_' . $delta]);
      variable_set('superfish_arrow_' . $delta, $edit['superfish_arrow_' . $delta]);
      variable_set('superfish_expanded_' . $delta, $edit['superfish_expanded_' . $delta]);
      variable_set('superfish_bgf_' . $delta, $edit['superfish_bgf_' . $delta]);
      variable_set('superfish_spp_' . $delta, $edit['superfish_spp_' . $delta]);
      variable_set('superfish_hid_' . $delta, $edit['superfish_hid_' . $delta]);
      variable_set('superfish_amw_' . $delta, $edit['superfish_amw_' . $delta]);
      variable_set('superfish_touch_' . $delta, $edit['superfish_touch_' . $delta]);
      variable_set('superfish_touchbh_' . $delta, $edit['superfish_touchbh_' . $delta]);
      variable_set('superfish_touchdh_' . $delta, $edit['superfish_touchdh_' . $delta]);
      variable_set('superfish_touchbp_' . $delta, $edit['superfish_touchbp_' . $delta]);
      variable_set('superfish_touchbpu_' . $delta, $edit['superfish_touchbpu_' . $delta]);
      variable_set('superfish_touchua_' . $delta, $edit['superfish_touchua_' . $delta]);
      variable_set('superfish_touchual_' . $delta, $edit['superfish_touchual_' . $delta]);
      variable_set('superfish_touchuam_' . $delta, $edit['superfish_touchuam_' . $delta]);
      variable_set('superfish_small_' . $delta, $edit['superfish_small_' . $delta]);
      variable_set('superfish_smallact_' . $delta, $edit['superfish_smallact_' . $delta]);
      variable_set('superfish_smallbp_' . $delta, $edit['superfish_smallbp_' . $delta]);
      variable_set('superfish_smallbpu_' . $delta, $edit['superfish_smallbpu_' . $delta]);
      variable_set('superfish_smallua_' . $delta, $edit['superfish_smallua_' . $delta]);
      variable_set('superfish_smallual_' . $delta, $edit['superfish_smallual_' . $delta]);
      variable_set('superfish_smalluam_' . $delta, $edit['superfish_smalluam_' . $delta]);
      variable_set('superfish_smallset_' . $delta, $edit['superfish_smallset_' . $delta]);
      variable_set('superfish_smallasa_' . $delta, $edit['superfish_smallasa_' . $delta]);
      variable_set('superfish_smallcmc_' . $delta, $edit['superfish_smallcmc_' . $delta]);
      variable_set('superfish_smallecm_' . $delta, $edit['superfish_smallecm_' . $delta]);
      variable_set('superfish_smallchc_' . $delta, $edit['superfish_smallchc_' . $delta]);
      variable_set('superfish_smallech_' . $delta, $edit['superfish_smallech_' . $delta]);
      variable_set('superfish_smallicm_' . $delta, $edit['superfish_smallicm_' . $delta]);
      variable_set('superfish_smallich_' . $delta, $edit['superfish_smallich_' . $delta]);
      variable_set('superfish_smallamt_' . $delta, $edit['superfish_smallamt_' . $delta]);
      variable_set('superfish_smallabt_' . $delta, $edit['superfish_smallabt_' . $delta]);
      variable_set('superfish_supersubs_' . $delta, $edit['superfish_supersubs_' . $delta]);
      variable_set('superfish_supersubs_emm_' . $delta, $edit['superfish_supersubs_emm_' . $delta]);
      variable_set('superfish_minwidth_' . $delta, $edit['superfish_minwidth_' . $delta]);
      variable_set('superfish_maxwidth_' . $delta, $edit['superfish_maxwidth_' . $delta]);
      variable_set('superfish_multicolumn_' . $delta, $edit['superfish_multicolumn_' . $delta]);
      variable_set('superfish_mcexclude_' . $delta, $edit['superfish_mcexclude_' . $delta]);
      variable_set('superfish_mcdepth_' . $delta, $edit['superfish_mcdepth_' . $delta]);
      variable_set('superfish_mclevels_' . $delta, $edit['superfish_mclevels_' . $delta]);
      variable_set('superfish_firstlast_' . $delta, $edit['superfish_firstlast_' . $delta]);
      variable_set('superfish_zebra_' . $delta, $edit['superfish_zebra_' . $delta]);
      variable_set('superfish_dfirstlast_' . $delta, $edit['superfish_dfirstlast_' . $delta]);
      variable_set('superfish_dzebra_' . $delta, $edit['superfish_dzebra_' . $delta]);
      variable_set('superfish_itemcount_' . $delta, $edit['superfish_itemcount_' . $delta]);
      variable_set('superfish_itemcounter_' . $delta, $edit['superfish_itemcounter_' . $delta]);
      variable_set('superfish_itemdepth_' . $delta, $edit['superfish_itemdepth_' . $delta]);
      variable_set('superfish_use_item_theme_' . $delta, $edit['superfish_use_item_theme_' . $delta]);
      variable_set('superfish_clone_parent_' . $delta, $edit['superfish_clone_parent_' . $delta]);
      variable_set('superfish_hhldescription_' . $delta, $edit['superfish_hhldescription_' . $delta]);
      variable_set('superfish_hldescription_' . $delta, $edit['superfish_hldescription_' . $delta]);
      variable_set('superfish_hldmenus_' . $delta, $edit['superfish_hldmenus_' . $delta]);
      variable_set('superfish_hldexclude_' . $delta, $edit['superfish_hldexclude_' . $delta]);
      variable_set('superfish_wrapmul_' . $delta, $edit['superfish_wrapmul_' . $delta]);
      variable_set('superfish_wrapul_' . $delta, $edit['superfish_wrapul_' . $delta]);
      variable_set('superfish_wraphl_' . $delta, $edit['superfish_wraphl_' . $delta]);
      variable_set('superfish_wraphlt_' . $delta, $edit['superfish_wraphlt_' . $delta]);
      variable_set('superfish_ulclass_' . $delta, $edit['superfish_ulclass_' . $delta]);
      variable_set('superfish_liclass_' . $delta, $edit['superfish_liclass_' . $delta]);
      variable_set('superfish_hlclass_' . $delta, $edit['superfish_hlclass_' . $delta]);
      variable_set('superfish_pathcss_' . $delta, $edit['superfish_pathcss_' . $delta]);
      break;
    case 'view':
      $sfsettings = $sfoptions = $sfplugins = array();
      $sfsettings['depth'] = variable_get('superfish_depth_' . $delta, '-1');
      $sfsettings['type'] = variable_get('superfish_type_' . $delta, 'horizontal');
      $sfsettings['style'] = variable_get('superfish_style_' . $delta, 'default');
      $sfsettings['expanded'] = variable_get('superfish_expanded_' . $delta, 0);
      $sfsettings['firstlast'] = variable_get('superfish_firstlast_' . $delta, 1);
      $sfsettings['zebra'] = variable_get('superfish_zebra_' . $delta, 1);
      $sfsettings['dfirstlast'] = variable_get('superfish_dfirstlast_' . $delta, 0);
      $sfsettings['dzebra'] = variable_get('superfish_dzebra_' . $delta, 0);
      $sfsettings['itemcount'] = variable_get('superfish_itemcount_' . $delta, 1);
      $sfsettings['itemcounter'] = variable_get('superfish_itemcounter_' . $delta, 1);
      $sfsettings['itemdepth'] = variable_get('superfish_itemdepth' . $delta, 1);
      $sfsettings['ulclass'] = variable_get('superfish_ulclass_' . $delta, '');
      $sfsettings['liclass'] = variable_get('superfish_liclass_' . $delta, '');
      $sfsettings['hlclass'] = variable_get('superfish_hlclass_' . $delta, '');
      $sfsettings['wrapmul'] = variable_get('superfish_wrapmul_' . $delta, '');
      $sfsettings['wrapul'] = variable_get('superfish_wrapul_' . $delta, '');
      $sfsettings['wraphl'] = variable_get('superfish_wraphl_' . $delta, '');
      $sfsettings['wraphlt'] = variable_get('superfish_wraphlt_' . $delta, '');
      $sfsettings['use_item_theme'] = variable_get('superfish_use_item_theme_' . $delta, 1);
      $sfsettings['clone_parent'] = variable_get('superfish_clone_parent_' . $delta, 0);
      $sfsettings['hidelinkdescription'] = variable_get('superfish_hhldescription_' . $delta, 0);
      $sfsettings['linkdescription'] = variable_get('superfish_hldescription_' . $delta, 0);
      $sfsettings['hldmenus'] = variable_get('superfish_hldmenus_' . $delta, '');
      $sfsettings['hldmenus'] = strpos($sfsettings['hldmenus'], ',') ? superfish_array_filter(explode(',', $sfsettings['hldmenus'])) : $sfsettings['hldmenus'];
      $sfsettings['hldexclude'] = variable_get('superfish_hldexclude_' . $delta, '');
      $sfsettings['hldexclude'] = strpos($sfsettings['hldexclude'], ',') ? superfish_array_filter(explode(',', $sfsettings['hldexclude'])) : $sfsettings['hldexclude'];
      $sfsettings['megamenu'] = variable_get('superfish_multicolumn_' . $delta, 0);
      $sfsettings['megamenu_depth'] = variable_get('superfish_mcdepth_' . $delta, 1);
      $sfsettings['megamenu_depth'] = $sfsettings['type'] == 'navbar' && $sfsettings['megamenu_depth'] == 1 ? 2 : $sfsettings['megamenu_depth'];
      $sfsettings['megamenu_levels'] = variable_get('superfish_mclevels_' . $delta, 1) + $sfsettings['megamenu_depth'];
      $sfsettings['megamenu_exclude'] = variable_get('superfish_mcexclude_' . $delta, '');
      $sfsettings['megamenu_exclude'] = strpos($sfsettings['megamenu_exclude'], ',') ? superfish_array_filter(explode(',', $sfsettings['megamenu_exclude'])) : $sfsettings['megamenu_exclude'];
      $sfoptions['pathClass'] = $sfsettings['type'] == 'navbar' ? variable_get('superfish_pathclass_' . $delta, 'active-trail') : '';
      $sfoptions['pathLevels'] = variable_get('superfish_pathlevels_' . $delta, 1) != 1 ? variable_get('superfish_pathlevels_' . $delta, 1) : '';
      $sfoptions['delay'] = variable_get('superfish_delay_' . $delta, 800) != 800 ? variable_get('superfish_delay_' . $delta, 800) : '';
      $slide = variable_get('superfish_slide_' . $delta, 'vertical');
      if ($slide == 'none') {
        $sfoptions['animation'] = array(
          'opacity' => 'show',
        );
      }
      else {
        $sfoptions['animation'] = array(
          'opacity' => 'show',
        );
        if ($slide == 'vertical' || $slide == 'diagonal') {
          $sfoptions['animation']['height'] = 'show';
        }
        if ($slide == 'horizontal' || $slide == 'diagonal') {
          $sfoptions['animation']['width'] = 'show';
        }
      }
      $speed = variable_get('superfish_speed_' . $delta, 'fast');
      if ($speed != 'normal') {
        $sfoptions['speed'] = is_numeric($speed) ? (int) $speed : ($speed == ('slow' || 'normal' || 'fast') ? $speed : '');
      }
      $sfoptions['autoArrows'] = variable_get('superfish_arrow_' . $delta, 1) == 0 ? FALSE : '';
      $sfoptions['dropShadows'] = variable_get('superfish_shadow_' . $delta, 1) == 0 ? FALSE : '';
      $sfoptions['disableHI'] = variable_get('superfish_hid_' . $delta, 1) == 1 ? FALSE : '';
      $sfoptions = superfish_array_filter($sfoptions);
      $sfplugins['automaticwidth'] = variable_get('superfish_amw_' . $delta, 0) == 1 ? TRUE : '';
      $touchscreen = variable_get('superfish_touch_' . $delta, 0);
      if ($touchscreen > 0) {
        $behaviour = variable_get('superfish_touchbh_' . $delta, 2);
        $sfplugins['touchscreen']['behaviour'] = $behaviour != 2 ? $behaviour : '';
        if (variable_get('superfish_touchdh_' . $delta, 0)) {
          $sfplugins['touchscreen']['disableHover'] = TRUE;
        }
        switch ($touchscreen) {
          case 1:
            $sfplugins['touchscreen']['mode'] = 'always_active';
            break;
          case 2:
            $sfplugins['touchscreen']['mode'] = 'window_width';
            $tsbp = variable_get('superfish_touchbp_' . $delta, 768);
            $sfplugins['touchscreen']['breakpoint'] = $tsbp != 768 ? (int) $tsbp : '';
            $tsbpu = variable_get('superfish_touchbpu_' . $delta, 'px');
            $sfplugins['touchscreen']['breakpointUnit'] = $tsbpu;
            break;
          case 3:

            // Which method to use for UA detection.
            $tsuam = variable_get('superfish_touchuam_' . $delta, 0);
            $tsua = variable_get('superfish_touchua_' . $delta, 0);
            switch ($tsuam) {

              // Client-side.
              case 0:
                switch ($tsua) {
                  case 0:
                    $sfplugins['touchscreen']['mode'] = 'useragent_predefined';
                    break;
                  case 1:
                    $sfplugins['touchscreen']['mode'] = 'useragent_custom';
                    $tsual = drupal_strtolower(variable_get('superfish_touchual_' . $delta, ''));
                    if (strpos($tsual, '*')) {
                      $tsual = str_replace('*', '|', $tsual);
                    }
                    $sfplugins['touchscreen']['useragent'] = $tsual;
                    break;
                }
                break;

              // Server-side.
              case 1:
                if (isset($_SERVER['HTTP_USER_AGENT'])) {
                  $hua = drupal_strtolower($_SERVER['HTTP_USER_AGENT']);
                  switch ($tsua) {

                    // Use the pre-defined list of mobile UA strings.
                    case 0:
                      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)) {
                        $sfplugins['touchscreen']['mode'] = 'always_active';
                        if ($behaviour == 2) {
                          $sfsettings['clone_parent'] = 1;
                        }
                      }
                      break;

                    // Use the custom list of UA strings.
                    case 1:
                      $tsual = drupal_strtolower(variable_get('superfish_touchual_' . $delta, ''));
                      $tsuac = array();
                      if (strpos($tsual, '*')) {
                        $tsual = explode('*', $tsual);
                        foreach ($tsual as $ua) {
                          $tsuac[] = strpos($hua, $ua) ? 1 : 0;
                        }
                      }
                      else {
                        $tsuac[] = strpos($hua, $tsual) ? 1 : 0;
                      }
                      if (in_array(1, $tsuac)) {
                        $sfplugins['touchscreen']['mode'] = 'always_active';
                        if ($behaviour == 2) {
                          $sfsettings['clone_parent'] = 1;
                        }
                      }
                      break;
                  }
                }
                break;
            }
            break;
        }
      }
      $smallscreen = variable_get('superfish_small_' . $delta, 2);
      if ($smallscreen > 0) {
        switch ($smallscreen) {
          case 1:
            $sfplugins['smallscreen']['mode'] = 'always_active';
            break;
          case 2:
            $sfplugins['smallscreen']['mode'] = 'window_width';
            $ssbp = variable_get('superfish_smallbp_' . $delta, 768);
            $sfplugins['smallscreen']['breakpoint'] = $ssbp != 768 ? (int) $ssbp : '';
            $ssbpu = variable_get('superfish_smallbpu_' . $delta, 'px');
            $sfplugins['smallscreen']['breakpointUnit'] = $ssbpu;
            break;
          case 3:

            // Which method to use for UA detection.
            $ssuam = variable_get('superfish_smalluam_' . $delta, 0);
            $ssua = variable_get('superfish_smallua_' . $delta, 0);
            switch ($ssuam) {

              // Client-side.
              case 0:
                switch ($ssua) {
                  case 0:
                    $sfplugins['smallscreen']['mode'] = 'useragent_predefined';
                    break;
                  case 1:
                    $sfplugins['smallscreen']['mode'] = 'useragent_custom';
                    $ssual = drupal_strtolower(variable_get('superfish_smallual_' . $delta, ''));
                    if (strpos($ssual, '*')) {
                      $ssual = str_replace('*', '|', $ssual);
                    }
                    $sfplugins['smallscreen']['useragent'] = $ssual;
                    break;
                }
                break;

              // Server-side.
              case 1:
                if (isset($_SERVER['HTTP_USER_AGENT'])) {
                  $hua = drupal_strtolower($_SERVER['HTTP_USER_AGENT']);
                  switch ($ssua) {

                    // Use the pre-defined list of mobile UA strings.
                    case 0:
                      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)) {
                        $sfplugins['smallscreen']['mode'] = 'always_active';
                      }
                      break;

                    // Use the custom list of UA strings.
                    case 1:
                      $ssual = drupal_strtolower(variable_get('superfish_smallual_' . $delta, ''));
                      $ssuac = array();
                      if (strpos($ssual, '*')) {
                        $ssual = explode('*', $ssual);
                        foreach ($ssual as $ua) {
                          $ssuac[] = strpos($hua, $ua) ? 1 : 0;
                        }
                      }
                      else {
                        $ssuac[] = strpos($hua, $ssual) ? 1 : 0;
                      }
                      if (in_array(1, $ssuac)) {
                        $sfplugins['smallscreen']['mode'] = 'always_active';
                      }
                      break;
                  }
                }
                break;
            }
            break;
        }
        $type = variable_get('superfish_smallact_' . $delta, 1);
        switch ($type) {
          case 0:
            $asa = variable_get('superfish_smallasa_' . $delta, 0);
            $cmc = variable_get('superfish_smallcmc_' . $delta, 0);
            $chc = variable_get('superfish_smallchc_' . $delta, 0);
            $ecm = variable_get('superfish_smallecm_' . $delta, '');
            $ech = variable_get('superfish_smallech_' . $delta, '');
            $icm = variable_get('superfish_smallicm_' . $delta, '');
            $ich = variable_get('superfish_smallich_' . $delta, '');
            $sfplugins['smallscreen']['type'] = 'select';
            $sfplugins['smallscreen']['addSelected'] = $asa == 1 ? TRUE : '';
            $sfplugins['smallscreen']['menuClasses'] = $cmc == 1 ? TRUE : '';
            $sfplugins['smallscreen']['hyperlinkClasses'] = $chc == 1 ? TRUE : '';
            $sfplugins['smallscreen']['excludeClass_menu'] = $cmc == 1 && !empty($ecm) ? $ecm : '';
            $sfplugins['smallscreen']['excludeClass_hyperlink'] = $chc == 1 && !empty($ech) ? $ech : '';
            $sfplugins['smallscreen']['includeClass_menu'] = !empty($icm) ? $icm : '';
            $sfplugins['smallscreen']['includeClass_hyperlink'] = !empty($ich) ? $ich : '';
            break;
          case 1:
            $ab = variable_get('superfish_smallabt_' . $delta, 1);
            $sfplugins['smallscreen']['accordionButton'] = $ab != 1 ? $ab : '';
            $sfplugins['smallscreen']['expandText'] = t('Expand') != 'Expand' ? t('Expand') : '';
            $sfplugins['smallscreen']['collapseText'] = t('Collapse') != 'Collapse' ? t('Collapse') : '';
            break;
        }
      }
      $sfplugins['supposition'] = variable_get('superfish_spp_' . $delta, 1) == 1 ? TRUE : '';
      $sfplugins['bgiframe'] = variable_get('superfish_bgf_' . $delta, 0) == 1 ? TRUE : '';
      if (variable_get('superfish_supersubs_' . $delta, 1) == 1) {
        $emm = variable_get('superfish_supersubs_emm_' . $delta, 0);
        $minwidth = variable_get('superfish_minwidth_' . $delta, 12);
        $maxwidth = variable_get('superfish_maxwidth_' . $delta, 27);
        $sfplugins['supersubs']['megamenu'] = $emm ? FALSE : '';
        $sfplugins['supersubs']['minWidth'] = $minwidth != 12 ? $minwidth : '';
        $sfplugins['supersubs']['maxWidth'] = $maxwidth != 27 ? $maxwidth : '';
        if (empty($sfplugins['supersubs']['minWidth']) && empty($sfplugins['supersubs']['maxWidth']) && $sfplugins['supersubs']['megamenu'] !== FALSE) {
          $sfplugins['supersubs'] = TRUE;
        }
      }
      $menu_name = variable_get('superfish_menu_' . $delta, 'primary-links:0');

      // Integration with the Domain Access module.
      $primary = variable_get('menu_primary_links_source', FALSE);
      $secondary = variable_get('menu_secondary_links_source', FALSE);
      if ($primary || $secondary) {
        if (strpos($menu_name, 'domainaccessmenu1st') !== FALSE) {
          $menu_name = $primary . ':0';
        }
        elseif (strpos($menu_name, 'domainaccessmenu2nd') !== FALSE) {
          $menu_name = $secondary . ':0';
        }
      }
      $menu_name = str_replace(array(
        'domainaccessmenu1st-',
        'domainaccessmenu2nd-',
      ), '', $menu_name);
      list($menu_name, $mlid) = explode(':', $menu_name);
      if ($output = theme('superfish', $delta, $menu_name, $mlid, $sfsettings)) {
        $block['subject'] = check_plain($output['subject']);
        $block['content'] = filter_xss($output['content'], $allowed_tags = array(
          'a',
          'abbr',
          'acronym',
          'address',
          'area',
          'article',
          'aside',
          'audio',
          'b',
          'base',
          'bdi',
          'bdo',
          'big',
          'blockquote',
          'br',
          'button',
          'canvas',
          'caption',
          'cite',
          'code',
          'col',
          'colgroup',
          'command',
          'datalist',
          'dd',
          'del',
          'details',
          'dfn',
          'div',
          'dl',
          'dt',
          'em',
          'embed',
          'fieldset',
          'figcaption',
          'figure',
          'footer',
          'form',
          'frame',
          'frameset',
          'h1',
          'h2',
          'h3',
          'h4',
          'h5',
          'h6',
          'header',
          'hgroup',
          'hr',
          'i',
          'iframe',
          'img',
          'input',
          'ins',
          'kbd',
          'keygen',
          'label',
          'legend',
          'li',
          'map',
          'mark',
          'meter',
          'nav',
          'noframes',
          'noscript',
          'object',
          'ol',
          'optgroup',
          'option',
          'output',
          'p',
          'param',
          'pre',
          'progress',
          'q',
          'rp',
          'rt',
          'ruby',
          'samp',
          'script',
          'section',
          'select',
          'small',
          'source',
          'span',
          'strong',
          'sub',
          'summary',
          'sup',
          'table',
          'tbody',
          'td',
          'textarea',
          'tfoot',
          'th',
          'thead',
          'time',
          'tr',
          'track',
          'tt',
          'ul',
          'var',
          'video',
          'wbr',
        ));

        // Creating a title for the small-screen menu.
        if ($smallscreen > 0) {
          switch ($type) {
            case 0:
              $title = variable_get('superfish_smallset_' . $delta, '');
              break;
            case 1:
              $title = variable_get('superfish_smallamt_' . $delta, '');
              break;
          }
          $sfplugins['smallscreen']['title'] = empty($title) ? $output['subject'] : $title;
        }
        $sfplugins = superfish_array_filter($sfplugins);

        // Prepare the JavaScript settings.
        $javascript['superfish'][$delta]['id'] = $delta;
        $javascript['superfish'][$delta]['sf'] = isset($sfoptions) ? $sfoptions : array();
        if (!empty($sfplugins)) {
          $javascript['superfish'][$delta]['plugins'] = $sfplugins;
        }

        // Adding required Javascript
        drupal_add_js($javascript, 'setting');

        // Adding required CSS files
        if ($sfsettings['style'] != 'none' && superfish_styles('path', $sfsettings['style']) != '') {
          drupal_add_css(superfish_styles('path', $sfsettings['style']));
        }
        $extracss = variable_get('superfish_pathcss_' . $delta, '');
        if ($extracss) {
          if (strpos($extracss, ',')) {
            $extracss = explode(',', $extracss);
            foreach ($extracss as $c) {
              drupal_add_css($c);
            }
          }
          else {
            drupal_add_css($extracss);
          }
        }
      }
      else {
        $block['content'] = FALSE;
      }
      return $block;
      break;
  }
}