Yii2Panel was designed to make boards that display different panels from different modules/extensions with access rights control.
Meeting better as expected, as the Yii2Panel can be used for displaying panel from any other module/extension with access control.
Another benefit is that the panels to be displayed are assigned to a module configuration that allows different panels to be used in the module for different projects.
Realisation
Simply dashboard solution. Each dashboard panel define as panel controller action identically as Yii page:
- panel controller in behaviors can control access - panel display only for users, who has access;
- panel controller controller action for creating HTML or response;
- create view folder in same folder, where all module controller views;
- for displaying add PanelWidget like anchor in view file;
- in module config for PanelWidget set one or more panels as Yii routes with parameters to panel controller;
Sequence
- PanelWidget get panel list from module configuration
- PanelWidget call panel controller action with parameters
- Panel controller validate access. If no access, return empty string
- panel controller action create response HTML
- PanelWidget output response HTML