1

I’ve created a user role of accountant and for this role have created a single page using Views. This page started out as a clone of another admin views page.

Unfortunately this page is using the website’s main theme CSS instead of the admin CSS and is causing some real problems.

I’ve been looking how to have this page NOT load the theme CSS, and use the admin CSS instead.

The accountant role has very limited permissions.

How can I correct this??

4

There's a permission named View the administration theme. This should be given to the accountant role to allow users with that role to view the admin theme instead of the site theme.

If that permission is granted, then check the URL for the page you've created. A last resort would be to check out the documentation for hook_admin_paths(). This hook allows you to specify paths that should use the admin theme and/or use the Overlay (if you've got it enabled). Something like the following would work:

/**  
 * Implements hook_admin_paths().  
 */ 
function MY_MODULE_admin_paths() {   

  $admin_paths = [
    'my/new/admin/view' => TRUE,
  ];

  return $admin_paths; 

}
0
1

You can use hook_custom_theme to change the theme to be used for the current page.

  /**
  * Implements hook_custom_theme().
  */
  function module_name_custom_theme() {
    $path = current_path();
    if ($path == 'your_view_path') {
      return 'admin_theme_name';
    }
  }

'admin_theme_name' would be applied to the path you check in the hook_custom_theme

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.