You are here

function better_jump_menu_plugin_style_better_jump_menu::options_form in Better Jump Menu 7

@inheritdoc

Overrides views_plugin_style::options_form

File

views/better_jump_menu_plugin_style_better_jump_menu.inc, line 35
Contains the list style plugin.

Class

better_jump_menu_plugin_style_better_jump_menu
Style plugin to render each item in a select box.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $handlers = $this->display->handler
    ->get_handlers('field');
  if (empty($handlers)) {
    $form['error_markup'] = array(
      '#markup' => t('You need at least one field before you can configure your jump menu settings'),
      '#prefix' => '<div class="error messages">',
      '#suffix' => '</div>',
    );
    return;
  }
  $form['markup'] = array(
    '#markup' => t('To properly configure a jump menu, you must select one field that will represent the path to utilize. You should then set that field to exclude. All other displayed fields will be part of the menu. Please note that all HTML will be stripped from this output as select boxes cannot show HTML.'),
    '#prefix' => '<div class="form-item description">',
    '#suffix' => '</div>',
  );
  foreach ($handlers as $id => $handler) {
    $options[$id] = $handler
      ->ui_name();
  }
  $form['path'] = array(
    '#type' => 'select',
    '#title' => t('Path field'),
    '#options' => $options,
    '#empty_option' => t('- Select a field -'),
    '#default_value' => $this->options['path'],
  );
  $form['depth'] = array(
    '#type' => 'select',
    '#title' => t('Depth field'),
    '#description' => t('Choose here the field that will be used to calculate the depth (or indentation). If you want to display a taxonomy, you might want to use the module !link to have it working properly.', array(
      '!link' => l('Views Term Hierarchy Weight Field', 'https://www.drupal.org/project/views_term_hierarchy_weight_field'),
    )),
    '#options' => $options,
    '#empty_option' => t('- Select a field -'),
    '#default_value' => $this->options['depth'],
  );
  $form['hide'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide the "Go" button'),
    '#default_value' => !empty($this->options['hide']),
    '#description' => t('If hidden, this button will only be hidden for users with javascript and the page will automatically jump when the select is changed.'),
  );
  $form['indent'] = array(
    '#type' => 'textfield',
    '#title' => t('Indentation character'),
    '#default_value' => $this->options['indent'],
    '#description' => t('The indentation character(s) to prepend to options text.'),
  );
  $form['text'] = array(
    '#type' => 'textfield',
    '#title' => t('Button text'),
    '#default_value' => $this->options['text'],
  );
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Selector label'),
    '#default_value' => $this->options['label'],
    '#description' => t('The text that will appear as the the label of the selector element. If blank no label tag will be used.'),
  );
  $form['choose'] = array(
    '#type' => 'textfield',
    '#title' => t('Choose text'),
    '#default_value' => $this->options['choose'],
    '#description' => t('The text that will appear as the selected option in the jump menu.'),
  );
  $form['inline'] = array(
    '#type' => 'checkbox',
    '#title' => t('Set this field to display inline'),
    '#default_value' => !empty($this->options['inline']),
  );
}