0

I have a custom view for editing contents for the authors. When I'm logged in as a use with this author role this view is displayed with the 'frontend' theme. But I need it displayed in 'backend' theme.

I absolutely don't know how to get this view displayed in another theme.

4

Go to Admin -> People -> Permissions & search View the administration theme check the checkbox for author role. Check screenshot below:

enter image description here

|improve this answer|||||
  • OK, I set this permission. But the view is still displaying in frontend theme... – deelite Mar 3 '15 at 9:02
  • Does the view has admin as first argument of path? If not then change the page path then try. – Vishal Patil Mar 3 '15 at 9:05
0

The ability to add "use admin theme" on a view will be available from 8.6, until then it's necessary to do some coding.

You must add a RouteSubscriber which goes through all the available routes until it finds the one (or more) you want to change, then add the '_admin_theme' = TRUE, option.

Use Drupal Console to add the RouteSubscriber (drupal rs) then insert the following code:

$admin_routes = ['view.example_page.page_1'];
foreach ($collection->all() as $name => $route) {
  if (in_array($name, $admin_routes)) {
    $route->setOption('_admin_route', TRUE);
  }
}

And that's all you need.

More details here: https://www.computerminds.co.uk/drupal-code/drupal-8-views-how-set-admin-path

|improve this answer|||||
-1

You can use themekey. This module allows you to define simple or sophisticated theme-switching rules which allow automatic selection of a theme depending on current path

|improve this answer|||||
  • There's no Drupal 8 version even after three years. And no commits for a year at the time I write this. – Adaddinsane Jun 20 '18 at 10:48

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.