[TYPO3] How to make a mandatory field

Tapio Markula tapio.markula at dnainternet.net
Fri Jul 28 12:33:57 CEST 2006


webmaster (Ayto.Chiclana) wrote:
> hi all.
> 
> In a content type text with image, how to make mandatory the field "alt
> text"???
> 
> I think the field in the database is
> tt_content.tx_croncssstyledimgtext_altText.
> 
> Thaks all.

You must create a small extension for that because
you add a condition.

ext_tables.php

$tempColumns = Array (
		'header_position' => Array (
		  'exclude' => 1,		
			'label' => 'LLL:EXT:cms/locallang_ttc.php:header_position',
			'config' => Array (
				'type' => 'select',
				'items' => Array (
					Array('', ''),
					Array('LLL:EXT:cms/locallang_ttc.php:header_position.I.1', 'center'),
					Array('LLL:EXT:cms/locallang_ttc.php:header_position.I.2', 'right'),
					Array('LLL:EXT:cms/locallang_ttc.php:header_position.I.3', 'left')
				),
				'default' => ''
			)
		),
...

t3lib_extMgm::addTCAcolumns("tt_columns",$tempColumns,1);

note that those *override* all existing setting, which has been set for
certain field - might cause problems!

safer

t3lib_div::loadTCA("tt_content"); // that loads all existing setting
$TCA['tt_content']['columns']['title']['label']=...;

the latter just overwrites *individual* values.
Adding new conditions should work too (I have not newer set at this way).


Recommendation. Make as small user_setting plugin, where you
collect all you modifications and set for it
into ext_emconf.php 'priority' => 'bottom',



More information about the TYPO3-english mailing list