mbischof / LimeSurvey

The most popular FOSS online survey tool on the web.
https://www.limesurvey.org
Other
0 stars 0 forks source link

Preloading the PluginManager Component enables you to address Yii Modules #3

Open mbischof opened 5 years ago

mbischof commented 5 years ago

in your application/config/config.php add the following line:

'preload' => array('pluginManager'),

then it is possible to place a yii module in your plugin:

class TestModule extends PluginBase
{
    static protected $description = 'TestModule Plugin';
    static protected $name = 'TestModule';

    protected $storage = 'DbStorage';

    /**
     * subscribe to all events
     */
    public function init()
    {
        $this->subscribe('afterPluginLoad');
    }

    public function afterPluginLoad()
    {
        Yii:app()->setModules(array(
            'report' => array(
                'class' => 'webroot.plugins.TestModule.report.ReportModule',
            )
        ), true);
    }

}

now, after activating the plugin, you can call: http://limesurvey/index.php/report/module/index

TestModule.zip

mbischof commented 5 years ago

this does not work, if the preload is declared in application/config/internal.php because installation process fails due to a CDbConnection Exception