do not use callHook() because the return value of the last hook must be passed to the next hook

This commit is contained in:
Uwe Steinmann 2022-07-07 16:47:21 +02:00
parent 53db4c2d3a
commit fac375a371
2 changed files with 100 additions and 30 deletions

View File

@ -693,9 +693,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['index_folder'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Indexer.php?folderid=". $folderID."&showtree=".showtree(), 'label'=>getMLText('index_folder'));
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('folderNavigationBar'))
$menuitems = $this->callHook('folderNavigationBar', $folder, $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'folderNavigationBar')) {
$menuitems = $hookObj->folderNavigationBar($this, $folder, $menuitems);
}
}
self::showNavigationBar($menuitems);
@ -789,9 +796,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['groups'] = array('link'=>$this->params['settings']->_httpRoot."out/out.GroupView.php", 'label'=>getMLText('groups'));
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('accountNavigationBar'))
$menuitems = $this->callHook('accountNavigationBar', $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'accountNavigationBar')) {
$menuitems = $hookObj->accountNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
@ -819,9 +833,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['workflow_summary'] = array('link'=>$this->params['settings']->_httpRoot."out/out.WorkflowSummary.php", 'label'=>getMLText('workflow_summary'));
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('mydocumentsNavigationBar'))
$menuitems = $this->callHook('mydocumentsNavigationBar', $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'mydocumentsNavigationBar')) {
$menuitems = $hookObj->mydocumentsNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
@ -908,9 +929,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['misc']['children']['version_info'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Info.php", 'label'=>getMLText('version_info'));
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('admintoolsNavigationBar'))
$menuitems = $this->callHook('admintoolsNavigationBar', $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'admintoolsNavigationBar')) {
$menuitems = $hookObj->admintoolsNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
@ -944,9 +972,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
if (!$this->params['user']->isGuest())
$menuitems['addevent'] = array('link'=>$this->params['settings']->_httpRoot."out/out.AddEvent.php", 'label'=>getMLText('add_event'));
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('calendarNavigationBar'))
$menuitems = $this->callHook('calendarNavigationBar', $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'calendarNavigationBar')) {
$menuitems = $hookObj->calendarNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);

View File

@ -694,9 +694,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['index_folder'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Indexer.php?folderid=". $folderID."&showtree=".showtree(), 'label'=>getMLText('index_folder'));
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('folderNavigationBar'))
$menuitems = $this->callHook('folderNavigationBar', $folder, $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'folderNavigationBar')) {
$menuitems = $hookObj->folderNavigationBar($this, $folder, $menuitems);
}
}
self::showNavigationBar($menuitems);
} /* }}} */
@ -782,9 +789,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['groups'] = array('link'=>$this->params['settings']->_httpRoot."out/out.GroupView.php", 'label'=>getMLText('groups'));
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('accountNavigationBar'))
$menuitems = $this->callHook('accountNavigationBar', $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'accountNavigationBar')) {
$menuitems = $hookObj->accountNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
@ -808,9 +822,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['workflow_summary'] = array('link'=>$this->params['settings']->_httpRoot."out/out.WorkflowSummary.php", 'label'=>getMLText('workflow_summary'));
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('mydocumentsNavigationBar'))
$menuitems = $this->callHook('mydocumentsNavigationBar', $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'mydocumentsNavigationBar')) {
$menuitems = $hookObj->mydocumentsNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
@ -894,9 +915,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['misc']['children']['version_info'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Info.php", 'label'=>getMLText('version_info'));
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('admintoolsNavigationBar'))
$menuitems = $this->callHook('admintoolsNavigationBar', $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'admintoolsNavigationBar')) {
$menuitems = $hookObj->admintoolsNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
@ -927,9 +955,16 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
if (!$this->params['user']->isGuest())
$menuitems['addevent'] = array('link'=>$this->params['settings']->_httpRoot."out/out.AddEvent.php", 'label'=>getMLText('add_event'));
/* Check if hook exists because otherwise callHook() will override $menuitems */
if($this->hasHook('calendarNavigationBar'))
$menuitems = $this->callHook('calendarNavigationBar', $menuitems);
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'calendarNavigationBar')) {
$menuitems = $hookObj->calendarNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);