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 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 ‘<img src="’.$icon.‘"’.
’ class=“activityicon” alt=“‘.$mod->modfullname.’” />‘.
’ <a title="’.$mod->modfullname.‘" ’.$linkcss.’ ‘.$extra.
’ href="’.$CFG->wwwroot.‘/mod/’.$mod->modname.‘/view.php?id=’.$mod->id.‘“>’.
$instancename.‘</a>’;

The definition for $icon is on lines 1142-1146:
if (!empty($modinfo[$modnumber]->icon)) {
$icon = “$CFG->pixpath/”.urldecode($modinfo[$modnumber]->icon);
} else {
$icon = “$CFG->modpixpath/$mod->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: