Skip to content

Commit

Permalink
Hide redirect view if redirect module is not installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
kepol committed Dec 2, 2023
1 parent 95faa01 commit c1ad954
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Routing/RouteSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ public function alterRoutes(RouteCollection $collection) {
if ($route = $collection->get('entity.node.canonical')) {
$route->setDefault('_controller', '\Drupal\quant\Controller\QuantNodeViewController::view');
}

// Hide metadata redirect route if redirect module isn't installed.
if ($route = $collection->get('quant.metadata_redirect')) {
if (!\Drupal::moduleHandler()->moduleExists('redirect')) {
// Note second parameter is a string.
$route->setRequirement('_access', 'FALSE');
}
}

}

}

0 comments on commit c1ad954

Please sign in to comment.