[TYPO3-english] multiple displayCond in TCA

Stefan Frömken firma at sfroemken.de
Tue Feb 22 09:25:24 CET 2011


Am 17.02.2011 15:25, schrieb Georg Schönweger:
> Hi,
>
> is it possible to set multiple displayCond in TCA? I would like to have:
> 'displayCond' =>  'FIELD:some_field:REQ:false', AND 'displayCond' =>
> 'FIELD:some_other_field:REQ:true',
>
> I found also another thread about multiple displayCond in FlexForms, but
> the thread is 2 years old so maybe now it is possible? ;
> http://www.justinml.com/mailing-lists/cms-typo3/typo3-dev-mailing-list/subject/mailing/typo3-dev-flexform-more-displaycond/
>
> - Georg
>
>

Let's have a look into Core 4.4.2 file class.t3lib_tceforms.php:

---------------------
function isDisplayCondition($displayCond,$row,$ffValueKey='')	{
	$output = FALSE;
	$parts = explode(':',$displayCond);
---------------------

You see...there is no possibility to add multiple conditions

Let's have a look into Core 4.5.0:

---------------------
function isDisplayCondition($displayCond, $row, $ffValueKey = '') {
	$output = FALSE;
	$parts = explode(':', $displayCond);
---------------------

The conditionstring will be divided by colon directly. So..there is no 
multiple condition, too.

But I found something in t3lib_contextmenu_abstractdataprovider.php:

---------------------
protected function evaluateDisplayCondition(t3lib_tree_Node $node, 
$displayCondition) {
	if ($displayCondition === '') {
		return TRUE;
	}

	// parse condition string
	$conditions = array();
	preg_match_all('/(.+?)(>=|<=|!=|=|>|<)(.+?)(\|\||&&|$)/is', 
$displayCondition, $conditions);

	$lastResult = FALSE;
	$chainType = '';
	$amountOfConditions = count($conditions[0]);
	for ($i = 0; $i < $amountOfConditions; ++$i) {
---------------------

Maybe this is an idea, to implement multiple conditions in TCEforms, 
too. Try to create a feature request.

Stefan


More information about the TYPO3-english mailing list