How to set image icon on sidebar of joomla component component

I want to set the icon in the sidebar of the component of the joomla component JHtmlSidebar :: addEntry (JText :: _ ('USERS'), 'index.php? Option = com_users & view = users', $ vName == 'users') is used to create this sidebar

enter image description here

+4
source share
3 answers

Finally, I got the answer to this question. Answer

JHtmlSidebar::addEntry('<span class="dashboard-submenuicon"></span>'.
            JText::_('Dashboard'),
            'index.php?option=com_mycomponent&view=dashboard',
            $vName == 'dashboard'
        );

We can write css code, for example

.dashboard-submenuicon{
           background-image:url('your_image_url');
            background-repeat: no-repeat;
            display: inline-block;
            height: 22px;
            vertical-align: middle;
            width: 22px;
            margin-right:5px;

}

+5
source

My original answer was for the menu, see below.

- css -. , href-tag css, :

/* For each item in the sidebar: */
a[href*="yourview"]{
  display: block; 
  padding: 0 0 0 20px;
  background: transparent url(link/to/img.png) 0 0 no-repeat;
}

, /layouts/joomla/sidebars/submenu.php html/layouts/joomla/sidebars/submenu.php , , . .

: , /administrator/components/com _componentname/componentname.xml, :

<administration>
  <menu img="link/to/icon.png" >COM_COMPONENTNAME</menu>
  <submenu>
    <menu link="option=com_componentname&amp;view=aview" view="aview"
    img="link/to/other-icon.png" alt="Componentname/Aview">
      COM_COMPONENTNAME_TITLE_AVIEW
    </menu>
  </submenu>
</administration>

( , ), css backend , . , isis-, joomla.

+2

CSS , . , . CSS, , .

, , Joomla 2.5 , .

0

Source: https://habr.com/ru/post/1627166/


All Articles