class RouteSubscriber in Panopoly Magic 8.2
Implements a route subscriber for Panopoly Magic.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\panopoly_magic\Routing\RouteSubscriber
Expanded class hierarchy of RouteSubscriber
1 string reference to 'RouteSubscriber'
1 service uses RouteSubscriber
File
- src/
Routing/ RouteSubscriber.php, line 11
Namespace
Drupal\panopoly_magic\RoutingView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |