Exemplo n.º 1
0
 /**
  * Move all userdefined properties to the additionalArguments
  * array. Ignore the child elements
  *
  * @return void
  */
 public function moveAllOtherUserdefinedPropertiesToAdditionalArguments()
 {
     $viewHelperDefaultArguments = $this->typoScriptRepository->getModelConfigurationByScope($this->element->getElementType(), 'viewHelperDefaultArguments.');
     $ignoreKeys = array();
     foreach ($this->userConfiguredElementTyposcript as $attributeName => $attributeValue) {
         // ignore child elements
         if (MathUtility::canBeInterpretedAsInteger($attributeName) || isset($ignoreKeys[$attributeName]) || $attributeName == 'postProcessor.' || $attributeName == 'rules.' || $attributeName == 'filters.' || $attributeName == 'layout') {
             $ignoreKeys[$attributeName . '.'] = true;
             continue;
         }
         $attributeNameWithoutDot = rtrim($attributeName, '.');
         $attributeNameToSet = $attributeNameWithoutDot;
         if (isset($viewHelperDefaultArguments[$attributeName]) || isset($viewHelperDefaultArguments[$attributeNameWithoutDot])) {
             $this->formBuilder->getFormUtility()->renderArrayItems($attributeValue);
             $attributeValue = $this->typoScriptService->convertTypoScriptArrayToPlainArray($attributeValue);
         } else {
             $attributeValue = $this->formBuilder->getFormUtility()->renderItem($this->userConfiguredElementTyposcript[$attributeNameWithoutDot . '.'], $this->userConfiguredElementTyposcript[$attributeNameWithoutDot]);
         }
         $this->additionalArguments[$attributeNameToSet] = $attributeValue;
         $ignoreKeys[$attributeNameToSet . '.'] = true;
         $ignoreKeys[$attributeNameToSet] = true;
         unset($this->userConfiguredElementTyposcript[$attributeNameWithoutDot . '.']);
         unset($this->userConfiguredElementTyposcript[$attributeNameWithoutDot]);
     }
     // remove "stdWrap." from "additionalArguments" on
     // the FORM Element
     if (!$this->formBuilder->getConfiguration()->getContentElementRendering() && $this->element->getElementType() == 'FORM') {
         unset($this->additionalArguments['stdWrap']);
         unset($this->additionalArguments['stdWrap.']);
     }
 }
Exemplo n.º 2
0
 /**
  * Move all userdefined properties to the additionalArguments
  * array. Ignore the child elements
  *
  * @return void
  */
 public function moveAllOtherUserdefinedPropertiesToAdditionalArguments()
 {
     $ignoreKeys = array();
     foreach ($this->userConfiguredElementTyposcript as $attributeName => $attributeValue) {
         // ignore child elements
         if (MathUtility::canBeInterpretedAsInteger($attributeName) || isset($ignoreKeys[$attributeName]) || $attributeName == 'postProcessor.' || $attributeName == 'rules.' || $attributeName == 'filters.' || $attributeName == 'layout') {
             $ignoreKeys[$attributeName . '.'] = true;
             continue;
         }
         $attributeNameWithoutDot = rtrim($attributeName, '.');
         $attributeNameToSet = $attributeNameWithoutDot;
         $rendered = false;
         if ($this->formBuilder->getConfiguration()->getCompatibility()) {
             $newAttributeName = $this->formBuilder->getCompatibilityService()->getNewAttributeName($this->element->getElementType(), $attributeNameWithoutDot);
             /* Should the attribute be renamed? */
             if ($newAttributeName !== $attributeNameWithoutDot) {
                 $attributeNameToSet = $newAttributeName;
                 /* If the renamed attribute already exists in the user configured typoscript */
                 if ($this->arrayKeyExists($newAttributeName, $this->userConfiguredElementTyposcript)) {
                     $attributeValue = $this->formBuilder->getFormUtility()->renderItem($this->userConfiguredElementTyposcript[$newAttributeName . '.'], $this->userConfiguredElementTyposcript[$newAttributeName]);
                     /* set renamed attribute name with the value of the renamed attribute */
                     $this->additionalArguments[$newAttributeName] = $attributeValue;
                     /* unset the renamed attribute */
                     $ignoreKeys[$newAttributeName . '.'] = true;
                     $ignoreKeys[$newAttributeName] = true;
                     unset($this->userConfiguredElementTyposcript[$newAttributeName . '.']);
                     unset($this->userConfiguredElementTyposcript[$newAttributeName]);
                     $rendered = true;
                 }
             }
         }
         if ($rendered === false) {
             $attributeValue = $this->formBuilder->getFormUtility()->renderItem($this->userConfiguredElementTyposcript[$attributeNameWithoutDot . '.'], $this->userConfiguredElementTyposcript[$attributeNameWithoutDot]);
             $this->additionalArguments[$attributeNameToSet] = $attributeValue;
             $ignoreKeys[$attributeNameToSet . '.'] = true;
             $ignoreKeys[$attributeNameToSet] = true;
         }
         unset($this->userConfiguredElementTyposcript[$attributeNameWithoutDot . '.']);
         unset($this->userConfiguredElementTyposcript[$attributeNameWithoutDot]);
     }
     // remove "stdWrap." from "additionalArguments" on
     // the FORM Element
     if (!$this->formBuilder->getConfiguration()->getContentElementRendering() && $this->element->getElementType() == 'FORM') {
         unset($this->additionalArguments['stdWrap']);
         unset($this->additionalArguments['stdWrap.']);
     }
 }