Silverstripe 4.6 ModelAdmin 动态 $menu_Title
Silverstripe 4.6 ModelAdmin dynamic $menu_Title
是否可以将 ModelAdmins $menu_Title 动态更改为
例如
成员::currentUser()->姓名 ?
怎么样?
谢谢
好的。我知道了。
<?php
use SilverStripe\Admin\ModelAdmin;
//...
//...
class UserAdmin extends ModelAdmin
{
private static $managed_models = array(
'YourDataObject'
);
private static $url_segment = 'test';
private static $menu_title = 'Test';
private static $menu_icon_class = 'fa fa-pagelines';
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
//.......
//.......
return $form;
}
public static function menu_title($class = null, $localise = true){
//return 'YOUR MENU TITLE';
return Member::currentUser()->Name;
}
}
是否可以将 ModelAdmins $menu_Title 动态更改为 例如
成员::currentUser()->姓名 ?
怎么样? 谢谢
好的。我知道了。
<?php
use SilverStripe\Admin\ModelAdmin;
//...
//...
class UserAdmin extends ModelAdmin
{
private static $managed_models = array(
'YourDataObject'
);
private static $url_segment = 'test';
private static $menu_title = 'Test';
private static $menu_icon_class = 'fa fa-pagelines';
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
//.......
//.......
return $form;
}
public static function menu_title($class = null, $localise = true){
//return 'YOUR MENU TITLE';
return Member::currentUser()->Name;
}
}