Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Oliver Eglseder
lfeditor
Commits
be527945
Commit
be527945
authored
Dec 06, 2016
by
Stefan Galinski
🎮
Browse files
[BUGFIX] Fix TYPO3 7 compatibility
parent
b1d9b666
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
40 deletions
+30
-40
Classes/ViewHelpers/ExtendedIfViewHelper.php
Classes/ViewHelpers/ExtendedIfViewHelper.php
+30
-40
No files found.
Classes/ViewHelpers/ExtendedIfViewHelper.php
View file @
be527945
...
...
@@ -38,34 +38,36 @@ class ExtendedIfViewHelper extends AbstractConditionViewHelper {
*/
public
function
initializeArguments
()
{
parent
::
initializeArguments
();
$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.
*
* @return string
*/
public
function
render
()
{
if
(
$this
->
evaluateConditionFunctionExists
())
{
return
parent
::
render
();
}
// @todo Remove the following part if only > 7.5 support.
$conditionResult
=
(
$this
->
arguments
[
'condition'
]
||
$this
->
arguments
[
'or'
]
||
$this
->
arguments
[
'or2'
]
||
$this
->
arguments
[
'or3'
]
||
$this
->
arguments
[
'or4'
])
&&
$this
->
arguments
[
'and'
]
&&
$this
->
arguments
[
'and2'
]
&&
$this
->
arguments
[
'and3'
]
&&
$this
->
arguments
[
'and4'
];
if
(
$this
->
arguments
[
'negate'
]
?
!
$conditionResult
:
$conditionResult
)
{
return
$this
->
renderThenChild
();
}
else
{
return
$this
->
renderElseChild
();
}
$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
);
}
/**
...
...
@@ -88,16 +90,4 @@ class ExtendedIfViewHelper extends AbstractConditionViewHelper {
return
isset
(
$arguments
[
'negate'
])
&&
$arguments
[
'negate'
]
?
!
$conditionResult
:
$conditionResult
;
}
/**
* Returns true, if the function evaluateCondition exists in the AbstractConditionViewHelper class.
*
* @deprecated Remove this function if only > 7.5 support.
* @return boolean
*/
protected
function
evaluateConditionFunctionExists
()
{
return
method_exists
(
'TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper'
,
'evaluateCondition'
);
}
}
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment