Admin menu

Combination new and old way
on Thursday 12 September 2019
comments: 0

Old plugins way:

file admin_menu.php

and there something like this:

show_admin_menu(_CLANWARS, $action, $var);

New way:

class clanwars_adminArea extends e_admin_dispatcher
{

...

protected $adminMenu = array(
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'), 
);

...

}

If there is useless to override all plugin and you need to replace just some its parts:

in new file: 

add to class clanwars_adminArea

public function renderMenu() {
include_lan(e_PLUGIN.'clanwars/admin_menu.php');
show_admin_menu(_CLANWARS, $action, $var);
}

in old admin_menu change e_SELF to file name

$var['Mail']['text'] = _WWARSMAIL;
$var['Mail']['link'] = "admin_old.php?Mail";
$var['Prefs']['text'] = "Prefs";
$var['Prefs']['link'] = "admin_prefs.php";

This way you have the same menu for new and old parts and you can replace old parts by little steps, not everything at once.