function EditorConfigTranslationSubscriber::addConfigNames

Same name in other branches
  1. 9 core/modules/editor/src/EventSubscriber/EditorConfigTranslationSubscriber.php \Drupal\editor\EventSubscriber\EditorConfigTranslationSubscriber::addConfigNames()
  2. 8.9.x core/modules/editor/src/EventSubscriber/EditorConfigTranslationSubscriber.php \Drupal\editor\EventSubscriber\EditorConfigTranslationSubscriber::addConfigNames()
  3. 10 core/modules/editor/src/EventSubscriber/EditorConfigTranslationSubscriber.php \Drupal\editor\EventSubscriber\EditorConfigTranslationSubscriber::addConfigNames()

Reacts to the populating of a configuration mapper.

Parameters

\Drupal\config_translation\Event\ConfigMapperPopulateEvent $event: The configuration mapper event.

File

core/modules/editor/src/EventSubscriber/EditorConfigTranslationSubscriber.php, line 50

Class

EditorConfigTranslationSubscriber
Adds configuration names to configuration mapper on POPULATE_MAPPER event.

Namespace

Drupal\editor\EventSubscriber

Code

public function addConfigNames(ConfigMapperPopulateEvent $event) {
    $mapper = $event->getMapper();
    if ($mapper instanceof ConfigEntityMapperInterface && $mapper->getType() == 'filter_format') {
        $editor_config_name = 'editor.editor.' . $mapper->getEntity()
            ->id();
        // Only add the text editor config if it exists, otherwise we assume no
        // editor has been set for this text format.
        if (!$this->configFactory
            ->get($editor_config_name)
            ->isNew()) {
            $mapper->addConfigName($editor_config_name);
        }
    }
}

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