Use October's AJAX-Framework Extras in the Backend
2
To use the {% framework extras %}
in your backend you have to include the CSS and JS files in your Controller.
class YourController extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
'Backend.Behaviors.ListController',
];
public $formConfig = 'config_form.yaml';
public $listConfig = 'config_list.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('YourVendor.YourPlugin', 'your-main-menu', 'your-sub-menu');
// Include framework extras.
$this->addJs('/modules/system/assets/js/framework.extras.js');
$this->addCss('/modules/system/assets/css/framework.extras.css');
}
If you don't need the extras on every page the Controller handles, you can of course also add them to the update
or create
method only.
If you need the extras on every page in the backend, you can add the JS file and CSS file by using events. Add the following code to the boot
method of your Plugin.php
file.
Event::listen('backend.page.beforeDisplay', function ($controller, $action, $params) {
$controller->addJs('/modules/system/assets/js/framework.extras.js');
$controller->addCss('/modules/system/assets/css/framework.extras.css');
});
There are no comments yet
Be the first one to comment