function ctools_jump_menu

cis7 jump-menu.inc ctools_jump_menu($form, &$form_state, $select, $options = array())
cle7 jump-menu.inc ctools_jump_menu($form, &$form_state, $select, $options = array())
elmsmedia7 jump-menu.inc ctools_jump_menu($form, &$form_state, $select, $options = array())
icor7 jump-menu.inc ctools_jump_menu($form, &$form_state, $select, $options = array())
meedjum_blog7 jump-menu.inc ctools_jump_menu($form, &$form_state, $select, $options = array())
mooc7 jump-menu.inc ctools_jump_menu($form, &$form_state, $select, $options = array())

Generate a jump menu form.

This can either be used with drupal_get_form() or directly added to a form. The button provides its own submit handler so by default, other submit handlers will not be called.

One note: Do not use #tree = TRUE or it will be unable to find the proper value.

ctools_include('jump-menu');
$output = drupal_get_form('ctools_jump_menu', $targets, $options);

Parameters

$select: An array suitable for use as the #options. The keys will be the direct URLs that will be jumped to, so you absolutely must encode these using url() in order for them to work reliably.

$options: $options may be an array with the following options:

  • 'title': The text to display for the #title attribute.
  • 'description': The text to display for the #description attribute.
  • 'default_value': The text to display for the #default_value attribute.
  • 'hide': If TRUE the go button will be set to hide via javascript and will submit on change.
  • 'button': The text to display on the button.
  • 'image': If set, an image button will be used instead, and the image set to this.
  • 'inline': If set to TRUE (default) the display will be forced inline.
1 call to ctools_jump_menu()
ctools_ajax_sample_jump_menu_form in sites/all/modules/ulmus/ctools/ctools_ajax_sample/ctools_ajax_sample.module
Helper function to provide a sample jump menu form
2 string references to 'ctools_jump_menu'
views_plugin_style_jump_menu::render in sites/all/modules/ulmus/views/plugins/views_plugin_style_jump_menu.inc
Render the display in this style.
views_plugin_style_summary_jump_menu::render in sites/all/modules/ulmus/views/plugins/views_plugin_style_summary_jump_menu.inc
Render the display in this style.

File

sites/all/modules/ulmus/ctools/includes/jump-menu.inc, line 46
Provides a simple "jump menu".

Code

function ctools_jump_menu($form, &$form_state, $select, $options = array()) {
  $options += array(
    'button' => t('Go'),
    'choose' => t('- Choose -'),
    'inline' => TRUE,
    'hide' => TRUE,
  );

  ctools_add_js('jump-menu');

  if (!empty($options['choose'])) {
    $select = array('' => $options['choose']) + $select;
  }

  $form['jump'] = array(
    '#type' => 'select',
    '#options' => $select,
    '#attributes' => array(
      'class' => array('ctools-jump-menu-select'),
    ),
  );

  if (!empty($options['title'])) {
    $form['jump']['#title'] = $options['title'];
  }

  if (!empty($options['description'])) {
    $form['jump']['#description'] = $options['description'];
  }

  if (!empty($options['default_value'])) {
    $form['jump']['#default_value'] = $options['default_value'];
  }

  if (isset($options['image'])) {
    $form['go'] = array(
      '#type' => 'image_button',
      '#src' => $options['image'],
      '#submit' => array('ctools_jump_menu_submit'),
      '#attributes' => array(
        'class' => array('ctools-jump-menu-button'),
      ),
    );
  }
  else {
    $form['go'] = array(
      '#type' => 'submit',
      '#value' => $options['button'],
      '#submit' => array('ctools_jump_menu_submit'),
      '#attributes' => array(
        'class' => array('ctools-jump-menu-button'),
      ),
    );
  }

  if ($options['inline']) {
    $form['jump']['#prefix'] = '<div class="container-inline">';
    $form['go']['#suffix'] = '</div>';
  }

  if ($options['hide']) {
    $form['jump']['#attributes']['class'][] = 'ctools-jump-menu-change';
    $form['go']['#attributes']['class'][] = 'ctools-jump-menu-hide';
  }

  return $form;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.