You are here

public function FormModeThemeNegociator::isAdminTheme in Form mode manager 8.2

Evaluate if given theme is admin and user has access to view admin theme.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match object.

string $theme_type: The kind of theme needed by route or configuration 'admin' or 'default'.

Return value

bool True if current user is an admin theme and user can view it.

1 call to FormModeThemeNegociator::isAdminTheme()
FormModeThemeNegociator::determineActiveTheme in modules/form_mode_theme_switcher/src/Theme/FormModeThemeNegociator.php
Determine the active theme from the route or configuration.

File

modules/form_mode_theme_switcher/src/Theme/FormModeThemeNegociator.php, line 147

Class

FormModeThemeNegociator
Class FormModeThemeNegociator.

Namespace

Drupal\form_mode_manager_theme_switcher\Theme

Code

public function isAdminTheme(RouteMatchInterface $route_match, $theme_type) {
  if ($route_match
    ->getParameter('_admin_route')) {
    return $this->currentUser
      ->hasPermission('view the administration theme');
  }
  return $this->currentUser
    ->hasPermission('view the administration theme') && $theme_type === 'admin';
}