public function HookMenu::getSourceRoutes in Drupal 7 to 8/9 Module Upgrader 8
Returns the collection of routes in the source.
Return value
RouterInterface The requested link collection.
1 call to HookMenu::getSourceRoutes()
- HookMenu::buildDestinationRoutes in src/
Routing/ HookMenu.php - Builds the Drupal 8 router by running the Drupal 7 router items through the appropriate route converters.
File
- src/
Routing/ HookMenu.php, line 83
Class
- HookMenu
- This class is a conversion map for hook_menu().
Namespace
Drupal\drupalmoduleupgrader\RoutingCode
public function getSourceRoutes() {
if (empty($this->sourceRoutes)) {
$this->sourceRoutes = new Drupal7Router();
$items = call_user_func($this->target
->id() . '_menu');
foreach ($items as $path => $item) {
$this->sourceRoutes
->addRoute(new Drupal7Route($path, $item));
}
// Now that all routes have been loaded, tell them to resolve their
// hierarchical relationships.
$this->sourceRoutes
->finalize();
}
return $this->sourceRoutes;
}