protected static function RoutePreloader::isGetAndHtmlRoute in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Routing/RoutePreloader.php \Drupal\Core\Routing\RoutePreloader::isGetAndHtmlRoute()
Determines whether the given route is a GET and HTML route.
Parameters
\Symfony\Component\Routing\Route $route: The route to analyze.
Return value
bool TRUE if GET is a valid method and HTML is a valid format for this route.
1 call to RoutePreloader::isGetAndHtmlRoute()
- RoutePreloader::onAlterRoutes in core/
lib/ Drupal/ Core/ Routing/ RoutePreloader.php - Alters existing routes for a specific collection.
File
- core/
lib/ Drupal/ Core/ Routing/ RoutePreloader.php, line 139
Class
- RoutePreloader
- Defines a class which preloads non-admin routes.
Namespace
Drupal\Core\RoutingCode
protected static function isGetAndHtmlRoute(Route $route) {
$methods = $route
->getMethods() ?: [
'GET',
];
// If a route has no explicit format, then HTML is valid.
// @see \Drupal\Core\Routing\RequestFormatRouteFilter::getAvailableFormats()
$format = $route
->hasRequirement('_format') ? explode('|', $route
->getRequirement('_format')) : [
'html',
];
return in_array('GET', $methods, TRUE) && in_array('html', $format, TRUE);
}