1 views_handler_field_system_info.inc public views_handler_field_system_info::options_form(&$form, &$form_state)

Default options form that provides the label widget that all fields should have.

Overrides views_handler_field::options_form

File

core/modules/system/views/views_handler_field_system_info.inc, line 34
Definition of views_handler_field_system_info.

Class

views_handler_field_system_info
A handler to display module and theme properties stored in the database.

Code

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

  $form['custom_label']['#type'] = 'radios';
  $form['custom_label']['#options'] = array(
    'default' => t('Use human-readable label shown in the "Property" select field below'),
    'custom' => t('Custom label'),
    'none' => t('No label'),
  );
  unset($form['custom_label']['#description']);

  $form['custom_label']['#default_value'] = $this->options['custom_label'];
  $form['label']['#states'] = array(
    'visible' => array(
      ':input[name="options[custom_label]"]' => array('value' => 'custom'),
    ),
  );
  $form['label']['#title'] = t('Custom label');

  $properties = array();
  foreach ($this->_getPropertyOptions() as $key => $label) {
    $properties[$key] = $label . ' (machine name: ' . $key . ')';
  }
  $properties['other'] = t('Other');

  $form['info_property'] = array(
    '#type' => 'select',
    '#title' => t('Property'),
    '#options' => $properties,
    '#default_value' => $this->options['info_property'],
  );

  $form['other'] = array(
    '#type' => 'textfield',
    '#title' => t('Property name'),
    '#description' => t('The machine name of the property found in the .info file. If the property doesn\'t exist, the output will be empty.'),
    '#default_value' => $this->options['other'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[info_property]"]' => array('value' => 'other'),
      ),
    ),
  );

  $form['dependencies_display'] = array(
    '#type' => 'radios',
    '#title' => t('Dependency display'),
    '#description' => t('Select how to display dependencies.'),
    '#options' => array(
      'machine_names' => t('As machine names'),
      'project_names' => t('As project names'),
    ),
    '#default_value' => $this->options['dependencies_display'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[info_property]"]' => array('value' => 'dependencies'),
      ),
    ),
  );

  $form['multi_type'] = array(
    '#type' => 'radios',
    '#title' => t('Display type'),
    '#options' => array(
      'ul' => t('Unordered list'),
      'ol' => t('Ordered list'),
      'separator' => t('Simple separator'),
    ),
    '#states' => array(
      'visible' => array(
        ':input[name="options[info_property]"]' => array(
          array('value' => 'tags'),
          array('value' => 'dependencies'),
          array('value' => 'scripts'),
        ),
      ),
    ),
    '#default_value' => $this->options['multi_type'],
  );

  $form['separator'] = array(
    '#type' => 'textfield',
    '#title' => t('Separator'),
    '#default_value' => $this->options['separator'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[info_property]"]' => array(
          array('value' => 'tags'),
          array('value' => 'dependencies'),
        ),
        ':input[name="options[multi_type]"]' => array('value' => 'separator'),
      ),
    ),
  );
}