how to change icon for activities or resource?
Number of replies: 11Moodle use default icon for forum, web pages, videos...
I'd like tho choice the icon fo a particular activities.
I mean I have a video on a web page so I'd like (only for this case) use a video icon and not a web_page icon.
How can I do that?
Thakyou in advance,
Onir.
Re: how to change icon for activities or resource?
Make sure you clear your cache or temp internet files after you have done it though. You can make a change like that and it does not appear because of the way in which Moodle uses its cache.
Re: how to change icon for activities or resource?
Just be sure to name the icons the same as Colin says.
Jon
Re: how to change icon for activities or resource?
I'm also interested in what I think was really the question here:
How to change the icon in one activity or resource - in stead of how to overwrite the icon for one type of activity or resource. Would be very nice to have this feature, as sometimes the same resource-activity have different content.
Any ideas?
TIA
Daniel
Re: how to change icon for activities or resource?
We have some staff who (with help from technically minded folk) create a label with a new custom icon and hyperlink to the page they need. Of course the custom icon is the same size as other Moodle icons. Below is the source code and the end results.
<a target="_blank" href="URLtowebsitegoeshere"><img src="URLofimagegoeshere" /> Words to be displayed for students goes here.</a>

Staff could also use insert image (if they know the URL of the image), type the text then select the entire link and add the relevant hyperlink.
Cheers
Teresa
Re: how to change icon for activities or resource?
The hacky way:
You can add inline css styles in a label to display your own icon. This will work only with this instance of your course and will break if the course is moved. I tested this in 1.9.5. I can't say if it would work in any other version. Steps
- Upload the image into your course. Copy the full url for future reference - eg
/file.php/11/my_icons/special.png
- On your course page open the page source (View> Page Source). Search for the name of your activity. The line above this should start with something like
<li class="activity quiz" id="module-21"...
Take note of the id, in this case id="module-21" - Use the Add a resource drop-down to Add a label. Switch to HTML edit mode and write the following into the label text, changing the id and image url as appropriate.
<style type="text/css">
li#module-21 {
padding-left:30px;
height:50px;
background:url(/file.php/11/my_icons/special.png) no-repeat left;
}
li#module-21 img.activityicon {
padding:20px;
visibility:hidden;
}
</style> - Notes: This works well with a 50px by 50px image, change the padding for other size images. Save a copy of the above code becuase when you come back and update the label, the style will get cleared.
Good luck
Re: how to change icon for activities or resource?
Re: how to change icon for activities or resource?
Hi Dave ,
You can replace your new icons with the existing one. Create new icon with similar size. Then go to moodle/mod/activityname/pix/ Keep it here and purge your moodle site cache.
Re: how to change icon for activities or resource?
Hello Sakshi,
My self Sandip patel from Baroda gujarat
I have do same thing which you have written in your post but its do not show new icon
can you please help me out...
Re: how to change icon for activities or resource?
Thats the right answer. Two years after, its still valid.
Re: how to change icon for activities or resource?
Re: how to change icon for activities or resource?
Read the fine manual: https://docs.moodle.org/dev/Using_images_in_a_theme#Overriding_plugin_images