View Issue Details

IDProjectCategoryView StatusLast Update
15476Bug reportsPluginspublic2019-10-29 16:25
ReporterDenisChenu Assigned To 
PrioritynoneSeverityminor 
Status newResolutionopen 
Product Version4.0.0-RC6 
Summary15476: beforeToolsMenuRender no usuable
Description

Using beforeToolsMenuRender to add a fixed element to menu didn't work.

Steps To Reproduce

Import included plugin
Code is here : https://gitlab.com/Sondages.Pro/organizeSurvey

But quick copy paste

<?php
class testPlugin extends PluginBase
{
    static protected $description = 'A test plugin';
    static protected $name = 'testPlugin';

    public function init()
    {
        $this->subscribe('beforeToolsMenuRender');
    }

    /**
     * see beforeToolsMenuRender event
     *
     * @return void
     */
    public function beforeToolsMenuRender()
    {
        $event = $this->getEvent();
        $surveyId = $event->get('surveyId');
        $oSurvey = Survey::model()->findByPk($surveyId);
        $aMenuItem = array(
            'label' => 'PLUGIN test',
            'iconClass' => 'fa fa-server',
            'href' => Yii::app()->createUrl(
                'admin/pluginhelper',
                array(
                    'sa' => 'sidebody',
                    'plugin' => get_class($this),
                    'method' => 'actionSettings',
                    'surveyId' => $surveyId
                )
            ),
        );
        $menuItem = new \LimeSurvey\Menu\MenuItem($aMenuItem);
        $event->append('menuItems', array($menuItem));

    }
}
Additional Information

Can add a menu element via the plugin , but have a fixed way to have menu item seems great … and need for a lot of plugins.

TagsNo tags attached.
Complete LimeSurvey version number (& build)4.0.0-RC6 git
I will donate to the project if issue is resolvedNo
Sync to Zoho Project
Browserff
Database & DB-Versionnot relevant?
Server OS (if known)not relevant ?
Webserver software & version (if known)not relevant ?
PHP Versionnot relevant ?

Activities

DenisChenu

DenisChenu

2019-10-29 16:23

developer  

organizeSurvey.zip (13,631 bytes)
DenisChenu

DenisChenu

2019-10-29 16:24

developer   ~54253

Last edited: 2019-10-29 16:25

View 2 revisions

[shnoulle@poledra application]$ grep -r 'beforeToolsMenuRender' *
[shnoulle@poledra application]$

Issue History

Date Modified Username Field Change
2019-10-29 16:23 DenisChenu New Issue
2019-10-29 16:23 DenisChenu File Added: organizeSurvey.zip
2019-10-29 16:23 DenisChenu Steps to Reproduce Updated View Revisions
2019-10-29 16:24 DenisChenu Note Added: 54253
2019-10-29 16:25 DenisChenu Note Edited: 54253 View Revisions