Added feature #4270: displayCond for flexforms, that affects on row of element (thank...
authorAndreas Otto <andreas.otto@dkd.de>
Sun, 9 Aug 2009 08:55:00 +0000 (08:55 +0000)
committerAndreas Otto <andreas.otto@dkd.de>
Sun, 9 Aug 2009 08:55:00 +0000 (08:55 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5769 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms.php

index 04108f9..e6d41e2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-09     Andreas Otto    <andreas@otto-hanika.de>
+
+       * Added feature #4270: displayCond for flexforms, that affects on row of element (thanks to Tolleiv Nietsch and Rupert German)
+
 2009-08-05  Steffen Kamper  <info@sk-typo3.de>
 
        * Fixed bug #11627: Add CSS-Class and Ids to fields in TCEFORMS
index 22fcf97..e1b845d 100644 (file)
@@ -2740,11 +2740,15 @@ class t3lib_TCEforms    {
                                                        $rotateLang = array($PA['_valLang']);
                                                }
 
+                                               $conditionData = is_array($editData) ? $editData : array();
+                                                       // add current $row to data processed by isDisplayCondition()
+                                               $conditionData['parentRec'] = $row;
+
                                                $tRows = array();
                                                foreach($rotateLang as $vDEFkey)        {
                                                        $vDEFkey = 'v'.$vDEFkey;
 
-                                                       if (!$value['TCEforms']['displayCond'] || $this->isDisplayCondition($value['TCEforms']['displayCond'],$editData,$vDEFkey)) {
+                                                       if (!$value['TCEforms']['displayCond'] || $this->isDisplayCondition($value['TCEforms']['displayCond'], $conditionData, $vDEFkey)) {
                                                                $fakePA=array();
                                                                $fakePA['fieldConf']=array(
                                                                        'label' => $this->sL(trim($value['TCEforms']['label'])),
@@ -5761,7 +5765,16 @@ class t3lib_TCEforms     {
                $parts = explode(':',$displayCond);
                switch((string)$parts[0])       {       // Type of condition:
                        case 'FIELD':
-                               $theFieldValue = $ffValueKey ? $row[$parts[1]][$ffValueKey] : $row[$parts[1]];
+                               if ($ffValueKey)        {
+                                       if (strpos($parts[1], 'parentRec.') !== FALSE)  {
+                                               $fParts = explode('.',$parts[1]);
+                                               $theFieldValue = $row['parentRec'][$fParts[1]];
+                                       } else {
+                                               $theFieldValue = $row[$parts[1]][$ffValueKey];
+                                       }
+                               } else {
+                                       $theFieldValue = $row[$parts[1]];
+                               }
 
                                switch((string)$parts[2])       {
                                        case 'REQ':