function FilterHtml::settingsForm
Same name in other branches
- 9 core/modules/filter/src/Plugin/Filter/FilterHtml.php \Drupal\filter\Plugin\Filter\FilterHtml::settingsForm()
- 10 core/modules/filter/src/Plugin/Filter/FilterHtml.php \Drupal\filter\Plugin\Filter\FilterHtml::settingsForm()
- 11.x core/modules/filter/src/Plugin/Filter/FilterHtml.php \Drupal\filter\Plugin\Filter\FilterHtml::settingsForm()
Overrides FilterBase::settingsForm
File
-
core/
modules/ filter/ src/ Plugin/ Filter/ FilterHtml.php, line 42
Class
- FilterHtml
- Provides a filter to limit allowed HTML tags.
Namespace
Drupal\filter\Plugin\FilterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form['allowed_html'] = [
'#type' => 'textarea',
'#title' => $this->t('Allowed HTML tags'),
'#default_value' => $this->settings['allowed_html'],
'#description' => $this->t('A list of HTML tags that can be used. By default only the <em>lang</em> and <em>dir</em> attributes are allowed for all HTML tags. Each HTML tag may have attributes which are treated as allowed attribute names for that HTML tag. Each attribute may allow all values, or only allow specific values. Attribute names or values may be written as a prefix and wildcard like <em>jump-*</em>. JavaScript event attributes, JavaScript URLs, and CSS are always stripped.'),
'#attached' => [
'library' => [
'filter/drupal.filter.filter_html.admin',
],
],
];
$form['filter_html_help'] = [
'#type' => 'checkbox',
'#title' => $this->t('Display basic HTML help in long filter tips'),
'#default_value' => $this->settings['filter_html_help'],
];
$form['filter_html_nofollow'] = [
'#type' => 'checkbox',
'#title' => $this->t('Add rel="nofollow" to all links'),
'#default_value' => $this->settings['filter_html_nofollow'],
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.