Moodle

Replace $CFG->pixpath with an $OUTPUT->icon_url_old($icon, $module);

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Libraries
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

We are having problems with $CFG->pixpath in HEAD>

To start with, it is a nasty global variables hack.

But the problem is that you cannot set up $CFG->pixpath until the theme is known. But the theme is only know after a variety of other things are done and it is hard to predict when that is.

However, we do currently have clever code to initialise $OUTPUT the first time it is used.

Old code that used the string "$CFG->modpixpath/$cm->modname/icon.gif" should be updated to $OUTPUT->mod_icon_url('icon', $cm->modname);

Old code that used the string "$CFG->pixpath/i/settings.gif" should be updated to $OUTPUT->old_icon_url('i/settings');

The reason for the slightly ugly function names is what we are planning (http://moodle.org/mod/forum/discuss.php?d=126543) to change the default icon-set in Moodle. When that happens we will probably adopt new names for all the icons. At that point, I propose that we move to a function $OUTPUT->icon_url($icon, $module); where $module is like the same argument to get_string. That is, we let all types of plugins supply their own icons in future, not just modules.

Note that the API does not include the file extension. We should not hard-code this. Instead themes should be able to choose png or gif.

Also, eventually, icon_url should do a search of theme, parent theme, standard theme, like smartpix.php does.

Activity

Hide
Tim Hunt added a comment -

Add some relevant watchers.

Show
Tim Hunt added a comment - Add some relevant watchers.
Hide
Petr Škoda (skodak) added a comment -

Just one note, it might be better to call it "component" instead of "module".

Does this include the require_login() changes too?

Show
Petr Škoda (skodak) added a comment - Just one note, it might be better to call it "component" instead of "module". Does this include the require_login() changes too?
Hide
Tim Hunt added a comment -

Yay!

Show
Tim Hunt added a comment - Yay!

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: