You are here

public function FilterHtml::setConfiguration in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/filter/src/Plugin/Filter/FilterHtml.php \Drupal\filter\Plugin\Filter\FilterHtml::setConfiguration()
  2. 10 core/modules/filter/src/Plugin/Filter/FilterHtml.php \Drupal\filter\Plugin\Filter\FilterHtml::setConfiguration()

Sets the configuration for this plugin instance.

Parameters

array $configuration: An associative array containing the plugin's configuration.

Overrides FilterBase::setConfiguration

File

core/modules/filter/src/Plugin/Filter/FilterHtml.php, line 70

Class

FilterHtml
Provides a filter to limit allowed HTML tags.

Namespace

Drupal\filter\Plugin\Filter

Code

public function setConfiguration(array $configuration) {
  if (isset($configuration['settings']['allowed_html'])) {

    // The javascript in core/modules/filter/filter.filter_html.admin.js
    // removes new lines and double spaces so, for consistency when javascript
    // is disabled, remove them.
    $configuration['settings']['allowed_html'] = preg_replace('/\\s+/', ' ', $configuration['settings']['allowed_html']);
  }
  parent::setConfiguration($configuration);

  // Force restrictions to be calculated again.
  $this->restrictions = NULL;
}