public function views_handler_field_boolean::options_form in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 handlers/views_handler_field_boolean.inc \views_handler_field_boolean::options_form()
- 6.2 handlers/views_handler_field_boolean.inc \views_handler_field_boolean::options_form()
Default options form provides the label widget that all fields should have.
Overrides views_handler_field::options_form
File
- handlers/
views_handler_field_boolean.inc, line 61 - Definition of views_handler_field_boolean.
Class
- views_handler_field_boolean
- A handler to provide proper displays for booleans.
Code
public function options_form(&$form, &$form_state) {
foreach ($this->formats as $key => $item) {
$options[$key] = implode('/', $item);
}
$form['type'] = array(
'#type' => 'select',
'#title' => t('Output format'),
'#options' => $options,
'#default_value' => $this->options['type'],
);
$form['type_custom_true'] = array(
'#type' => 'textfield',
'#title' => t('Custom output for TRUE'),
'#default_value' => $this->options['type_custom_true'],
'#states' => array(
'visible' => array(
'select[name="options[type]"]' => array(
'value' => 'custom',
),
),
),
);
$form['type_custom_false'] = array(
'#type' => 'textfield',
'#title' => t('Custom output for FALSE'),
'#default_value' => $this->options['type_custom_false'],
'#states' => array(
'visible' => array(
'select[name="options[type]"]' => array(
'value' => 'custom',
),
),
),
);
$form['not'] = array(
'#type' => 'checkbox',
'#title' => t('Reverse'),
'#description' => t('If checked, true will be displayed as false.'),
'#default_value' => $this->options['not'],
);
parent::options_form($form, $form_state);
}