adding a field in typo3 backend with extbase


November 05, 2015 at 10:33
Typo3

It's a miracle! I googled a typo3 problem and actually found an answer that worked! I needed an additional field in tt_content, so first of all I added a new field called "tx_kurs_id" to the tt_content table in the database. After that I added the following to the ext_tables.php in my extension:

$tempColumns = Array (
	"tx_kurs_id" => Array (
		"exclude" => 1,
		"label" => 'LLL:EXT:pgk_kurs/Resources/Private/Language/locallang_db.xml:tx_kurs_id.kursid',
		"config" => Array (
			'type' => 'input',
			'size' => 30,
			'eval' => 'trim'
		)
	),
);

t3lib_div::loadTCA("tt_content");
t3lib_extMgm::addTCAcolumns("tt_content",$tempColumns,1);
t3lib_extMgm::addToAllTCAtypes('tt_content','tx_kurs_id','','after:section_frame');

The last line is the interesting one.

param1: the typo3 table that the field should be added to

param2: the name of the field (as defined in $tempColumns)

param3: which content elements to add it to (leave empty for all elements)

param4: where to place it


Tags: extbase TCA tt_content


Hinterlasse einen Kommentar:
Search