In drupal 7 we could force a page to open in admin page, there are several way to do that in drupal 7

Now I am looking for equivalent solution in Drupal 8, How can I force drupal to render a specified pages as admin theme?


You can add the _admin_route option to a route:

  path: '/aggregator/sources/add'
    _controller: '\Drupal\aggregator\Controller\AggregatorController::feedAdd'
    _title: 'Add feed'
    _permission: 'administer news feeds'
    _admin_route: TRUE

You can also implement your own negotiator (See \Drupal\user\Theme\AdminNegotiator) or add that option to routes dynamically in a request subscriber.

  • Thanks for your attentions, it seems you answer is right, I have a custom content type, lets call him "course" , I want when user try to see ( I mean view the course node), it'll opened by admin theme?,can you help me about this case? – Yuseferi Aug 24 '16 at 6:48
  • can you tell me how? I still waiting for your answer – Yuseferi Aug 29 '16 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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