Module development: Difference between revisions

Jump to navigation Jump to search
Line 99: Line 99:
<source lang="php">
<source lang="php">
// Array to add new pages in new tabs or remove existing one
// Array to add new pages in new tabs or remove existing one
$this->tabs = array('objecttype:+tabname1:Title1:@mymodule:/mymodule/mynewtab1.php?id=__ID__',  // To add a new tab identified by code tabname1
$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:@mymodule:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
                             '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
                             'objecttype:-tabname');                                                    // To remove an existing tab identified by code tabname
</source>
</source>
Line 110: Line 110:
* 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 +) or to remove (start with -)
* Part 3: The title of the tab. This can be a hard read or better code translation in a file lang.
* Part 3: The title of the tab. This can be a hard read or better code translation in a file lang.
* Part 4: The name of the file. Lang which contains correspondence between the code translation and language to display. If this name start with @, Dolibarr will search translation file into the lang file of module, so htdocs/mymodule/langs/code_CODE/mymodule.lang, otherwise Dolibarr will look for file htdocs/langs/code_CODE/mymodyle.lang  
* 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 into the lang file of module, so htdocs/mymodule/langs/code_CODE/mylangfile.lang, otherwise Dolibarr will look for file htdocs/langs/code_CODE/mylangfile.lang  
* Part 5: 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.
* Part 5: A condition to test if tab must be visible. Put 1 to be always visible.
* 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.


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.

Navigation menu