class NoBigPipeRouteAlterSubscriber

Same name and namespace in other branches
  1. 8.9.x core/modules/big_pipe/src/EventSubscriber/NoBigPipeRouteAlterSubscriber.php \Drupal\big_pipe\EventSubscriber\NoBigPipeRouteAlterSubscriber
  2. 10 core/modules/big_pipe/src/EventSubscriber/NoBigPipeRouteAlterSubscriber.php \Drupal\big_pipe\EventSubscriber\NoBigPipeRouteAlterSubscriber
  3. 11.x core/modules/big_pipe/src/EventSubscriber/NoBigPipeRouteAlterSubscriber.php \Drupal\big_pipe\EventSubscriber\NoBigPipeRouteAlterSubscriber

Sets the '_no_big_pipe' option on select routes.

Hierarchy

Expanded class hierarchy of NoBigPipeRouteAlterSubscriber

1 string reference to 'NoBigPipeRouteAlterSubscriber'
big_pipe.services.yml in core/modules/big_pipe/big_pipe.services.yml
core/modules/big_pipe/big_pipe.services.yml
1 service uses NoBigPipeRouteAlterSubscriber
route_subscriber.no_big_pipe in core/modules/big_pipe/big_pipe.services.yml
Drupal\big_pipe\EventSubscriber\NoBigPipeRouteAlterSubscriber

File

core/modules/big_pipe/src/EventSubscriber/NoBigPipeRouteAlterSubscriber.php, line 12

Namespace

Drupal\big_pipe\EventSubscriber
View source
class NoBigPipeRouteAlterSubscriber implements EventSubscriberInterface {
    
    /**
     * Alters select routes to have the '_no_big_pipe' option.
     *
     * @param \Drupal\Core\Routing\RouteBuildEvent $event
     *   The event to process.
     */
    public function onRoutingRouteAlterSetNoBigPipe(RouteBuildEvent $event) {
        $no_big_pipe_routes = [
            // The batch system uses a <meta> refresh to work without JavaScript.
'system.batch_page.html',
            // When a user would install the BigPipe module using a browser and with
            // JavaScript disabled, the first response contains the status messages
            // for installing a module, but then the BigPipe no-JS redirect occurs,
            // which then causes the user to not see those status messages.
            // @see https://www.drupal.org/node/2469431#comment-10901944
'system.modules_list',
        ];
        $route_collection = $event->getRouteCollection();
        foreach ($no_big_pipe_routes as $excluded_route) {
            if ($route = $route_collection->get($excluded_route)) {
                $route->setOption('_no_big_pipe', TRUE);
            }
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents() {
        $events[RoutingEvents::ALTER][] = [
            'onRoutingRouteAlterSetNoBigPipe',
        ];
        return $events;
    }

}

Members

Title Sort descending Modifiers Object type Summary
NoBigPipeRouteAlterSubscriber::getSubscribedEvents public static function
NoBigPipeRouteAlterSubscriber::onRoutingRouteAlterSetNoBigPipe public function Alters select routes to have the &#039;_no_big_pipe&#039; option.

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