You are here

function content_handler_field::options_form in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 includes/views/handlers/content_handler_field.inc \content_handler_field::options_form()

Provide formatter option.

1 call to content_handler_field::options_form()
content_handler_field_multiple::options_form in includes/views/handlers/content_handler_field_multiple.inc
Provide 'group multiple values' option.
1 method overrides content_handler_field::options_form()
content_handler_field_multiple::options_form in includes/views/handlers/content_handler_field_multiple.inc
Provide 'group multiple values' option.

File

includes/views/handlers/content_handler_field.inc, line 48
The subclass adds basic field and formatter info, for field-specific subclasses to use if they need to.

Class

content_handler_field
@file The subclass adds basic field and formatter info, for field-specific subclasses to use if they need to.

Code

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

  // TODO: do we want the 'link to node' checkbox ?
  // That's usually formatters business...
  $field = $this->content_field;
  $options = $this->options;
  $form['label_type'] = array(
    '#title' => t('Label'),
    '#type' => 'radios',
    '#options' => array(
      'none' => t('None'),
      'widget' => t('Widget label (@label)', array(
        '@label' => $field['widget']['label'],
      )),
      'custom' => t('Custom'),
    ),
    '#default_value' => $options['label_type'],
    '#weight' => 2,
  );
  $form['label'] = array(
    '#title' => t('Custom label'),
    '#type' => 'textfield',
    '#default_value' => $options['label'],
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      'radio:options[label_type]' => array(
        'custom',
      ),
    ),
    '#weight' => 3,
  );
  $field_types = _content_field_types();
  $formatters = array();
  if (is_array($field_types[$field['type']]['formatters'])) {
    foreach ($field_types[$field['type']]['formatters'] as $name => $info) {
      $formatters[$name] = $info['label'];
    }
  }
  $form['format'] = array(
    '#title' => t('Format'),
    '#type' => 'select',
    '#options' => $formatters,
    '#required' => TRUE,
    '#default_value' => $options['format'],
    '#weight' => 4,
  );
}