public function AdminThemeAdminContext::isAdminRoute in Administration theme 8
Determines whether the active route is an admin one.
Parameters
\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 value
bool Returns TRUE if the route is an admin one, otherwise FALSE.
Overrides AdminContext::isAdminRoute
File
- src/
Routing/ AdminThemeAdminContext.php, line 58
Class
- AdminThemeAdminContext
- Decorates the core AdminContext to check custom admin paths.
Namespace
Drupal\admin_theme\RoutingCode
public function isAdminRoute(Route $route = NULL) {
$excludePaths = (string) $this->configFactory
->get('admin_theme.settings')
->get('exclude_paths');
/** @var \Drupal\Core\Condition\ConditionInterface $excludeCondition */
$excludeCondition = $this->conditionManager
->createInstance('request_path', [
'pages' => $excludePaths,
]);
if ($this->conditionManager
->execute($excludeCondition)) {
return FALSE;
}
$paths = $this->configFactory
->get('admin_theme.settings')
->get('paths');
/** @var \Drupal\Core\Condition\ConditionInterface $condition */
$condition = $this->conditionManager
->createInstance('request_path', [
'pages' => $paths,
]);
if ($this->conditionManager
->execute($condition)) {
return TRUE;
}
return $this->subject
->isAdminRoute($route);
}