439
edits
(→To add your own tab: added explanation for each of the paramaters) |
|||
| Line 30: | Line 30: | ||
3) Then into the descriptor file, edit the property this->tab to add your tab using following syntax: | 3) Then into the descriptor file, edit the property this->tab to add your tab using following syntax: | ||
<source lang="php"> | |||
$this->tabs = array( | $this->tabs = array( | ||
'objecttype:+tabname:TitleOfTab:@mymodule:conditiontoshowtab:urloftab?id=__ID__' | 'objecttype:+tabname:TitleOfTab:@mymodule:$conditiontoshowtab:urloftab?id=__ID__' | ||
); | ); | ||
</source> | |||
This is a string composed of 5 or 6 elements (depending whether you choose to use a $conditiontoshowtab). | |||
Where: | |||
* objecttype is the name of the tabhook you will use. | |||
* +tabname is a name you choose to identify your tab, preceded by the action (either + to add, or - to remove, and you can remove other tabs as well including default ones). | |||
* TitleOfTab is a title you choose, it will be translated | |||
* @mymodule is the language file where your translation (of the title) resides (eg: mytitlelang@mymodule will look inside /htdocs/mymodule/langs/xx_XX/mytitlelang and where xx_XX is the current localization of Dolibarr, eg: en_US, fr_FR, etc.). | |||
* $conditiontoshowtab is a variable that will be eval'd to get the value: if true then the tab is shown, if false then the tab won't be. Eg: you can use the Dolibarr rights system, eg: $user->rights->product->creer or $user->admin or any other variable you want. This is optional, you can just skip this and leave only 5 elements in this string and it will work (don't forget to remove the semicolon too). | |||
* urloftab?id=__ID__ is the URL where the tab will point to when clicked. You can use the placeholder __ID__ which will be replaced by the value of the id if one is defined. Eg: DOL_DOCUMENT_ROOT.'/mymodule/lib/mytab.php' | |||
Example: | Example: | ||
edits