RouteSubscriber.php in Taxonomy access fix 8
Namespace
Drupal\taxonomy_access_fix\RoutingFile
src/Routing/RouteSubscriber.phpView source
<?php
namespace Drupal\taxonomy_access_fix\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
class RouteSubscriber extends RouteSubscriberBase {
/**
* New and improved hook_menu_alter().
*/
public function alterRoutes(RouteCollection $collection) {
// admin/structure/taxonomy
if ($route = $collection
->get('entity.taxonomy_vocabulary.collection')) {
$route
->setRequirements([
'_custom_access' => '\\taxonomy_access_fix_route_access',
]);
$route
->setOption('op', 'index');
}
// admin/structure/taxonomy/%vocabulary
if ($route = $collection
->get('entity.taxonomy_vocabulary.overview_form')) {
$route
->setRequirements([
'_custom_access' => '\\taxonomy_access_fix_route_access',
]);
$route
->setOption('op', 'list terms');
}
// admin/structure/taxonomy/%vocabulary/add
if ($route = $collection
->get('entity.taxonomy_term.add_form')) {
$route
->setRequirements([
'_custom_access' => '\\taxonomy_access_fix_route_access',
]);
$route
->setOption('op', 'add terms');
}
// admin/structure/taxonomy/manage/%vocabulary/reset
if ($route = $collection
->get('entity.taxonomy_vocabulary.reset_form')) {
$route
->setRequirements([
'_custom_access' => '\\taxonomy_access_fix_route_access',
]);
$route
->setOption('op', 'reorder terms');
}
}
}
Classes
Name | Description |
---|---|
RouteSubscriber |