function FilterPluginCollection::initializePlugin

Same name in other branches
  1. 9 core/modules/filter/src/FilterPluginCollection.php \Drupal\filter\FilterPluginCollection::initializePlugin()
  2. 8.9.x core/modules/filter/src/FilterPluginCollection.php \Drupal\filter\FilterPluginCollection::initializePlugin()
  3. 11.x core/modules/filter/src/FilterPluginCollection.php \Drupal\filter\FilterPluginCollection::initializePlugin()

Overrides DefaultLazyPluginCollection::initializePlugin

1 call to FilterPluginCollection::initializePlugin()
FilterPluginCollection::getAll in core/modules/filter/src/FilterPluginCollection.php
Retrieves filter definitions and creates an instance for each filter.

File

core/modules/filter/src/FilterPluginCollection.php, line 63

Class

FilterPluginCollection
A collection of filters.

Namespace

Drupal\filter

Code

protected function initializePlugin($instance_id) {
    // Filters have a 1:1 relationship to text formats and can be added and
    // instantiated at any time.
    // @todo $configuration is the whole filter plugin instance configuration,
    //   as contained in the text format configuration. The default
    //   configuration is the filter plugin definition. Configuration should not
    //   be contained in definitions. Move into a FilterBase::init() method.
    $configuration = $this->manager
        ->getDefinition($instance_id);
    // Merge the actual configuration into the default configuration.
    if (isset($this->configurations[$instance_id])) {
        $configuration = NestedArray::mergeDeepArray([
            $configuration,
            $this->configurations[$instance_id],
        ], TRUE);
    }
    $this->configurations[$instance_id] = $configuration;
    parent::initializePlugin($instance_id);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.