Developer Area/Plugin migration between Mahara 1.3 and 1.4
From Mahara Wiki
< Developer Area
Mahara 1.4 has some changes to the menu bars.
The table below has examples of some code differences required for plugins in Mahara 1.3 and Mahara 1.4.
This may help anyone upgrading a plugin to work in Mahara 1.4 or backport a plugin to Mahara 1.3
It is not comprehensive. Feel free to add further examples
This table outlines some
Plugin | File | Mahara 1.3 | Mahara 1.4 |
---|---|---|---|
blocktype
/externalfeed |
lib.php |
public static function get_categories() { return array('feeds'); } |
public static function get_categories() { return array('external'); } |
blocktype
/externalvideo |
lib.php |
public static function get_categories() { return array('fileimagevideo'); } |
public static function get_categories() { return array('external'); } |
artefact
/plans |
lib.php |
public static function menu_items() { return array( array( 'path' => 'myportfolio/plans', 'url' => 'artefact/plans/', 'title' => get_string('myplans', 'artefact.plans'), 'weight' => 40, ), ); } |
public static function menu_items() { return array( 'content/plans' => array( 'path' => 'content/plans', 'url' => 'artefact/plans/', 'title' => get_string('Plans', 'artefact.plans'), 'weight' => 60, ), ); } |
artefact/plans |
index.php new.php plan.php |
define('MENUITEM', 'myportfolio/plans'); |
define('MENUITEM', 'content/plans'); |
In some cases, it may be worth considering conditional statements to enable a plugin to work with either Mahara 1.3 or 1.4. For example
public static function get_categories() { require_once(get_config('libroot') . 'version.php'); $release = $config->release; if ($release < 1.4) { return array('feeds'); } return array('external'); }