Hello, i think like you: the official documentation is really not enough. But i can share with you (and future people searching about this) how i get it run
For example, in my module Ticket Plus to get this on the LEFT menu of the “Ticket” native module:
- a “title” element with icon: “HelpDesk”
- a “link” element: “Public Portal”
- a “link” element, under “Knowledge base” group (native module): “Searches with AI”
i have defined this code on the file /custom/ticketplus/core/modules/modTicketplus.class.php
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=ticket',
'type'=>'left',
'titre'=>'HelpDesk',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
'mainmenu'=>'ticket',
'leftmenu'=>'ticketplus',
'url'=>'',
'langs'=>'ticketplus@ticketplus',
'position'=>20,
'enabled'=>'1',
'perms'=>'',
'target'=>'',
'user'=>0);
$r++;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=ticket,fk_leftmenu=ticketplus',
'type'=>'left', // This is a Left menu entry
'titre'=>'ticketplusLeftMenu1',
'mainmenu'=>'ticket',
'leftmenu'=>'',
'url'=> $url,
'langs'=>'ticketplus@ticketplus',
'position'=>21,
'enabled'=>'1',
'perms'=>'',
'target'=>'',
'user'=>0);
$r++;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
'type'=>'left',
'titre'=>'ticketplusLeftMenu2',
'mainmenu'=>'ticket',
'leftmenu'=>'knowledgemanagement_list',
'url'=> '/ticketplus/article_search_list.php',
'langs'=>'ticketplus@ticketplus',
'position'=>113,
'enabled'=>'$conf->knowledgemanagement->enabled',
'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read',
'target'=>'',
'user'=>0);
Conclusions to be extracted:
'mainmenu'=>'ticket'
is used in all 3 elements to indicate tha they must appear when mainmenu=ticket
appears in the URL
'type'=>'left'
is used in all 3 elements to indicate that we want to render it on the left vertical panel, no at the top menu panel
- the attribute
leftmenu
is not very clear to me. I think that i can define here a non-existing value, and then it will serve as “anchor” where to hang/group other items, for example when the first element to use it is of type “title” (= no url defined). Or you can also define here an existing leftmenu
(like ‘leftmenu’=>‘knowledgemanagement_list’) to make define this element as a child of an existing one.
- once setted the previous points, then you must build the
fk_menu
attribute, as you said, something redundant: combining mainmenu
and leftmenu
values.
- regarding to TEXT TRANSLATIONS, take in account that if you are using your language module files then you must set this attribute:
'langs'=>'ticketplus@ticketplus'
(where “ticketplus” must be the main directory name of your module) and set this for element text: 'titre'=>'ticketplusLeftMenu1'
(where this is one of the text tags defined on your language files)
I hope this put more light on what to get it work in your case!
Cheers,
Sergi