class ConfigTranslationTestSubscriber

Same name in other branches
  1. 8.9.x core/modules/config_translation/tests/modules/config_translation_test/src/EventSubscriber/ConfigTranslationTestSubscriber.php \Drupal\config_translation_test\EventSubscriber\ConfigTranslationTestSubscriber
  2. 10 core/modules/config_translation/tests/modules/config_translation_test/src/EventSubscriber/ConfigTranslationTestSubscriber.php \Drupal\config_translation_test\EventSubscriber\ConfigTranslationTestSubscriber
  3. 11.x core/modules/config_translation/tests/modules/config_translation_test/src/EventSubscriber/ConfigTranslationTestSubscriber.php \Drupal\config_translation_test\EventSubscriber\ConfigTranslationTestSubscriber

Adds configuration names to configuration mapper on POPULATE_MAPPER event.

Hierarchy

  • class \Drupal\config_translation_test\EventSubscriber\ConfigTranslationTestSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of ConfigTranslationTestSubscriber

1 string reference to 'ConfigTranslationTestSubscriber'
config_translation_test.services.yml in core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.services.yml
core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.services.yml
1 service uses ConfigTranslationTestSubscriber
config_translation_test_event_subscriber in core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.services.yml
Drupal\config_translation_test\EventSubscriber\ConfigTranslationTestSubscriber

File

core/modules/config_translation/tests/modules/config_translation_test/src/EventSubscriber/ConfigTranslationTestSubscriber.php, line 12

Namespace

Drupal\config_translation_test\EventSubscriber
View source
class ConfigTranslationTestSubscriber implements EventSubscriberInterface {
    
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents() {
        return [
            ConfigTranslationEvents::POPULATE_MAPPER => [
                [
                    'addConfigNames',
                ],
            ],
        ];
    }
    
    /**
     * Reacts to the populating of a configuration mapper.
     *
     * @param \Drupal\config_translation\Event\ConfigMapperPopulateEvent $event
     *   The configuration mapper event.
     */
    public function addConfigNames(ConfigMapperPopulateEvent $event) {
        $mapper = $event->getMapper();
        if ($mapper->getBaseRouteName() === 'system.site_information_settings' && $mapper->getLangcode() === 'en') {
            $mapper->addConfigName('config_translation_test.content');
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
ConfigTranslationTestSubscriber::addConfigNames public function Reacts to the populating of a configuration mapper.
ConfigTranslationTestSubscriber::getSubscribedEvents public static function

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