[~TASK] Fluid (ViewHelpers): Added some checks to make form view helper usable withou...
authorBastian Waidelich <bastian@typo3.org>
Wed, 21 Oct 2009 16:59:03 +0000 (16:59 +0000)
committerBastian Waidelich <bastian@typo3.org>
Wed, 21 Oct 2009 16:59:03 +0000 (16:59 +0000)
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/ObjectAccessorNode.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Format/PaddingViewHelper.php

index 0b4eeb8..00d5b9b 100644 (file)
@@ -23,7 +23,7 @@
 /**
  * A node which handles object access. This means it handles structures like {object.accessor.bla}
  *
 /**
  * A node which handles object access. This means it handles structures like {object.accessor.bla}
  *
- * @version $Id: ObjectAccessorNode.php 3333 2009-10-21 09:52:46Z sebastian $
+ * @version $Id: ObjectAccessorNode.php 3334 2009-10-21 10:08:17Z sebastian $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @scope prototype
  * @internal
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @scope prototype
  * @internal
index e14ef0f..95962cd 100644 (file)
@@ -26,7 +26,7 @@
  * If you set the "property" attribute to the name of the property to resolve from the object, this class will
  * automatically set the name and value of a form element.
  *
  * If you set the "property" attribute to the name of the property to resolve from the object, this class will
  * automatically set the name and value of a form element.
  *
- * @version $Id: AbstractFormViewHelper.php 3313 2009-10-12 05:57:02Z sebastian $
+ * @version $Id: AbstractFormViewHelper.php 3336 2009-10-21 16:52:50Z bwaidelich $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @scope prototype
  */
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @scope prototype
  */
@@ -58,6 +58,9 @@ abstract class Tx_Fluid_ViewHelpers_Form_AbstractFormViewHelper extends Tx_Fluid
                if ($fieldName === NULL || $fieldName === '') {
                        return '';
                }
                if ($fieldName === NULL || $fieldName === '') {
                        return '';
                }
+               if (!$this->viewHelperVariableContainer->exists('Tx_Fluid_ViewHelpers_FormViewHelper', 'fieldNamePrefix')) {
+                       return $fieldName;
+               }
                $fieldNamePrefix = (string)$this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelpers_FormViewHelper', 'fieldNamePrefix');
                if ($fieldNamePrefix === '') {
                        return $fieldName;
                $fieldNamePrefix = (string)$this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelpers_FormViewHelper', 'fieldNamePrefix');
                if ($fieldNamePrefix === '') {
                        return $fieldName;
@@ -104,9 +107,14 @@ abstract class Tx_Fluid_ViewHelpers_Form_AbstractFormViewHelper extends Tx_Fluid
         * @param string $fieldName name of the field to register
         * @return void
         * @author Sebastian Kurfürst <sebastian@typo3.org>
         * @param string $fieldName name of the field to register
         * @return void
         * @author Sebastian Kurfürst <sebastian@typo3.org>
+        * @author Bastian Waidelich <bastian@typo3.org>
         */
        protected function registerFieldNameForFormTokenGeneration($fieldName) {
         */
        protected function registerFieldNameForFormTokenGeneration($fieldName) {
-               $formFieldNames = $this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelpers_FormViewHelper', 'formFieldNames');
+               if ($this->viewHelperVariableContainer->exists('Tx_Fluid_ViewHelpers_FormViewHelper', 'formFieldNames')) {
+                       $formFieldNames = $this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelpers_FormViewHelper', 'formFieldNames');
+               } else {
+                       $formFieldNames = array();
+               }
                $formFieldNames[] = $fieldName;
                $this->viewHelperVariableContainer->addOrUpdate('Tx_Fluid_ViewHelpers_FormViewHelper', 'formFieldNames', $formFieldNames);
        }
                $formFieldNames[] = $fieldName;
                $this->viewHelperVariableContainer->addOrUpdate('Tx_Fluid_ViewHelpers_FormViewHelper', 'formFieldNames', $formFieldNames);
        }
index 8628ed7..113591d 100644 (file)
@@ -40,7 +40,7 @@
  * Output:
  * TYPO3-=-=-
  *
  * Output:
  * TYPO3-=-=-
  *
- * @version $Id: PaddingViewHelper.php 3169 2009-09-10 12:52:22Z k-fish $
+ * @version $Id: $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @scope prototype
  */
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @scope prototype
  */