Skip to content

Commit

Permalink
New feature: New event beforeSideMenuRender to put custom HTML in sid…
Browse files Browse the repository at this point in the history
…e-menu
  • Loading branch information
olleharstedt committed Aug 23, 2016
1 parent 35deb0c commit 3bbc6bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion application/core/Survey_Common_Action.php
Expand Up @@ -957,6 +957,7 @@ function _surveysidemenu($aData)
}
}
$aData['quickmenu'] = $this->renderQuickmenu($aData);
$aData['beforeSideMenuRender'] = $this->beforeSideMenuRender($aData);
$aData['aGroups'] = $aGroups;
$aData['surveycontent'] = Permission::model()->hasSurveyPermission($aData['surveyid'], 'surveycontent', 'read');
$aData['surveycontentupdate'] = Permission::model()->hasSurveyPermission($aData['surveyid'], 'surveycontent', 'update');
Expand Down Expand Up @@ -999,7 +1000,6 @@ protected function renderQuickmenu(array $aData)

$aData['quickMenuItems'] = $quickMenuItems;


if ($aData['quickMenuItems'] === null)
{
$aData['quickMenuItems'] = array();
Expand All @@ -1009,6 +1009,18 @@ protected function renderQuickmenu(array $aData)
return $html;
}

/**
* Returns content from event beforeSideMenuRender
* @return string
*/
protected function beforeSideMenuRender(array $aData)
{
$event = new PluginEvent('beforeSideMenuRender', $this);
$event->set('aData', $aData);
$result = App()->getPluginManager()->dispatchEvent($event);
return $result->get('html');
}

/**
* listquestion groups
*/
Expand Down
2 changes: 2 additions & 0 deletions application/views/admin/super/sidemenu.php
Expand Up @@ -182,6 +182,8 @@ class="absolute-wrapper hidden-xs"
<?php eT("Return to survey list");?>
</a>
</li>

<?php echo $beforeSideMenuRender; ?>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
Expand Down

0 comments on commit 3bbc6bd

Please sign in to comment.