You are here

function itoggle_views_handler_field::options_form in iToggle 7.2

iToggle field options form.

Overrides views_handler_field::options_form

File

modules/views/itoggle_views_handler_field.inc, line 117
Views field handler for iToggle Views.

Class

itoggle_views_handler_field
A handler to provide a custom field for iToggle.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['itoggle'] = array(
    '#type' => 'fieldset',
    '#title' => t('iToggle'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#weight' => -1,
    '#tree' => TRUE,
  );

  // Prefix options with module name to avoid conflicts.
  $clickable = $this->options['itoggle_clickable'];
  $display_type = $this->options['itoggle_display_type'];
  $options_form = itoggle_get_options_form($clickable, $display_type);

  // Add extra messages in Views UI.
  $options_form['warning_views'] = array(
    '#markup' => '<p><strong>' . t('You will have to save the View and refresh the page to see the iToggle widget.') . '</strong></p>',
    '#weight' => -4,
  );
  $options_form['clickable']['#description'] .= '<br/><strong>' . t("Regardless of your choice, the widget won't be clickable in the Views preview.") . '</strong>';

  // Wrap the form in a fieldset.
  foreach ($options_form as $key => $value) {
    $form['itoggle'][$key] = $value;
  }
}