Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19077 Implement the theme engines proposal
  3. MDL-19690

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

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: 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.

        Attachments

          Activity

            People

            • Assignee:
              timhunt Tim Hunt
              Reporter:
              timhunt Tim Hunt
              Participants:
              Component watchers:
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10