Change logo by CSS theme

Change logo by CSS theme

by Álvaro Martín Sancho -
Number of replies: 7

Hello;

I have cloned the theme klass to add it to different categories with different colours and logos.

Everything seems to work, and now i have klass1, klass2, klass3 in my themes manager:


And when i go to custom them also it seems to work.

In fact, the title is correct, and as i have tested the css works independently for each of the cloned versions.

My problem is the logo. In all cloned versions a have the logo added for the original klass theme.



I think this is because when you clone a theme, all the specific configurations must be included in the custom CSS, isn't it?

Could somebody help me about it?

How can I add the logo and perhaps the rest of things (as footer logo, footer information etc) within the Custom Css field?

Thank you very much!


Average of ratings: -
In reply to Álvaro Martín Sancho

Re: Change logo by CSS theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Difficult to see from the small screen shot.  When you clone a theme then you need to ensure that the setting names have the cloned theme frankenstyle prefix of the cloned theme too and that the file serving mechanism in lib.php etc. is also updated.

In reply to Gareth J Barnard

Re: Change logo by CSS theme

by Alvaro Martin -

Hello Gareth, and first of all thank you for your quick answer:

I am going to try to explain it better.

I have created a clon friem the theme klass following the instructions of a Moodle developer.

I think I've done all the concerning changes in the clone, also in the lib.php etc

In fact it works well and Moodle recognizes correctly the clones, and I can assign each of them to a different category and also customize them independently through the custom CSS  field.

As you can see in the enclosed document. (Figures 1 and 2)

When I change both custom css field they apply correctly to each of the themes (the original klass and the clone klass2)

However, when I change the logo (Above the custom css field), although I add a different logo for each theme, in the original theme and in the clone appears the same logo, the one I ve added to the original theme.

I think that when i followed the instruction to clone themes this way, (duplicating the theme and changing all the appropriate fields in the files), it was also indicated that using this methodology all the configurations in the cloned themes should be done though the field "custom CSS". 

So, as expected, if I change the logo in the cloned theme Klass2 (figures 3), it does not works, and when i select this cloned theme Klass2 it displays the logh added in the original theme (klass). (figure 4)

That is why I'm asking how I can add the logo for this cloned theme as an instruction in the Custom CSS field instead that using the field markel on figure 3.

I hope You can understand what I mind.

Thank you very much!!




In reply to Alvaro Martin

Re: Change logo by CSS theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, humm... have you changed the 'setting_file_serve' method call?  Could you post the cloned theme code please.

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: Change logo by CSS theme

by Alvaro Martin -

Thank you again!!! I can not add docuemnt bigger that 500 k to the forum, so here the lonks to dowload both, the original klass theme and the clone I made, klass2


https://drive.google.com/file/d/11GbOcMjN361OuXRK9AyOBLa283PVBfb1/view?usp=sharing

https://drive.google.com/file/d/1FinU2PTMKmzEq8LXM5wf_fYEywMnoOkA/view?usp=sharing

As you cans see in theses screeshots, i have tow categories, each one with a clone,  where the colours chanage very well but the logo is the same.



In reply to Alvaro Martin

Re: Change logo by CSS theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
In the 'klass2' function 'theme_klass2_pluginfile' in lib.php you're loading the wrong theme_config object instance as:

    if (empty($theme)) {
        $theme = theme_config::load('klass');
    }
should be:

    if (empty($theme)) {
        $theme = theme_config::load('klass2');
    }
In reply to Gareth J Barnard

Re: Change logo by CSS theme

by Alvaro Martin -
Thank you very much!

I really appreciate it.

Last question (i guess).

Must I change from klass to klass2 these elements as well? (highlighted in red)