You are here

function imagepicker_colorbox_handler_field_colorbox::options_form in Image Picker 7

File

handlers/imagepicker_colorbox_handler_field_colorbox.inc, line 23
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL class inherited from handler for Colorbox module.

Class

imagepicker_colorbox_handler_field_colorbox
A handler to provide a field that is completely customizable by the administrator.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // Get a list of the available fields and arguments for token replacement.
  $options = array();
  $fields = array(
    'trigger_field' => t('<None>'),
  );
  foreach ($this->view->display_handler
    ->get_handlers('field') as $field => $handler) {
    $options[t('Fields')]["[{$field}]"] = $handler
      ->ui_name();

    // We only use fields up to (and including) this one.
    if ($field == $this->options['id']) {
      break;
    }

    // If the instance has a custom name use that or use the title.
    // This helps if the same field is used more than once.
    $fields[$field] = isset($handler->options['ui_name']) && $handler->options['ui_name'] ? $handler->options['ui_name'] : $handler->definition['title'];
  }
  $form['trigger_field'] = array(
    '#type' => 'select',
    '#title' => t('Trigger field'),
    '#description' => t('Select the field that should be turned into the trigger for the Colorbox.  Only fields that appear before this one in the field list may be used.'),
    '#options' => $fields,
    '#default_value' => $this->options['trigger_field'],
    '#weight' => -12,
  );
  $opts = array(
    0 => t('All'),
  );
  $opts += drupal_map_assoc(range(1, 50));
  $form['hide'] = array(
    '#type' => 'select',
    '#title' => t('Links to show'),
    '#description' => t('How many links to show.'),
    '#options' => $opts,
    '#default_value' => $this->options['hide'],
    '#weight' => -5,
  );
}