3

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?

4

You can add the _admin_route option to a route:

aggregator.feed_add:
  path: '/aggregator/sources/add'
  defaults:
    _controller: '\Drupal\aggregator\Controller\AggregatorController::feedAdd'
    _title: 'Add feed'
  requirements:
    _permission: 'administer news feeds'
  options:
    _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? – Yusef Mohamadi Aug 24 '16 at 6:48
  • can you tell me how? I still waiting for your answer – Yusef Mohamadi 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.