# How to change menu icon in custom plugin?

**URL:** https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003
**Category:** Shopware 3.5
**Tags:** general
**Created:** [30. September 2015 um 11:48 UTC](https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003 "2015-09-30T11:48:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dbcoder](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@dbcoder](https://forum.shopware.com/u/dbcoder)
#### Post date: [30. September 2015 um 11:48 UTC](https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003/1 "2015-09-30T11:48:45Z")

</div>

Is there any possibility to extend backend theme and change menu icon in custom plugin?

---

<div class="post-metadata">

### Author: ![Maksim\_N](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@Maksim\_N](https://forum.shopware.com/u/Maksim_N)
#### Post date: [30. September 2015 um 13:16 UTC](https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003/2 "2015-09-30T13:16:54Z")

</div>

I have the same question. Currently, I picked up one of the preinstalled sets, but it looks not professionally 😉

---

<div class="post-metadata">

### Author: ![tiagojsag](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/tiagojsag/32/53_2.png) [@tiagojsag](https://forum.shopware.com/u/tiagojsag)
#### Post date: [30. September 2015 um 14:19 UTC](https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003/3 "2015-09-30T14:19:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dbcoder](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@dbcoder](https://forum.shopware.com/u/dbcoder)
#### Post date: [30. September 2015 um 23:55 UTC](https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003/4 "2015-09-30T23:55:40Z")

</div>

Which file should I extend? I have tried… [programmierung-f56/backend-eigene-plugin-css-datei-laden-t17882.html](http://forum.shopware.com/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...
```

---

<div class="post-metadata">

### Author: ![Maksim\_N](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@Maksim\_N](https://forum.shopware.com/u/Maksim_N)
#### Post date: [1. Oktober 2015 um 15:49 UTC](https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003/5 "2015-10-01T15:49:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Maksim\_N](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@Maksim\_N](https://forum.shopware.com/u/Maksim_N)
#### Post date: [15. Oktober 2015 um 10:53 UTC](https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003/6 "2015-10-15T10:53:57Z")

</div>

Hey guys, any update here?

---

<div class="post-metadata">

### Author: ![tarkka](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@tarkka](https://forum.shopware.com/u/tarkka)
#### Post date: [25. November 2015 um 11:10 UTC](https://forum.shopware.com/t/how-to-change-menu-icon-in-custom-plugin/31003/7 "2015-11-25T11:10:48Z")

</div>

Hello, Bootstrap.php `public function install() { &nbsp; &nbsp; $this-\>subscribeEvent( &nbsp; &nbsp; &nbsp; &nbsp; 'Enlight\_Controller\_Action\_PostDispatch\_Backend\_Index', &nbsp; &nbsp; &nbsp; &nbsp; 'addTemplateDir' &nbsp; &nbsp; ); } public function addTemplateDir(Enlight\_Event\_EventArgs $args) { &nbsp; &nbsp; /\*\* @var \Enlight\_Controller\_Action $controller \*/ &nbsp; &nbsp; $controller = $args-\>getSubject(); &nbsp;&nbsp;&nbsp; $view = $controller-\>View(); if ($view-\>hasTemplate()) { &nbsp;&nbsp;&nbsp; $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}`
