[HOW-TO] Add 2.4 course format callbacks

[HOW-TO] Add 2.4 course format callbacks

door Danny Wahl -
Aantal antwoorden: 1

Hi all, if you look at the pull-request commit for MDL-26048 you'll see how to add course format callbacks to a 2.4 theme - which is easy.

What I want to show you is how to add the 2.4 callbacks for ALL themes, it's pretty easy, we just use the same method_exists() check that we use with 2.1 vs. 2.2 for main_content()

see it at github (look at header.php)

basically it does this: checks to see if Moodle "knows" about various output objects, if it does, it stores them to a variable, if it doesn't - then it stores NULL to the variable, then later outputs whatever's in the variable.

Now you don't need to store different branches in your theme or drop development support for different versions of Moodle.

Gemiddelde van de beoordelingen: Useful (1)
Als antwoord op Danny Wahl

Re: [HOW-TO] Add 2.4 course format callbacks

door Richard Oelmann -
Foto van Core developers Foto van Plugin developers Foto van Testers

Hi Danny - thanks for that. Will add it to krystle before I release it (hopefully later today)

One thing - I think the tracker reference should be MDL-36048 glimlach

Rich

Gemiddelde van de beoordelingen:  -