According to Drupal handbook route definition accepts parameter called _theme. Unfortunately this parameter is documented as "TODO".

Can this be used to force admin theme for the route? Is it possible to inject config parameter with admin theme name here?

It appears that other solution is to use Theme negotiator however the _theme parameter looks very tempting and way simpler to use.

2 Answers 2


You're looking for the _admin_route option:

  path: '/aggregator/sources/add'
    _controller: '\Drupal\aggregator\Controller\AggregatorController::feedAdd'
    _title: 'Add feed'
    _permission: 'administer news feeds'
    _admin_route: TRUE
  • 3
    Yet another undocumented D8 feature. Commented Dec 29, 2015 at 17:41
  • 9
    Documentation might not be so great yet for D8 but change records are: drupal.org/node/2224207. Always search there if you know how something worked in D7 (found by seaching for "admin path"). drupal.org/developing/api/8/routing seems like a good place (subpage or so) to document this, looking forward to the documentation you'll write about this :)
    – Berdir
    Commented Dec 29, 2015 at 17:47
  • 1
    so does _admin_route just change it so it uses the default theme instead of the admin one?
    – Amy
    Commented Jun 20, 2017 at 14:09
  • 1
    I get a InvalidArgumentException: Routing requirement for "options" must be a string. when attempting to use this solution
    – Amy
    Commented Jun 20, 2017 at 14:30
  path: '/path/path2'
    _controller: 'Drupal\module\Controller\MyController::add'
    _title: 'Add element'
    _admin_route: 'TRUE'

You need to use ' ' around TRUE, if not, you will get 'InvalidArgumentException: Routing requirement for "options" must be a string'


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.