Im setting up a content element in Typo3 where I have an icon next to my text.
And because the most colums in the tt_content table remains empty I want to use the subheader column for the input of my icon. This gives a text input type but i want to change that to a select box (with all my defined icons).
I use this in my tca/overrides/tt_content.php
$GLOBALS['TCA']['tt_content']['types']['ext_icon']['showitem'] =
'--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.general;general,
header; Title;,
bodytext; Text;;richtext[*]:rte_transform[],
subheader; Icon;,
header_link;Button link;';
I want to change this subheader part to an select.
I did use this way:
$GLOBALS['TCA']['tt_content']['columns']['subheader'] = array(
"exclude" => 1,
"label" => "test",
"config" => array(
'type' => 'select',
'items' => array(
array('Warning', 'warning'),
array('Alert', 'alert'),
array('Sign', 'sign'),
)
)
)
That works, but then on every place I have this select type for my subheader.
How can i only set it op for this element and let the other places use the default input type?
Btw I use Typo 6.2.x
You should use a dedicated field for that purpose instead of "abusing" the subheader that way. When you install ie the THEMES package of extensions, a field like that will be made available for fontawesome icons.
https://docs.typo3.org/typo3cms/TSconfigReference/PageTsconfig/TCEform/Index.html
you can define a 'case' where you will use filed type X when type Y is selected:
TCEFORM.[table name].[field].types.[type] - configures the field in TCEFORM in case the 'type'-value of the field matches type.
BUT, this is not recommended for your situation.
re-using fields is ok, but only when the field also matches the 'semantics' of that field. Storing icon names in a subheader field just doesn't feel right.
I would recommend to create a new field where you can store your icon names and not to interfere with the subheader field. This way you can easily re-use this new field for other cType's
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.