Topic: How to customize the shortcut menus

How can I modify the items in the shortcuts menus?

This is the menu I am talking about:
https://www.dropbox.com/s/lt217my4siu8w … u.PNG?dl=0

Is that somehow part of the theme?

2 (edited by apmuthu 08/04/2016 12:18:52 pm)

Re: How to customize the shortcut menus

Whilst the look and feel are definitely part of the theme, the shortcuts are part of the string it shows for example in applications/customers.php which is the sales / order application tab:

class customers_app extends application 
{
    function customers_app() 
    {
        $this->application("orders", _($this->help_context = "&Sales"));
    
        $this->add_module(_("Transactions"));
        $this->add_lapp_function(0, _("Sales &Quotation Entry"),
            "sales/sales_order_entry.php?NewQuotation=Yes", 'SA_SALESQUOTE', MENU_TRANSACTION);
        $this->add_lapp_function(0, _("Sales &Order Entry"),
..
..

The character that succeeds "&" character in the strings above are the shortcuts. If the same character is there more than once in a page, it will cycle thru them on each choice.

Attached your file here.

Post's attachments

FAMenus.png 17.2 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: How to customize the shortcut menus

Thanks. What I wanted to modify is part of the theme actually.

If I want to modify the regular menu instead, I guess the best would be to write an Extensions, right?
Can you recommand a good guide for writing an extension? I only find bits and pieces of information here and there.

Re: How to customize the shortcut menus

Hi,

I managed to make a simple extension. However I have a question.

How can I customize this icon? https://www.dropbox.com/s/caa6xjk7v6h7bzs/FA%20modules%20icons.png?dl=0

It's probably related to the $icon parameter of the module constructor but I can't find any example.

Re: How to customize the shortcut menus

To modify the menus in your extension you need to implement the 'install_options' hook.  Here's an example from one of my extensions.

To see all the hooks that are available have a look in includes/hooks.inc in the core.

To modify the icon that you see relating to any menu item you need to do 2 things:

1. Specify the category when creating the menu item.  Each menu item is an instance of the app_function class.  Its constructor takes a $category.

2. The renderer class in the theme has a function that maps category to icon.  function get_icon($category).  You can then use this to map to the icon you want.

The icon image should be within the theme folder.

Cambell https://github.com/cambell-prince

Re: How to customize the shortcut menus

Thank you for your answer.

My theme (elegant) has hardcoded the icons based on the offset of the module.

 $imgs2 = array("folder.gif", "report.png", "page_edit.png", "money.png", "folder.gif"); 

I guess I'll have to modify the theme then.

Thanks again for your help.

7 (edited by apmuthu 08/28/2016 06:34:33 pm)

Re: How to customize the shortcut menus

The category is the last parameter (4th parameter) in the app_function class's get_icon() method. For the default standard theme, place the icon file $category.png in the theme's images folder.

Attached image referred to in 4th post here.

Post's attachments

menu_icon.png 37.8 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: How to customize the shortcut menus

Thanks. I got it working with the instructions from Cambell.