Dividers to Tabs in Extensions

This article explains how easily we can get Tabs in the content elements of type “insert records”.

Generally we will need to edit tca.php and ext_tables.php.

To be more specific it involves adding two parameters.

1. Specify that you are using dividers to tabs “dividersstabs”
2. Mark all tabs using –div–

Let us see how.

1. Specify that you are using dividers to tabs “dividersstabs”

In the TCA array first look at the start of table definition. Generally this is located

EX:

$TCA['tx_myext_table] = array ( 
        'ctrl' => array ( 
                'title' => 'LLL:EXT:myext/locallang_db.xml:tx_myext_table, 
                'label' => 'title', 
                'tstamp' => 'tstamp', 
                'crdate' => 'crdate', 
                'cruser_id' => 'cruser_id', 
                'languageField' => 'sys_language_uid', 
                'transOrigPointerField' => 'l10n_parent', 
                'transOrigDiffSourceField' => 'l10n_diffsource', 
                'sortby' => 'sorting', 
                'delete' => 'deleted', 
                'dividers2tabs' => TRUE, 
                'enablecolumns' => array ( 
                        'disabled' => 'hidden', 
                ), 
                'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', 
                'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'icon_tx_myext_table.gif', 
        ), 
);

                

In the above config you can see that ‘dividers2tabs’ is set to TRUE

2. Mark all tabs using --div--

This is the step in which you would group all fields into different Tabs. This generally involves editing the TCA config usually locatd in tca.php.

In tca.php, look the section showitem, and add --div--;Tab Name,
EX: 
'types' => array ( 
        '0' => array(
                'showitem' => '--div--;General,
                                sys_language_uid;;;;1-1-1, l10n_parent, 
                                l10n_diffsource, hidden;;1,
                                --div--;Content,title;;;;3-3-3, parentid,top_page,content,
                                --div--;Header and Footer,footer,
                                background_image,background_align'
                ) 
),

As you can see I have added 3 tabs, General, Content, Header and Footer.

The idea is to add --div--; (two hypen followed by div and two hyphen and semicolon)

After semicolon add the “Title of your tab” and followed by a comma.

This section --div--;Tab Name, must be added just before a field, or after a field ends.

That should be it.

Happy coding.