Exemplo n.º 1
0
 /**
  * @param int $id
  * @param array $fieldArray
  * @param \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler
  *
  * @return void
  */
 public function preventEmptyFlexFormValues($id, &$fieldArray, $dataHandler)
 {
     $content = BackendUtility::getRecord('tt_content', $id);
     if (isset($fieldArray) && $fieldArray['CType'] === $this->CType || $content['CType'] === $this->CType) {
         if (isset($fieldArray['pi_flexform'])) {
             $flexformData = GeneralUtility::xml2array($fieldArray['pi_flexform']);
             if (isset($flexformData['data'])) {
                 foreach ($flexformData['data'] as $sheet => $fields) {
                     foreach ($fields['lDEF'] as $fieldKey => $fieldValue) {
                         if (strpos($fieldKey, 'settings.') !== false && $fieldValue['vDEF'] === '') {
                             unset($flexformData['data'][$sheet]['lDEF'][$fieldKey]);
                         }
                     }
                     if (isset($flexformData['data'][$sheet]['lDEF']) && $flexformData['data'][$sheet]['lDEF'] === []) {
                         unset($flexformData['data'][$sheet]);
                     }
                 }
                 $fieldArray['pi_flexform'] = $this->flexFormTools->flexArray2Xml($flexformData, true);
             }
         }
     }
 }
 /**
  * Updates the FlexForm data in the given outdated content element.
  *
  * @param array $outdatedContent
  * @param array &$dbQueries Queries done in this update
  */
 protected function updateOutdatedContentFlexForm($outdatedContent, array &$dbQueries)
 {
     $flexFormArray = GeneralUtility::xml2array($outdatedContent['pi_flexform']);
     if (isset($flexFormArray['data']['rss']['lDEF']['settings.list.rss.channel'])) {
         $title = $flexFormArray['data']['rss']['lDEF']['settings.list.rss.channel'];
         unset($flexFormArray['data']['rss']['lDEF']['settings.list.rss.channel']);
         $flexFormArray['data']['rss']['lDEF']['settings.list.rss.channel.title'] = $title;
     }
     $flexFormData = $this->flexObj->flexArray2Xml($flexFormArray);
     $query = $this->db->UPDATEquery('tt_content', 'uid=' . (int) $outdatedContent['uid'], array('pi_flexform' => $flexFormData));
     $this->db->sql_query($query);
     $dbQueries[] = $query;
 }
Exemplo n.º 3
0
 /**
  * Call back function for \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools class
  * Basically just setting the value in a new array (thus cleaning because only values that are valid are visited!)
  *
  * @param array $dsArr Data structure for the current value
  * @param mixed $data Current value
  * @param array $PA Additional configuration used in calling function
  * @param string $path Path of value in DS structure
  * @param FlexFormTools $pObj caller
  * @return void
  */
 public function cleanFlexFormXML_callBackFunction($dsArr, $data, $PA, $path, $pObj)
 {
     // Just setting value in our own result array, basically replicating the structure:
     $pObj->setArrayValueByPath($path, $this->cleanFlexFormXML, $data);
 }
Exemplo n.º 4
0
 /**
  * Call back function for \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools class
  * Basically just setting the value in a new array (thus cleaning because only values that are valid are visited!)
  *
  * @param array $dsArr Data structure for the current value
  * @param mixed $data Current value
  * @param array $PA Additional configuration used in calling function
  * @param string $path Path of value in DS structure
  * @param FlexFormTools $pObj caller
  * @return void
  */
 public function cleanFlexFormXML_callBackFunction($dsArr, $data, $PA, $path, $pObj)
 {
     // Just setting value in our own result array, basically replicating the structure:
     $pObj->setArrayValueByPath($path, $this->cleanFlexFormXML, $data);
     // Looking if an "extension" called ".vDEFbase" is found and if so, accept that too:
     if ($GLOBALS['TYPO3_CONF_VARS']['BE']['flexFormXMLincludeDiffBase']) {
         $vDEFbase = $pObj->getArrayValueByPath($path . '.vDEFbase', $pObj->traverseFlexFormXMLData_Data);
         if (isset($vDEFbase)) {
             $pObj->setArrayValueByPath($path . '.vDEFbase', $this->cleanFlexFormXML, $vDEFbase);
         }
     }
 }
Exemplo n.º 5
0
 /**
  * FlexForm call back function, see translationDetails. This is used for langDatabaseOverlay FCEs!
  * Two additional paramas are used:
  * $this->_callBackParams_translationXMLArray
  * $this->_callBackParams_keyForTranslationDetails
  *
  * @param   array $dsArr Data Structure
  * @param   string $dataValue Data value
  * @param   array $PA Various stuff in an array
  * @param   string $structurePath Path to location in flexform
  * @param   FlexFormTools $pObj parent object
  * @return  void
  */
 function translationDetails_flexFormCallBackForOverlay($dsArr, $dataValue, $PA, $structurePath, $pObj)
 {
     //echo $dataValue.'<hr>';
     $translValue = $pObj->getArrayValueByPath($structurePath, $this->_callBackParams_translationXMLArray);
     $diffDefaultValue = $pObj->getArrayValueByPath($structurePath, $this->_callBackParams_translationDiffsourceXMLArray);
     foreach ($this->previewLanguages as $prevSysUid) {
         $previewLanguageValues[$prevSysUid] = $pObj->getArrayValueByPath($structurePath, $this->_callBackParams_previewLanguageXMLArrays[$prevSysUid]);
     }
     $key = $this->_callBackParams_keyForTranslationDetails . ':' . $structurePath;
     $this->translationDetails_addField($key, $dsArr['TCEforms'], $dataValue, $translValue, $diffDefaultValue, $previewLanguageValues, $this->_callBackParams_currentRow);
     unset($pObj);
 }