Themes

 
 
Picture of Chris Clark
plugins_exclude_sheets help
 

Hey guys,

I am working on a custom theme for a 2.3 moodle build and i am attempting to have my theme ignore the scorm modules styles.css.

So far i have tried:

copying all the styling from /mods/scorm/styles.css into one of my themes .css files, on its own this does not over ride the default sheet.

however if i delete styles.css from /mod/scorm/ it works fine, although I do not want to this (need to leave original moodle 100% intact)

now I am attempting to exclude the /mod/scorm/styles.css with the use of the:
             $THEME->plugins_exclude_sheets

command, can anyone explain how to correctly use this? the only documentation I can find for it says  usage is:
                   
                $THEME->plugins_exclude_sheets('mod_modname');

Except this does seems to do nothign for me.

Any help at this point is greatly appreciated,

Cheers

 
Average of ratings: -
Picture of David Scotson
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers
I've not tried it yet but based on the code it seems to be looking for an array, so try:

$THEME-> plugins_exclude_sheets = array('mod_modname');

Looking further it seems like `true` should switch them all off:

$THEME-> plugins_exclude_sheets = true;

but currently I can't get either to work. I've actually been looking for a way to do this for a while and had no idea this feature existed so I'll keep trying and get back with any findings.

edit: okay the latter seems to be working now, though it didn't seem to at first.

 
Average of ratings: -
It's only an avatar...
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Testers

I think you need to follow the way we exclude parent stylesheets...


$THEME->plugins_exclude_sheets = array('quiz'=>array('styles'),'forum'=>array('styles') );


But not really sure as we have not had any help with this. I would need to track this down and find out what is expected.

Thanks for asking about this.

Mary

 
Average of ratings: -
Picture of David Scotson
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Yes, with your hint I took a second look at the code and got this to work:

$THEME->plugins_exclude_sheets = array('mod' => array('scorm'));
 

so if the CSS file is referenced as mod_book, or block_community you need to split on the first under_score. I'm all excited to go and see what Moodle looks like with no plugin CSS now.

 
Average of ratings: -
It's only an avatar...
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Testers

$THEME->plugins_exclude_sheets = array('mod' => array('quiz', 'forum'), 'block' => array('html'));

Is the correct way. smile

This is interesting so we can restyle stuff better! Yeah!

 
Average of ratings: -
Picture of Chris Clark
Re: plugins_exclude_sheets help
 

Hey David, Mary,

Thanks for the responses.

I now have: 

$THEME->plugins_exclude_sheets = array('mod' => array('scorm'));

In my themes config.php but /mod/scorm/styles.css is still loading before my themes compiled css sheet:

I have cleared the theme cache,  purged all caches and cleared everything from my browser and tried in a different browser.

Any suggestions as to what I may be missing?


 
Average of ratings: -
It's only an avatar...
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Testers

Perhaps we need to specifiy the stylesheet anyway...let's try this...let's face it we have nothing to lose! smile

$THEME->plugins_exclude_sheets = array('mod'=>array('scorm' =>array('styles')));

 
Average of ratings: -
Picture of Chris Clark
Re: plugins_exclude_sheets help
 

hmm actually after some more investigating.... I can confirm that:

$THEME->plugins_exclude_sheets = array('mod' => array('scorm'));

Definately does work....for /mod/scorm/view.php atleast

If you enter just the plugins_exclude_sheets line without copying the styles.css code into one of your themes .css files you can see that the 

.forcejavascript class is no longer styled with display:none on the page used to launch the scorm player.

If i leave the plugins_exclude_sheets line and then DO copy the code into one of my themes css files the .forcejavascript class is restyled to whatever I specify in there.

However once I actually launch the scorm player the default styles.css still seems to take precedence over my themes own styles.

EDIT: typos

 
Average of ratings: -
It's only an avatar...
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Testers

You should try turning on Theme Designer Mode in Theme settings

Then try testing again.

 
Average of ratings: -
Picture of Chris Clark
Re: plugins_exclude_sheets help
 

Theme designer is on

 
Average of ratings: -
Picture of David Scotson
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

You're right, it looks like a bug in the SCORM module, they've hardcoded a link to their style sheet:

So not only can't you opt out of that file, it won't be compiled and compressed with the other CSS that Moodle uses -- edit: actually it will as it's output twice, once in the compiled and compressed CSS, and once again on it's own.

(And while I'm on the subject, why is the original CSS layed out in a more compact for than the big CSS file. I would have assumed, if it it touched it at all then it would be compressing it, but it seems to be adding line endings semi-randomly, presumably to make it look nicer?)

 
Average of ratings: -
It's only an avatar...
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Testers

Which file is is hard coded in?

Also which CSS file/s are you talking about?

 
Average of ratings: -
Picture of David Scotson
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

When you actually launch the SCORM you're taken to "mod/scorm/player.php" and on line 193 of that it says

$PAGE->requires->css('/mod/scorm/styles.css')
 
 
Average of ratings: -
Picture of Amy Groshek
Re: plugins_exclude_sheets help
Group DevelopersGroup Particularly helpful MoodlersGroup Testers
Yeah, some of those styles might be required for proper functioning of dynamic elements... Many of the selectors include IDs, which makes them hard to override. But I would be careful doing away with that CSS without testing every single configuration of the SCORM activity settings. If that is really the only file in question, it's probably best to create a tracker issue for the SCORM mod and request a change, or at least verify that it's not a terrible idea, before proceeding? Obviously the file should not be loaded twice. And markup and selectors could certainly be revised to make for easier overrides.

 
Average of ratings: -
Picture of David Scotson
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers
Bug filed: MDL-37696
 
Average of ratings: -
Picture of Amy Groshek
Re: plugins_exclude_sheets help
Group DevelopersGroup Particularly helpful MoodlersGroup Testers
David, if you're seeing issues with the minification script then we should definitely have a tracker issue for that and get some folks looking at it.
 
Average of ratings: -
Picture of David Scotson
Re: plugins_exclude_sheets help
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers
edit: actually turns out this was me being stupid and getting two similarly named files mixed up. You can ignore the rest of this comment.

Initially it was just a bad feeling I had about it, as there's a heck of a lot of code there, that doesn't seem to be doing much but I did some poking around so here's the first bug:

https://tracker.moodle.org/browse/MDL-37695


 
Average of ratings: -