function ThemeTestSubscriber::onView

Same name in other branches
  1. 9 core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php \Drupal\theme_test\EventSubscriber\ThemeTestSubscriber::onView()
  2. 8.9.x core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php \Drupal\theme_test\EventSubscriber\ThemeTestSubscriber::onView()
  3. 11.x core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php \Drupal\theme_test\EventSubscriber\ThemeTestSubscriber::onView()

Ensures that the theme registry was not initialized.

File

core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php, line 80

Class

ThemeTestSubscriber
Theme test subscriber for controller requests.

Namespace

Drupal\theme_test\EventSubscriber

Code

public function onView(RequestEvent $event) {
    $current_route = $this->currentRouteMatch
        ->getRouteName();
    $entity_autocomplete_route = [
        'system.entity_autocomplete',
    ];
    if (in_array($current_route, $entity_autocomplete_route)) {
        if ($this->container
            ->initialized('theme.registry')) {
            throw new \Exception('registry initialized');
        }
    }
}

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