View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
15476Bug reportsPluginspublic2022-05-05 18:52
ReporterDenisChenu Assigned ToDenisChenu  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
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.
Attached Files
organizeSurvey.zip (13,631 bytes)
Bug heat2
Complete LimeSurvey version number (& build)4.0.0-RC6 git
I will donate to the project if issue is resolvedNo
Browserff
Database type & versionnot relevant?
Server OS (if known)not relevant ?
Webserver software & version (if known)not relevant ?
PHP Versionnot relevant ?

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2019-10-29 16:24

developer   ~54253

Last edited: 2019-10-29 16:25

[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
2019-10-29 16:24 DenisChenu Note Added: 54253
2019-10-29 16:25 DenisChenu Note Edited: 54253
2022-05-05 18:52 DenisChenu Assigned To => DenisChenu
2022-05-05 18:52 DenisChenu Status new => closed
2022-05-05 18:52 DenisChenu Resolution open => fixed