mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
passes the menu as a reference to the on Events instead of using a callback function
This commit is contained in:
@@ -249,6 +249,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
// Addons Menu Logic
|
// Addons Menu Logic
|
||||||
// ##########################################################################################
|
// ##########################################################################################
|
||||||
$params = [
|
$params = [
|
||||||
|
'user'=>$user,
|
||||||
'lvid'=>$lvid,
|
'lvid'=>$lvid,
|
||||||
'studiensemester_kurzbz'=>$studiensemester_kurzbz,
|
'studiensemester_kurzbz'=>$studiensemester_kurzbz,
|
||||||
'studiengang_kz'=>$studiengang_kz,
|
'studiengang_kz'=>$studiengang_kz,
|
||||||
@@ -264,10 +265,8 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
|
|
||||||
Events::trigger('lvMenuBuild',
|
Events::trigger('lvMenuBuild',
|
||||||
// callback function for the onEvents to add newValues to the $menu
|
// callback function for the onEvents to add newValues to the $menu
|
||||||
function ($addonMenu) use (&$menu) {
|
function & () use (&$menu) {
|
||||||
foreach($addonMenu as $m){
|
return $menu;
|
||||||
$menu[]= $m;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
$params
|
$params
|
||||||
);
|
);
|
||||||
@@ -276,21 +275,15 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
// Menu sortieren
|
// Menu sortieren
|
||||||
// ##########################################################################################
|
// ##########################################################################################
|
||||||
foreach ($menu as $key => $row){
|
foreach ($menu as $key => $row){
|
||||||
if(isset($row['position'])){
|
$pos[$key] = $row['position'];
|
||||||
$pos[$key] = $row['position'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sortable_menu = array_filter($menu, function($element){
|
array_multisort($pos, SORT_ASC, SORT_NUMERIC, $menu);
|
||||||
return isset($element['position']);
|
|
||||||
});
|
|
||||||
|
|
||||||
array_multisort($pos, SORT_ASC, SORT_NUMERIC, $sortable_menu);
|
|
||||||
|
|
||||||
// HTTP response
|
// HTTP response
|
||||||
// ##########################################################################################
|
// ##########################################################################################
|
||||||
|
|
||||||
$this->terminateWithSuccess($sortable_menu);
|
$this->terminateWithSuccess($menu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user