You are here

function jump_menu_select in Better Jump Menus 7

Same name and namespace in other branches
  1. 8 jump_menu.module \jump_menu_select()

Override select theme function (points select theming to following function).

1 string reference to 'jump_menu_select'
jump_menu_theme_registry_alter in ./jump_menu.module
Alter theme registration to allow overriding select theme function, to allow for extra attributes within options through form API. This is to add depth classes.

File

./jump_menu.module, line 345
Make use of the CTools jump menu and grabs from an existing menu. See: modules/ctools/includes/jump-menu.inc NOTE: Menu items must be checked as "expanded" for traversing to work.

Code

function jump_menu_select($variables) {
  $element = $variables['element'];
  element_set_attributes($element, array(
    'id',
    'name',
    'size',
  ));
  _form_set_class($element, array(
    'form-select',
  ));

  // Provide alternate rendering path for jump menus.
  // To be careful, only altering jump menu selects, http://drupal.org/node/1512550
  $output = '<select' . drupal_attributes($element['#attributes']) . '>';

  // @todo This is a weak thing to test.
  if ($element['#attributes']['class'][0] == 'ctools-jump-menu-select') {
    $output .= jump_menu_form_select_options($element);
  }
  else {
    $output .= form_select_options($element);
  }
  $output .= '</select>';
  return $output;
}