---
title: "Discussion on \"Drupal: Check if the current page is using the admin theme\" | Hashnode"
description: "Discussion on \"Drupal: Check if the current page is using the admin theme\". Snippet\nif (\\Drupal::service('router.admin_context')->isAdminRoute()) {\n  // ...\n}\n\nThe router.admin_context service maps to the AdminContext helper class.\nisAdminRoute() simply checks the Route for the _admin_route option.\nPitfalls\nWhen working with..."
url: "https://hashnode.com/posts/drupal-snippet-check-if-the-current-page-is-using-the-admin-theme/6298c0135787a911a45d5fcf"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Drupal: Check if the current page is using the admin theme](https://blog.birk-jensen.dk/drupal-snippet-check-if-the-current-page-is-using-the-admin-theme?utm_source=hashnode&utm_medium=feed)

Snippet if (\\Drupal::service('router.admin\_context')->isAdminRoute()) { // ... } The router.admin\_context service maps to the AdminContext helper class. isAdminRoute() simply checks the Route for the \_admin\_route option. Pitfalls When working with...

Jun 2, 2022 · 1 min read · blog.birk-jensen.dk  
Updated Jul 29, 2022  
Read the article

-   [#drupal](https://hashnode.com/tag/drupal)
-   [#snippets](https://hashnode.com/tag/snippets)

## Written by

[Philip Birk-Jensen](https://hashnode.com/@BirkAndMe)

@BirkAndMe · Denmark

  
[View profile](https://hashnode.com/@BirkAndMe)

PHP &amp; JavaScript developer, working in Drupal.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
