# How to Remove Icons in Moodle

This article is about removing Icons from the course formats page (when displaying the course page) for Moodle 1.7. The code referenced can be found at xref.moodle.org. The lack of a icon switch variable still exists in version 1.8 (found at [http://moodle.cvs.sourceforge.net/moodle/moodle/course/lib.php?view=markup](http://moodle.cvs.sourceforge.net/moodle/moodle/course/lib.php?view=markup) at line 1392).

The file being edited is course/lib.php and the function is print\_section().

The code for displaying the image is on lines 1163-1167:  
echo ‘&lt;img src="’.$icon.‘"’.  
’ class=“activityicon” alt=“‘.$mod-&gt;modfullname.’” /&gt;‘.  
’ &lt;a title="’.$mod-&gt;modfullname.‘" ’.$linkcss.’ ‘.$extra.  
’ href="’.$<span class="caps">CFG</span>-&gt;wwwroot.‘/mod/’.$mod-&gt;modname.‘/view.php?id=’.$mod-&gt;id.‘“&gt;’.  
 $instancename.‘&lt;/a&gt;’;

The definition for $icon is on lines 1142-1146:  
if (!empty($modinfo\[$modnumber\]-&gt;icon)) {  
$icon = “$<span class="caps">CFG</span>-&gt;pixpath/”.urldecode($modinfo\[$modnumber\]-&gt;icon);  
} else {  
$icon = “$<span class="caps">CFG</span>-&gt;modpixpath/$mod-&gt;modname/icon.gif”;  
}

One approach is to point $icon to a spacer image if icons are disabled. Although this loads an unecessary image, it is a simple a quick solution. In addition line 1149 already loads a spacer image with a function call to print\_spacer().

A search of the Moodle Forums resulted in a few related article that might be a better alternative than changing the php:

- [http://moodle.org/mod/forum/discuss.php?d=50708](http://moodle.org/mod/forum/discuss.php?d=50708)
- This describes how to resize the icons with <span class="caps">CSS</span>. It could potentially be used to remove the icons as well.

- [http://moodle.org/mod/forum/discuss.php?d=46350](http://moodle.org/mod/forum/discuss.php?d=46350)
- This describes how to remove icons in the “main menu” and “course menu”.

- [http://moodle.org/mod/forum/discuss.php?d=31095](http://moodle.org/mod/forum/discuss.php?d=31095)
- This hides the “key icon”. It proposes a transparent image.