public function RouteSubscriber::alterRoutes in Block Token 8
Alters existing routes for a specific collection.
Parameters
\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.
Overrides RouteSubscriberBase::alterRoutes
File
- src/
Routing/ RouteSubscriber.php, line 13
Class
Namespace
Drupal\block_token\RoutingCode
public function alterRoutes(RouteCollection $collection) {
// For block configuration route grant permission if
// block token permission has been checked.
// admin/structure/block/manage/{block}
if ($route = $collection
->get('entity.block.edit_form')) {
$route
->setRequirements(array(
'_custom_access' => '\\block_token_route_access',
));
}
if ($route = $collection
->get('block.admin_display_theme')) {
$route
->setRequirements(array(
'_custom_access' => '\\block_token_route_access',
));
}
}