Maslosoft Framework Logo Maslosoft Framework Documentation
Flexible Application Foundation


Creating Icon for interacting with model for Smart Menu

Using SmartMenuModelAction

Model action icon type is designed to call controller action via JavaScript, using specified model. Action can be specified in short form, as it will be resolved according to @ModelRoute annotation on model.

This kind of icon will also check for permissions to action, and show icon only if action can be performed by currently authenticated user.

For the sake of this example, we will use current user model, and myAccount action:

Smart::fly()->add(SmartMenuModelAction::widget([
    'model' => WebUser::fly()->getModel(),
    'icon' => 'fa-user-circle-o',
    'action' => 'myAccount'
]));

To see icon from above example, You need to be authenticated.

Result can be checked by clicking icon on top of page. When clicked it will open account page.