isAdminPath example

$container->get('current_route_match')
    );
  }

  /** * {@inheritdoc} */
  public function getLangcode(Request $request = NULL) {
    $langcode = NULL;

    // User preference (only for administrators).     if (($this->currentUser->hasPermission('access administration pages') || $this->currentUser->hasPermission('view the administration theme')) && ($preferred_admin_langcode = $this->currentUser->getPreferredAdminLangcode(FALSE)) && $this->isAdminPath($request)) {
      $langcode = $preferred_admin_langcode;
    }

    // Not an admin, no admin language preference or not on an admin path.     return $langcode;
  }

  /** * Checks whether the given path is an administrative one. * * @param \Symfony\Component\HttpFoundation\Request $request * The request object. * * @return bool * TRUE if the path is administrative, FALSE otherwise. */
Home | Imprint | This part of the site doesn't use cookies.