How to use tt_content fields in custom plugin of TYPO3.


 
How to add new field in custom plugin option

Its very important and useful for add tt_content field in custom plugin option or in normal content element area.

If you want to set second title field in your tt_content record then you have to set following script in your ext_table.php

$tempColumns = array(
    'subtitle' => array(
        'exclude' => 0,
        'label' => 'title2',
        'config' => array(
            'type' => 'input'
        )
    )
);

Then you have to load tt_content TCA file

This is for EXTBASE Extension
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('tt_content');

OR

This is for PI Base Extension
t3lib_div::loadTCA("tx_dam_cat");

If you want to display this field in ALL CONTENT ELEMENT then use following script.

This is for EXTBASE Extension
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $tempColumns);

OR

This is for PI Base Extension
t3lib_extMgm::addTCAcolumns("tx_dam_cat",$tempColumns,1);

Third parameter is deprecated in latest version of TYPO3 6.X.X

If you want to display this field in PARTICULAR EXTENSION then use following script.

This is for EXTBASE Extension
$TCA["tt_content"]["types"]["list"]["subtypes_excludelist"]["abc_xyz"]="layout,select_key,pages";
$TCA["tt_content"]["types"]["list"]["subtypes_addlist"]["abc_xyz"]="subtitle;;;;1-1-1";

OR

This is for PI Base Extension
$TCA["tt_content"]["types"]["list"]["subtypes_excludelist"][$_EXTKEY."_pi1"]="layout,select_key,pages";
$TCA["tt_content"]["types"]["list"]["subtypes_addlist"][$_EXTKEY."_pi1"]="subtitle;;;;1-1-1";

Note :
If your extension key is “Abc” and your plugin key is “Xyz”, then the index is “abc_xyz”, all in small.

I hope it will work for you and make your day 😉

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

Advertisements

6 thoughts on “How to use tt_content fields in custom plugin of TYPO3.

  1. Pingback: How to image upload in exntesion of typo3 6.2 version + Drag n drop image functionality in extension of typo3 6.2 | Typo3 and PHP Techie Blog

  2. Pingback: How to image store in tt_content or sys_file_reference table + TYPO3. | Typo3 and PHP Techie Blog

  3. Thanks for your reply, But I am more interested in mapping tt_content with a extbase model, using typosript.
    For example , something like following in setup.ts, inside persistence part,

    classes {
    Tx_PlusbSlidingcontent_Domain_Model_Content {
    mapping {
    tableName = tt_content
    columns {
    }
    }
    }
    }

    I don’t know if this is correct , as its not working for me.

    Reply
    • $conf = array(
      ‘table’ => ‘tt_content’,
      ‘select.’ => array(
      ‘where’ => ‘colPos=0 AND uid = 3389’,
      ‘orderBy’ => ‘sorting’,
      ‘languageField’ => 2 <cObj->cObjGetSingle(‘CONTENT’, $conf);

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s