Robin S Posted November 23, 2016 Share Posted November 23, 2016 This is something I used in a couple of modules recently and it could be useful as a standalone hook. It adds classes to the body tag in the admin theme for: roles the user has if the user is a non-superuser the user's name You could use this if you want to tweak the admin interface for a role using CSS/JS (e.g. with Admin Custom Files). There is also an old wishlist item requesting this. $this->addHookAfter('AdminTheme::getExtraMarkup', function($event) { $theme = $event->object; $user = $this->user; foreach($user->roles as $role) { $theme->addBodyClass("role-{$role->name}"); } if(!$user->isSuperuser()) $theme->addBodyClass("role-nonsuperuser"); $theme->addBodyClass("user-{$user->name}"); }); 5 1 Link to comment Share on other sites More sharing options...
tpr Posted November 23, 2016 Share Posted November 23, 2016 Would you mind if I add this to AdminOnSteroids? (probably won't be configurable) 3 Link to comment Share on other sites More sharing options...
Robin S Posted November 23, 2016 Author Share Posted November 23, 2016 4 minutes ago, tpr said: Would you mind if I add this to AdminOnSteroids? Go for it. 2 Link to comment Share on other sites More sharing options...
tpr Posted November 23, 2016 Share Posted November 23, 2016 Went for it, thanks! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now