You are here

protected static function AdminRouteSubscriber::isHtmlRoute in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php \Drupal\system\EventSubscriber\AdminRouteSubscriber::isHtmlRoute()

Determines whether the given route is an HTML route.

Parameters

\Symfony\Component\Routing\Route $route: The route to analyze.

Return value

bool TRUE if HTML is a valid format for this route.

1 call to AdminRouteSubscriber::isHtmlRoute()
AdminRouteSubscriber::alterRoutes in core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php
Alters existing routes for a specific collection.

File

core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php, line 50

Class

AdminRouteSubscriber
Adds the _admin_route option to each admin HTML route.

Namespace

Drupal\system\EventSubscriber

Code

protected static function isHtmlRoute(Route $route) {

  // If a route has no explicit format, then HTML is valid.
  $format = $route
    ->hasRequirement('_format') ? explode('|', $route
    ->getRequirement('_format')) : [
    'html',
  ];
  return in_array('html', $format, TRUE);
}