Note that there are some explanatory texts on larger screens.

plurals
  1. POmagento : show image before xml elements
    text
    copied!<p>I am creating magento admin module. Basically I want to show an image(icon) before the title of that module.</p> <p>I want to achieve like this <img src="https://i.stack.imgur.com/CoHHO.png" alt="enter image description here"> </p> <p>I have tried with following code but no luck :(</p> <pre><code>&lt;title&gt;&lt;![CDATA[&lt;img src="media/icon.png"/&gt;]]&gt;Title&lt;/title&gt; </code></pre> <p>which outputs like this <img src="https://i.stack.imgur.com/DBjdv.png" alt="enter image description here"></p> <p>----------edit ----- </p> <p>I tried to rewrite Adminhtml_Block_Page_Menu but no success</p> <pre><code>public function getMenuLevel($menu, $level = 0) { $html = '&lt;ul ' . (!$level ? 'id="nav"' : '') . '&gt;' . PHP_EOL; foreach ($menu as $index =&gt; $item) { $html .= '&lt;li ' . (!empty($item['children']) ? 'onmouseover="Element.addClassName(this,\'over\')" ' . 'onmouseout="Element.removeClassName(this,\'over\')"' : '') . ' class="' . (!$level &amp;&amp; !empty($item['active']) ? ' active' : '') . ' ' . (!empty($item['children']) ? ' parent' : '') . (!empty($level) &amp;&amp; !empty($item['last']) ? ' last' : '') . ' level' . $level . '"&gt; &lt;a href="' . $item['url'] . '" ' . (!empty($item['title']) ? 'title="' . $item['title'] . '"' : '') . ' ' . (!empty($item['click']) ? 'onclick="' . $item['click'] . '"' : '') . ' class="' . ($level === 0 &amp;&amp; !empty($item['active']) ? 'active' : '') . '"&gt;' ////////////edits . ($index == 'modulename' ? $item['label'] : '&lt;span&gt;' . $this-&gt;escapeHtml($item['label']) . '&lt;/span&gt;&lt;/a&gt;' . PHP_EOL; if (!empty($item['children'])) { $html .= $this-&gt;getMenuLevel($item['children'], $level + 1); } $html .= '&lt;/li&gt;' . PHP_EOL; } $html .= '&lt;/ul&gt;' . PHP_EOL; return $html; } </code></pre> <p>here is config.xml menu part</p> <pre><code> &lt;adminhtml&gt; &lt;menu&gt; &lt;company module="modulename" translate="title"&gt; &lt;title&gt;&lt;![CDATA[&lt;span class="module-icon"&gt;Company&lt;/span&gt;]]&gt;&lt;/title&gt; &lt;sort_order&gt;71&lt;/sort_order&gt; &lt;children&gt; &lt;modulename translate="title" module="modulename"&gt; &lt;title&gt;Theme Options&lt;/title&gt; &lt;sort_order&gt;0&lt;/sort_order&gt; &lt;children&gt; &lt;configuration&gt; &lt;title&gt;Configuration&lt;/title&gt; &lt;sort_order&gt;1&lt;/sort_order&gt; &lt;action&gt;adminhtml/system_config/edit/section/modulename&lt;/action&gt; &lt;/configuration&gt; &lt;/children&gt; &lt;/modulename&gt; &lt;/children&gt; &lt;/company&gt; &lt;/menu&gt; &lt;/adminhtml&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload