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.

Html tags like table,p are not comming for the newly added RTE field in tt_news

While I was working on some project, there was a requirement to add extra RTE field for tt_news. I extended the table tt_news by adding RTE fields. I faced the following problem

1) I inserted the table but after saving the tt_news record the table started disappearing

2) <p> tag was not inserted automatically for press of Enter

After doing some research I found the solution

1) Set the transformation mode for the RTE to “ts_css” in ext_tables.php

ex-

if (t3lib_extMgm::isLoaded(‘css_styled_content’)) {
t3lib_extMgm::addPageTSConfig(‘
# RTE mode for table “tt_news”
RTE.config.tt_news.exampleField.proc.overruleMode=ts_css’);
}

Here the table used is tt_news and the filed name is exampleField

2) For P tag to be inserted for every new line character I added the code

$rowfrntbl[$tblcol]=$pObj->local_cObj->stdWrap($rowfrntbl[$tblcol], $pObj->conf[‘general_stdWrap.’])

Here I am using hook  for tt_news to get the desired result.

Adding Fields to the Rootline to Enable sliding for custom fields

In certain situations it is necessary to add fields to the rooline so that we can have the sliding feature enabled for these fields.

The fields can be added to rootline fields list through the install tool –> All Config or if you are developing an extension, then you can write the following code in the ext_localconf.php

 

$rootlinefields = &$GLOBALS["TYPO3_CONF_VARS"]["FE"]["addRootLineFields"];
/* Note the ampersand (&) symbol. Don’t Forget it!!! */

$NewRootlinefields = "tx_nmcmenu_overcolor,tx_nmcmenu_outcolor,tx_nmcmenu_actcolor";
$rootlinefields .= ($rootlinefields == ”)?$NewRootlinefields:’,’.$NewRootlinefields;