thecommonthread
thecommonthread

Reputation: 405

Add a quick icon in Joomla 3

Anyone know how to add a quick icon or maybe even edit the current list of quick icons in Joomla 3.1? To be more specific, that would be the series of links that appear on the right side of the screen immediately after logging in to Joomla admin. I searched and couldn't find this question on stackoverflow.

Upvotes: 3

Views: 8056

Answers (4)

Gunjan Patel
Gunjan Patel

Reputation: 144

Quickicons can be added easily using plugin in Joomla 3.x and Joomla 2.5

This plugins can be used as an example https://github.com/joomla/joomla-cms/tree/staging/plugins/quickicon/joomlaupdate

Upvotes: 1

Farahmand
Farahmand

Reputation: 2991

Here is the standard solution:

Copy the file default.php from

/administrator/modules/mod_quickicon/tmpl/

to

/administrator/templates/YOUR_CURRENT_ADMIN_TEMPLATE/html/mod_quickicon/

and open the copied file. Replace this line

$html = JHtml::_('links.linksgroups', ModQuickIconHelper::groupButtons($buttons));

with these lines:

$myLinks = array(
    'COM_YOUR_COMPONENT_QUICKICON_YOUR_GROUP' => array(
        array(
            'link' => JRoute::_('index.php?option=com_YOUR_COMPONENT'),
            'image' => 'pictures',
            'icon' => 'header/icon-48-article-add.png',
            'text' => JText::_('COM_YOUR_COMPONENT_QUICKICON_YOUR_ITEM'),
            'access' => array('core.manage', 'com_YOUR_COMPONENT'),
            'group' => 'COM_YOUR_COMPONENT_QUICKICON_YOUR_GROUP'
        ),
    )
);

$array = ModQuickIconHelper::groupButtons($buttons);
$array = array_merge($myLinks, $array);

$html = JHtml::_('links.linksgroups', $array);

For languages, use overrides like this:

/administrator/language/overrides/en-GB.override.ini

Upvotes: 4

Craig
Craig

Reputation: 9330

QuickIcon's are actually a plug-in.

If you go to Extensions->Plug-in Manager->Plug-ins and select quickicon from the Type filter menu on the left you will see the any QuickIcon plugins you have installed. The default plug-ins are for Update Notifications (one for Joomla and another for Extensions).

If you are creating on as a simple short-cut to existing functionality then you're best of using one of the QuickIcon extensions on the Joomla Extension Directory that do that already. If you're wanting to create a QuickIcon for a custom component you're creating you will need to create your own plug-in.

You can read about Plug-ins here, note that for 3.x there isn't much difference from 2.5.x plugins.

A QuickIcon plug-in consists of several files:

  1. pluginname.php
  2. pluginname.xml
  3. various media files (images, css, js)

While the #3 is optional most plugins will use one or more of them.

If you're going to create your own plug-in I would start by looking at the two notification QuickIcon plugins that ship with Joomla 3.x. You can find them in the /plugins/quickicon/ directory with corresponding media in /media/plg_quickicon_*. As they ship with the core their CSS is in the admin templates CSS' e.g. if you using Isis you will find it in /administrator/templates/isis/css/template.css

Upvotes: 5

Lodder
Lodder

Reputation: 19743

If you go to the following file:

administrator/modules/mod_quickicon/helper.php

You will see on the start of line 51, arrays such as the following:

array(
    'link' => JRoute::_('index.php?option=com_content&task=article.add'),
    'image' => 'file-add',
    'icon' => 'header/icon-48-article-add.png',
    'text' => JText::_('MOD_QUICKICON_ADD_NEW_ARTICLE'),
    'access' => array('core.manage', 'com_content', 'core.create', 'com_content', )
)
  • Line 1, is the link.
  • Line 2, go to media/jui/css/icomoon.css to see what is available.
  • Line 3, I'm not actually too sure about but will update when I do.
  • Line 4, is the text such as Add New Article, but as you can see above, it's a language string
  • Line 5 is the text you see such as "Add New Article", but in the code above, it's a language string

Hope this helps

Upvotes: 4

Related Questions