Small question (I hope):
How do you implement admin specific CSS? I assume this is doable?
Cheers
Dave
If it's to do with Administation pages yes it is doable, but would depend on what you want to do.
Gererally speaking you would need to add the following in front of the CSS selector you want to change:
.pagelayout-admin
So if you wanted a different font in the header:
For example:
.pagelayout-admin #page-header h1 { font-family: Zen3; }
Hope this helps?
Mary
Hi Mary,
Thanks for a quick response but I was meaning "normal" course pages so you can see, instantly, if someone is logged in as admin - for example red border.
Cheers
Dave
Hi,
I dare say it can be done but I'm not really sure.
Someone has asked about this before, so perhaps if you check this link out as it may answer your question.
Cheers
Mary
Ive done this previously by adding a body class based on the capability a user has
so something like this in the layout
$bodyclasses = array();
if(has_capability('moodle/site:config', context_system::instance())) {
$bodyclasses[] = 'isadmin';
}
...
...
<body <?php echo $OUTPUT->body_attributes($bodyclasses); ?>>
Then your css can target the body class and selector as required, for example:
.isadmin header {background:red;}
You can obviously add other conditionals, with the appropriate context and capability to add css to courses specifically for teachers/students (or at least users with relevant capabilities for those roles) and so on
Note: if its definitely on the admin you want, you could just use is_siteadmin() in your conditional, but the capabilities is more flexible if you want to add other options
(Edited by Mary Evans - Removed ) in the above code - original submission Sunday, 16 July 2017, 6:07 PM)
Thanks Richard,
I'd been playing with is_siteadmin to little effect.
The above works code has an extras ) after
$bodyclasses[] = 'isadmin');that is not needed.
Many Thanks
Dave
Yep the extra ')' is a typo and is not needed! Thanks
Hi Richard,
The code you suggested seems to be working OK in Morecandy theme...thanks for the idea.
The header background, shown here in the Profile page (see below), only shows up for the Admin user wherever the bodyclass has-admin-candy is present.
Cool
Thanks
Cheers
Mary