From 9a436c71e69fd35229e92359cf59fa55c19db3b2 Mon Sep 17 00:00:00 2001 From: Philipp Nowinski <philipp@sgalinski.de> Date: Wed, 17 May 2017 11:38:13 +0200 Subject: [PATCH] [BUGFIX] fix extendedIf ViewHelper --- Classes/ViewHelpers/ExtendedIfViewHelper.php | 57 +++++++++++--------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/Classes/ViewHelpers/ExtendedIfViewHelper.php b/Classes/ViewHelpers/ExtendedIfViewHelper.php index e1e50c2..8dd5e32 100644 --- a/Classes/ViewHelpers/ExtendedIfViewHelper.php +++ b/Classes/ViewHelpers/ExtendedIfViewHelper.php @@ -33,35 +33,44 @@ use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper; */ class ExtendedIfViewHelper extends AbstractConditionViewHelper { /** - * @return void + * Initializes the "then" and "else" arguments */ public function initializeArguments() { - $this->registerArgument('condition', 'boolean', 'Condition to be evaluated.'); - $this->registerArgument('or', 'boolean', 'First or condition'); - $this->registerArgument('or2', 'boolean', 'Second or condition'); - $this->registerArgument('or3', 'boolean', 'Third or condition'); - $this->registerArgument('or4', 'boolean', 'Fourth or condition'); - $this->registerArgument('and', 'boolean', 'First and condition'); - $this->registerArgument('and2', 'boolean', 'Second and condition'); - $this->registerArgument('and3', 'boolean', 'Third and condition'); - $this->registerArgument('and4', 'boolean', 'Fourth and condition'); - $this->registerArgument('negate', 'boolean', 'Negate complete condition'); + parent::initializeArguments(); + $this->registerArgument( + 'condition', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'or', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'or2', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'or3', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'or4', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'and', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE + ); + $this->registerArgument( + 'and2', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE + ); + $this->registerArgument( + 'and3', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE + ); + $this->registerArgument( + 'and4', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE + ); + $this->registerArgument( + 'negate', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); } /** - * renders <f:then> child if $condition or $or is true, otherwise renders <f:else> child. - * - * Note: The phpdoc data type of the parameter must be named "boolean". - * Otherwise Fluid doesn't evaluates conditions itself. - * - * @return string - */ - public function render() { - return parent::render(); - } - - /** - * This method decides if the condition is TRUE or FALSE. It can be overridden in extending viewhelpers to adjust functionality. + * This method decides if the condition is TRUE or FALSE. It can be overriden in extending viewhelpers to adjust functionality. * * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper, allows for flexiblity in overriding this method. * @return bool -- GitLab