You are here

class RouteSubscriber in Panopoly 8.2

Same name in this branch
  1. 8.2 modules/panopoly/panopoly_magic/src/Routing/RouteSubscriber.php \Drupal\panopoly_magic\Routing\RouteSubscriber
  2. 8.2 modules/panopoly/panopoly_media/src/Routing/RouteSubscriber.php \Drupal\panopoly_media\Routing\RouteSubscriber

Implements a route subscriber for Panopoly Magic.

Hierarchy

  • class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber'
panopoly_magic.services.yml in modules/panopoly/panopoly_magic/panopoly_magic.services.yml
modules/panopoly/panopoly_magic/panopoly_magic.services.yml
1 service uses RouteSubscriber
panopoly_magic.route_subscriber in modules/panopoly/panopoly_magic/panopoly_magic.services.yml
Drupal\panopoly_magic\Routing\RouteSubscriber

File

modules/panopoly/panopoly_magic/src/Routing/RouteSubscriber.php, line 11

Namespace

Drupal\panopoly_magic\Routing
View source
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {

    // Replace the layout builder choose block route with our own.
    if ($route = $collection
      ->get('layout_builder.choose_block')) {
      $route
        ->setDefaults([
        '_controller' => '\\Drupal\\panopoly_magic\\Controller\\LayoutBuilderChooseBlockController::build',
        '_title' => $route
          ->getDefault('title'),
      ]);
    }
    if ($route = $collection
      ->get('layout_builder.choose_inline_block')) {
      $route
        ->setDefaults([
        '_controller' => '\\Drupal\\panopoly_magic\\Controller\\LayoutBuilderChooseBlockController::inlineBlockList',
        '_title' => $route
          ->getDefault('title'),
      ]);
    }

    // Replace the layout builder add block route with our own.
    if ($route = $collection
      ->get('layout_builder.add_block')) {
      $route
        ->setDefaults([
        '_controller' => '\\Drupal\\panopoly_magic\\Controller\\LayoutBuilderAddBlockController::addBlock',
        '_title' => $route
          ->getDefault('title'),
      ]);
    }

    // Replace the layout builder update block form with our own.
    if ($route = $collection
      ->get('layout_builder.update_block')) {
      $route
        ->setDefault('_form', '\\Drupal\\panopoly_magic\\Form\\LayoutBuilderUpdateBlockForm');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1