← Back to team overview

mahara-contributors team mailing list archive

[Bug 639636] Re: Hardcoded check for image block if a custom plugin specifies any blocktype, preventing installation + fix

 

** Changed in: mahara
       Status: New => Fix Committed

** Changed in: mahara
   Importance: Undecided => Low

** Changed in: mahara
    Milestone: None => 1.4.0

-- 
Hardcoded check for image block if a custom plugin specifies any blocktype, preventing installation + fix
https://bugs.launchpad.net/bugs/639636
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.

Status in Mahara ePortfolio: Fix Committed

Bug description:
I'm coding a new artefact plugin and I've found that if I specify anything at all in the get_block_types() function of the main artefact class, installation fails because I haven't got class PluginBlocktypeImage available. 

This comes from a loop in artefact_check_plugin_sanity()  (/artefact/lib.php around line 1150), which reads

foreach ($types as $type) {
        $pluginclassname = generate_class_name('blocktype', 'image');

        // other stuff that's not relevant up to line 1168

        if (!class_exists($pluginclassname)) {
            throw new InstallationException(get_string('classmissing', 'error', $pluginclassname, $type, $pluginname));
        }
}

The plugin class name needs to generated dynamically:

$pluginclassname = generate_class_name('blocktype', $type);





References