本文整理汇总了PHP中Drupal\Core\Routing\RouteProviderInterface::getAllRoutes方法的典型用法代码示例。如果您正苦于以下问题:PHP RouteProviderInterface::getAllRoutes方法的具体用法?PHP RouteProviderInterface::getAllRoutes怎么用?PHP RouteProviderInterface::getAllRoutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Routing\RouteProviderInterface
的用法示例。
在下文中一共展示了RouteProviderInterface::getAllRoutes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = NULL)
{
$this->data['routing'] = [];
foreach ($this->routeProvider->getAllRoutes() as $route_name => $route) {
// @TODO Find a better visual representation.
$this->data['routing'][] = ['name' => $route_name, 'path' => $route->getPath()];
}
}
示例2: getAllRoutes
protected function getAllRoutes(DrupalStyle $io)
{
$routes = $this->routeProvider->getAllRoutes();
$tableHeader = [$this->trans('commands.router.debug.messages.name'), $this->trans('commands.router.debug.messages.path')];
$tableRows = [];
foreach ($routes as $route_name => $route) {
$tableRows[] = [$route_name, $route->getPath()];
}
$io->table($tableHeader, $tableRows, 'compact');
}