Is there any possibility to extend backend theme and change menu icon in custom plugin?
I have the same question. Currently, I picked up one of the preinstalled sets, but it looks not professionally
Hi, If you want to set custom icons for your custom menu entries, you can specify a class when defining the menu item: $this-\>createMenuItem(array( 'label' =\> 'Your Label', 'controller' =\> 'YourControllerName', 'class' =\> 'your-custom-class', 'action' =\> 'Index', 'active' =\> 1, 'parent' =\> $this-\>Menu()-\>findOneBy(array('label' =\> 'Marketing')) ));
You then need to add the following template extension using the ‚Enlight_Controller_Action_PostDispatch_Backend_Index‘ event {block name="backend/base/header/css" append}<style type="text/css">
.icon--my-custom-icon {
background-image: url("path/to/your/icon-image.png");
}
</style>{/block}
This will be stored in the s_core_menu database table, along with all other menu entries, including the core menu entries. If you want to edit the core menu entry icons, you can manipulate that same table to change the associated CSS class. However, like any other change to any s_core table, this is neither officially supported nor advised. We cannot ensure that future core updates will not revert your change or simply not work as intended.
Which file should I extend? I have tried… programmierung-f56/backend-eigene-plugin-css-datei-laden-t17882.html with no any results… and when I extend header.tpl [code]{extends file=‘parent:backend/index/header.tpl’} {block name=“backend/index/header/css” append }
…
</style>{/block}[/code] and [code]public function onBackendIndexPostDispatch(Enlight\_Controller\_ActionEventArgs $args) { $view = $args-\>getSubject()-\>View(); $view-\>addTemplateDir($this-\>Path() . 'Views/'); $view-\>extendsTemplate('backend/index/header.tpl'); } [/code] This is not working.. I have thied with index/header.tpl and base/header.tpl Maybe is too late and my brain doesn't work :) and maybe I have forgotten about something...
Same result. Bootstrap.php public function install() { $this-\>subscribeEvent( 'Enlight\_Controller\_Action\_PostDispatchSecure\_Backend\_Index', 'addTemplateDir' ); } public function addTemplateDir(Enlight\_Event\_EventArgs $args) { /\*\* @var \Enlight\_Controller\_Action $controller \*/ $controller = $args-\>get('subject'); $view = $controller-\>View(); $view-\>addTemplateDir($this-\>Path() . '/Views/'); // or like this //$this-\>get('template')-\>addTemplateDir($this-\>Path() . '/Views/'); }
Views/backend/index/header.tpl {extends file="parent:backend/index/header.tpl"} {block name="backend/base/header/css" append} <style type="text/css">
.my-menu-icon {
background-image: url('some url');
}
</style>{/block}
And there is not extended HTML code. What am I doing not right? Thank you
Hey guys, any update here?
Hello, Bootstrap.php public function install() { $this-\>subscribeEvent( 'Enlight\_Controller\_Action\_PostDispatch\_Backend\_Index', 'addTemplateDir' ); } public function addTemplateDir(Enlight\_Event\_EventArgs $args) { /\*\* @var \Enlight\_Controller\_Action $controller \*/ $controller = $args-\>getSubject(); $view = $controller-\>View(); if ($view-\>hasTemplate()) { $view-\>addTemplateDir($this-\>Path() . 'Views/'); $view-\>extendsTemplate('backend/SwagCustomPlugin/menuitem.tpl'); } }
Views/backend/SwagCustomPlugin/menuitem.tpl {block name="backend/base/header/css" append} <style type="text/css">
.sprite-custom-menu {
background:url({link file="backend/SwagCustomPlugin/_resources/images/custom-menu-icon.png"}) no-repeat 0 0 !important;
}
</style>{/block}