public function RoutePathSubscriber::collectPaths in Tome 8
Reacts to a collect paths event.
Parameters
\Drupal\tome_static\Event\CollectPathsEvent $event: The collect paths event.
File
- modules/
tome_static/ src/ EventSubscriber/ RoutePathSubscriber.php, line 53
Class
- RoutePathSubscriber
- Adds route paths to the list of paths to export.
Namespace
Drupal\tome_static\EventSubscriberCode
public function collectPaths(CollectPathsEvent $event) {
$language_none = $this->languageManager
->getLanguage(LanguageInterface::LANGCODE_NOT_APPLICABLE);
foreach ($this->routeProvider
->getAllRoutes() as $route_name => $route) {
try {
$url = Url::fromRoute($route_name, [], [
'language' => $language_none,
]);
$path = $url
->toString();
if ($path && $url
->access()) {
$event
->addPath(parse_url($path, PHP_URL_PATH));
}
} catch (\Exception $e) {
}
}
}