83
edits
| Line 136: | Line 136: | ||
{{TemplateModuleTabs}} | {{TemplateModuleTabs}} | ||
*Part 2: A code to identify tab to add (start with +) or to remove (start with -) | *Part 2: A code to identify tab to add (start with +tabname1) or to remove (start with -tabname1) | ||
*Part 3: The title of the tab. This can be a | *Part 3: The title of the tab(<syntaxhighlight lang="PHP"> | ||
*Part 4: The name of the file "*.lang" which contains correspondence between the code translation and language to display. If this name is followed with @mymodule, Dolibarr will search translation file "*.lang" within the module | // Array to add new pages in new tabs or remove existing one | ||
*Part 5: A condition to test if tab must be visible. | $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // To add a new tab identified by code tabname1 | ||
*Part 6: The URL of the page to display when you click on the tab. The __ID__ string will be replaced automatically by the Id of the element concerned. | 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // To add a new tab identified by code tabname2 | ||
'objecttype:-tabname'); // To remove an existing tab identified by code tabname | |||
</syntaxhighlight>. This can be a hardcoded read or better a code translation in module lang file . | |||
*Part 4: The name of the file "*.lang" (<syntaxhighlight lang="PHP"> | |||
// Array to add new pages in new tabs or remove existing one | |||
$this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // To add a new tab identified by code tabname1 | |||
'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // To add a new tab identified by code tabname2 | |||
'objecttype:-tabname'); // To remove an existing tab identified by code tabname | |||
</syntaxhighlight> which contains correspondence between the code translation and language to display. If this name is followed with @mymodule, Dolibarr will search translation file "*.lang" within the module in htdocs/custom/mymodule/langs/code_CODE/mylangfile.lang, otherwise Dolibarr will look for file in htdocs/langs/code_CODE/mylangfile.lang | |||
*Part 5: A condition to test if tab must be visible(<syntaxhighlight lang="PHP"> | |||
// Array to add new pages in new tabs or remove existing one | |||
$this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // To add a new tab identified by code tabname1 | |||
'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // To add a new tab identified by code tabname2 | |||
'objecttype:-tabname'); // To remove an existing tab identified by code tabname | |||
</syntaxhighlight>) '''or''' put 1 to be always visible. | |||
*Part 6: The URL of the page to display when you click on the tab(<syntaxhighlight lang="PHP"> | |||
// Array to add new pages in new tabs or remove existing one | |||
$this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // To add a new tab identified by code tabname1 | |||
'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // To add a new tab identified by code tabname2 | |||
'objecttype:-tabname'); // To remove an existing tab identified by code tabname | |||
</syntaxhighlight>. The __ID__ string will be replaced automatically by the Id of the element concerned. | |||
To feed the contents of the tab with data from the database, see the next chapter. | To feed the contents of the tab with data from the database, see the next chapter. | ||
edits