Replace inside custom theme some icons on book module

Replace inside custom theme some icons on book module

by Gilles-Philippe Leblanc -
Number of replies: 2

Hello,

I wish I could replace the following icons using the usual method via a custom theme for these icons, but the module book, it does not work.

Here are the icons in question:
* mod\book\tool\print\pix\book.png
* mod\book\tool\print\pix\chapter.png


In the code, the icon is called:
{code}
new pix_icon('book', '', 'booktool_print', array('class'=>'icon')));
{code}


So I thought that by placing an icon in the following directories in my custom theme, it would work but it's not the case:
* theme\mytheme\pix_plugins\mod\booktool_print\book.png
* theme\mytheme\pix_plugins\mod\book\tool_print\book.png
* theme\mytheme\pix_plugins\mod\book\tool\print\book.png


Could someone tell me how to replace the icon without replacing those directly in the module book?

If not, maybe we should move these icon location to be directly in the following directory:
* mod\book\pix\

instead of:
* mod\book\tool\print\pix

Average of ratings: -
In reply to Gilles-Philippe Leblanc

Re: Replace inside custom theme some icons on book module

by Sam Hemelryk -
Hi Gilles-Philippe,

It is possible to override the images from within a theme.
You can do so in the following way:

// Original path
mod/book/tool/print/pix/book.png

// Path in theme
theme/mytheme/pix_plugins/booktool/print/book.png


When looking for an overriding image the following path is used.

1. theme (static)
2. themename => mytheme
3. area => pix_plugins for plugin images, pix_core for core images, pix for theme images.
4. plugin type => booktool
5. plugin name => print
6. file name => book

It then searches for the image with the following extensions gif, png, jpg, jpeg in that order.

Hope this helps.
Its not always the easiest thing to work out, I myself had to look at code to remind myself how it all worked.
As such I've updated http://docs.moodle.org/dev/Themes_2.0_How_to_use_images_within_your_theme#Overriding_plugin_images with this information as well.

Cheers
Sam


Average of ratings: Useful (3)
In reply to Sam Hemelryk

Re: Replace inside custom theme some icons on book module

by Gilles-Philippe Leblanc -

Thank you, it works! I would have really searched long for it.
Thank you also for the link to the documentation. I'll keep it for future reference.