public function TokenFilter::settingsForm in Token Filter 8
Generates a filter's settings form.
Parameters
array $form: A minimally prepopulated form array.
\Drupal\Core\Form\FormStateInterface $form_state: The state of the (entire) configuration form.
Return value
array The $form array with additional form elements for the settings of this filter. The submitted form values should match $this->settings.
Overrides FilterBase::settingsForm
File
- src/
Plugin/ Filter/ TokenFilter.php, line 104
Class
- TokenFilter
- Provides a filter that replaces global and entity tokens with their values.
Namespace
Drupal\token_filter\Plugin\FilterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form['replace_empty'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Replace empty values'),
'#description' => $this
->t('Remove tokens from text if they cannot be replaced with a value'),
'#default_value' => $this->settings['replace_empty'],
];
return $form;
}