class AdminContext in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Routing/AdminContext.php \Drupal\Core\Routing\AdminContext
Provides a helper class to determine whether the route is an admin one.
Hierarchy
- class \Drupal\Core\Routing\AdminContext
Expanded class hierarchy of AdminContext
3 files declare their use of AdminContext
- AdminNegotiator.php in core/
modules/ user/ src/ Theme/ AdminNegotiator.php - Contains \Drupal\user\Theme\AdminNegotiator.
- AdminPathConfigEntityConverter.php in core/
lib/ Drupal/ Core/ ParamConverter/ AdminPathConfigEntityConverter.php - Contains \Drupal\Core\ParamConverter\AdminPathConfigEntityConverter.
- LanguageNegotiationUserAdmin.php in core/
modules/ user/ src/ Plugin/ LanguageNegotiation/ LanguageNegotiationUserAdmin.php - Contains \Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin.
1 string reference to 'AdminContext'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses AdminContext
File
- core/
lib/ Drupal/ Core/ Routing/ AdminContext.php, line 15 - Contains \Drupal\Core\Routing\AdminContext.
Namespace
Drupal\Core\RoutingView source
class AdminContext {
/**
* The route match.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected $routeMatch;
/**
* Construct a new admin context helper instance.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
*/
public function __construct(RouteMatchInterface $route_match) {
$this->routeMatch = $route_match;
}
/**
* Determines whether the active route is an admin one.
*
* @param \Symfony\Component\Routing\Route $route
* (optional) The route to determine whether it is an admin one. Per default
* this falls back to the route object on the active request.
*
* @return bool
* Returns TRUE if the route is an admin one, otherwise FALSE.
*/
public function isAdminRoute(Route $route = NULL) {
if (!$route) {
$route = $this->routeMatch
->getRouteObject();
if (!$route) {
return FALSE;
}
}
return (bool) $route
->getOption('_admin_route');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AdminContext:: |
protected | property | The route match. | |
AdminContext:: |
public | function | Determines whether the active route is an admin one. | |
AdminContext:: |
public | function | Construct a new admin context helper instance. |