← Back to team overview

mahara-contributors team mailing list archive

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

 

Public bug reported:

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);

** Affects: mahara
     Importance: Undecided
         Status: New

-- 
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: New

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);





Follow ups

References