Add css class to _all_ pages

Re: Add css class to _all_ pages

by Dennis Felix -
Number of replies: 0
Hi, I looked for the string "_init" in all subfolders of theme/ but got 0 results. When I search for "init" without the leading underscore I get a lot of hits for words like "initial" etc. in several unrelated files. If the function is non-existing you said I could add it, but unfortunately I don't know what to put in the function. The topic you linked only has snippets of code and not the whole function.

I am using Fordson with Boost preset.

Kind regards


edit: I have used the suggestion of Preben Pedersen and looked for the body_attributes.

:~./www/theme/fordson$ grep -r -n "body_attributes" .
    /layout/frontpage.php:47:$bodyattributes = $OUTPUT->body_attributes($extraclasses);
    ./layout/login.php:27:$bodyattributes = $OUTPUT->body_attributes();
    ./layout/course.php:40:$bodyattributes = $OUTPUT->body_attributes($extraclasses);
    ./layout/columns2.php:40:$bodyattributes = $OUTPUT->body_attributes($extraclasses);
    ./layout/mydashboard.php:47:$bodyattributes = $OUTPUT->body_attributes($extraclasses);
Then made the changes there by adding it to the $extraclasses array.

$extraclasses = [];
if ($navdraweropen) {
    $extraclasses[] = 'drawer-open-left';
}
array_push($extraclasses, 'notranslate');

I just tested it and works great. Now students who are learning a new language can no longer have the course page be translated by Google Chrome anymore.