public function BooleanYesNo::settingsForm in Boolean formatter 8
File
- lib/
Drupal/ boolean_formatter/ Plugin/ field/ formatter/ BooleanYesNo.php, line 38 - Contains \Drupal\boolean_formatter\Plugin\field\formatter\BooleanYesNo.
Class
- BooleanYesNo
- Plugin implementation of the 'boolean_formatter' formatter.
Namespace
Drupal\boolean_formatter\Plugin\field\formatterCode
public function settingsForm(array $form, array &$form_state) {
$field_name = $this->fieldDefinition
->getFieldName();
$form['format'] = array(
'#type' => 'select',
'#title' => t('Output format'),
'#options' => $this
->getFormatOptions(),
'#default_value' => $this
->getSetting('format'),
);
$form['custom_on'] = array(
'#type' => 'textfield',
'#title' => t('Custom output for On'),
'#default_value' => $this
->getSetting('custom_on'),
'#states' => array(
'visible' => array(
'select[name="fields[' . $field_name . '][settings_edit_form][settings][format]"]' => array(
'value' => 'custom',
),
),
),
);
$form['custom_off'] = array(
'#type' => 'textfield',
'#title' => t('Custom output for Off'),
'#default_value' => $this
->getSetting('custom_off'),
'#states' => array(
'visible' => array(
'select[name="fields[' . $field_name . '][settings_edit_form][settings][format]"]' => array(
'value' => 'custom',
),
),
),
);
$form['reverse'] = array(
'#type' => 'checkbox',
'#title' => t('Reverse'),
'#description' => t('If checked, true will be displayed as false.'),
'#default_value' => $this
->getSetting('reverse'),
);
return $form;
}