function AdminRouteSubscriber::isHtmlRoute

Same name in other branches
  1. 9 core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php \Drupal\system\EventSubscriber\AdminRouteSubscriber::isHtmlRoute()
  2. 8.9.x core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php \Drupal\system\EventSubscriber\AdminRouteSubscriber::isHtmlRoute()
  3. 10 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.