You are here

function content_handler_field_multiple::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_multiple.inc \content_handler_field_multiple::options_form()

Provide 'group multiple values' option.

Overrides content_handler_field::options_form

File

includes/views/handlers/content_handler_field_multiple.inc, line 56
An extended subclass for field handling that adds multiple field grouping.

Class

content_handler_field_multiple
@file An extended subclass for field handling that adds multiple field grouping.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $field = $this->content_field;
  $options = $this->options;
  $form['multiple'] = array(
    '#access' => $field['multiple'],
    '#weight' => 1,
  );
  $form['multiple']['group'] = array(
    '#title' => t('Group multiple values'),
    '#type' => 'checkbox',
    '#default_value' => $options['multiple']['group'],
    '#description' => t('If unchecked, each item in the field will create a new row, which may appear to cause duplicates. This setting is not compatible with click-sorting in table displays.'),
  );

  // Make the string translatable by keeping it as a whole rather than
  // translating prefix and suffix separately.
  list($prefix, $suffix) = explode('@count', t('Show @count value(s)'));
  $form['multiple']['multiple_number'] = array(
    '#type' => 'textfield',
    '#size' => 5,
    '#field_prefix' => $prefix,
    '#field_suffix' => $suffix,
    '#default_value' => $options['multiple']['multiple_number'],
    '#prefix' => '<div class="container-inline">',
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      'edit-options-multiple-group' => array(
        TRUE,
      ),
    ),
  );
  list($prefix, $suffix) = explode('@count', t('starting from @count'));
  $form['multiple']['multiple_from'] = array(
    '#type' => 'textfield',
    '#size' => 5,
    '#field_prefix' => $prefix,
    '#field_suffix' => $suffix,
    '#default_value' => $options['multiple']['multiple_from'],
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      'edit-options-multiple-group' => array(
        TRUE,
      ),
    ),
    '#description' => t('(first item is 0)'),
  );
  $form['multiple']['multiple_reversed'] = array(
    '#title' => t('Reversed'),
    '#type' => 'checkbox',
    '#default_value' => $options['multiple']['multiple_reversed'],
    '#suffix' => '</div>',
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      'edit-options-multiple-group' => array(
        TRUE,
      ),
    ),
    '#description' => t('(start from last values)'),
  );
}