Commit 2d615e1f authored by Kevin Ditscheid's avatar Kevin Ditscheid

[TASK] Remove the extendedIf ViewHelper because it is not needed anymore

parent 39abb28f
<?php
namespace SGalinski\Lfeditor\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
/**
* ExtendedIfViewHelper
*/
class ExtendedIfViewHelper extends AbstractConditionViewHelper {
/**
* Initializes the "then" and "else" arguments
*
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
*/
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
);
}
/**
* 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
*/
protected static function evaluateCondition($arguments = NULL) {
$conditionResult = (
(isset($arguments['condition']) && $arguments['condition']) ||
(isset($arguments['or']) && $arguments['or']) ||
(isset($arguments['or2']) && $arguments['or2']) ||
(isset($arguments['or3']) && $arguments['or3']) ||
(isset($arguments['or4']) && $arguments['or4'])
) && isset($arguments['and']) && $arguments['and'] &&
isset($arguments['and2']) && $arguments['and2'] &&
isset($arguments['and3']) && $arguments['and3'] &&
isset($arguments['and4']) && $arguments['and4'];
return isset($arguments['negate']) && $arguments['negate'] ? !$conditionResult : $conditionResult;
}
}
{namespace lfe=SGalinski\Lfeditor\ViewHelpers}
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}">
<f:if condition="{extensionSelection} && {languageFileSelection}">
<h2 class="uppercase">
<f:translate key="select.constant" />
</h2>
......@@ -9,4 +9,4 @@
options="{constantOptions}"
additionalAttributes="{onchange: 'submitForm(\'mainMenuForm\')'}"
/>
</lfe:extendedIf>
\ No newline at end of file
</f:if>
{namespace lfe=SGalinski\Lfeditor\ViewHelpers}
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}" and2="{referenceLanguageOptions}">
<f:if condition="{extensionSelection} && {languageFileSelection} && {referenceLanguageOptions}">
<h2 class="uppercase">
<f:translate key="select.languageAndPattern" />
</h2>
......@@ -14,4 +14,4 @@
options="{referenceLanguageOptions}"
additionalAttributes="{onchange: 'submitForm(\'mainMenuForm\')'}"
/>
</lfe:extendedIf>
\ No newline at end of file
</f:if>
{namespace lfe=SGalinski\Lfeditor\ViewHelpers}
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}">
<f:if condition="{extensionSelection} && {languageFileSelection}">
<h2 class="uppercase">
<f:translate key="select.numConstants" />
</h2>
......@@ -9,4 +9,4 @@
options="{numSiteConstsOptions}"
additionalAttributes="{onchange: 'submitForm(\'mainMenuForm\')'}"
/>
</lfe:extendedIf>
</f:if>
{namespace lfe=SGalinski\Lfeditor\ViewHelpers}
<lfe:extendedIf condition="{languageFileSelection}" and="{bottomReferenceLanguageOptions}">
<f:if condition="{languageFileSelection} && {bottomReferenceLanguageOptions}">
<h2 class="uppercase">
<f:translate key="select.referenceLanguage" />
</h2>
......@@ -9,4 +9,4 @@
options="{bottomReferenceLanguageOptions}"
additionalAttributes="{onchange: 'submitForm(\'mainMenuForm\')'}"
/>
</lfe:extendedIf>
\ No newline at end of file
</f:if>
......@@ -3,7 +3,7 @@
<f:for each="{fluidTree}" as="treeNode" key="constantKey">
<li>
<f:for each="{treeNode.icons}" iteration="iterator" as="icon" reverse="TRUE">
<lfe:extendedIf condition="{iterator.isLast}" and="{treeNode.children}">
<f:if condition="{iterator.isLast} && {treeNode.children}">
<f:then>
<a href="javascript:openCloseTreeEntry(
'{f:uri.resource(path: 'Icons')}',
......@@ -17,7 +17,7 @@
<img src="{f:uri.resource(path: 'Icons/{icon.name}')}" alt="{icon.name}"
style="margin-left: {icon.marginLeft}px;" />
</f:else>
</lfe:extendedIf>
</f:if>
</f:for>
<f:if condition="{treeNode.children}">
......@@ -43,4 +43,4 @@
</f:else>
</f:if>
</li>
</f:for>
\ No newline at end of file
</f:for>
......@@ -7,7 +7,7 @@
</f:section>
<f:section name="main">
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}" and2="{languages}">
<f:if condition="{extensionSelection} && {languageFileSelection} && {languages}">
<h2 class="uppercase">
<f:translate key="function.const.add.add" />
</h2>
......@@ -42,5 +42,5 @@
</div>
</f:if>
</f:form>
</lfe:extendedIf>
</f:section>
\ No newline at end of file
</f:if>
</f:section>
......@@ -10,8 +10,7 @@
</f:section>
<f:section name="main">
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}"
and2="{constantSelection}" and3="{constantSelection} != '###default###'">
<f:if condition="{extensionSelection} && {languageFileSelection} && {constantSelection} && {constantSelection} != '###default###'">
<h2 class="uppercase">
<f:translate key="function.const.delete.delete" />
</h2>
......@@ -25,5 +24,5 @@
</div>
</p>
</f:form>
</lfe:extendedIf>
</f:section>
\ No newline at end of file
</f:if>
</f:section>
......@@ -10,8 +10,7 @@
</f:section>
<f:section name="main">
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}"
and2="{constantSelection}" and3="{constantSelection} != '###default###'">
<f:if condition="{extensionSelection} && {languageFileSelection} && {constantSelection} && {constantSelection} != '###default###'">
<h2 class="uppercase">
<f:translate key="function.const.edit.edit" />
</h2>
......@@ -25,7 +24,7 @@
<legend class="bgColor3">
{f:if(condition: '{lang} == \'default\'', then: 'en', else: '{lang}')}
</legend>
<lfe:extendedIf condition="{lang} == {defaultLanguage}" and="{defaultLanguagePermission} != 1">
<f:if condition="{lang} == {defaultLanguage} && {defaultLanguagePermission} != 1">
<f:then>
<f:form.textarea
cols="80" rows="{numTextAreaRows}"
......@@ -43,7 +42,7 @@
lang="{f:if(condition: '{lang} == \'default\'', then: 'en', else: '{lang}')}"
class="tx-lfeditor-textarea" />
</f:else>
</lfe:extendedIf>
</f:if>
</fieldset>
</f:for>
......@@ -51,5 +50,5 @@
<f:form.submit value="{f:translate(key:'button.save')}" />
</div>
</f:form>
</lfe:extendedIf>
</f:section>
\ No newline at end of file
</f:if>
</f:section>
......@@ -45,11 +45,11 @@
</div>
<f:for each="{constValues}" key="constKey" as="constValue" iteration="iterator">
<fieldset class="tx-lfeditor-fieldset bgColor5 {lfe:extendedIf(condition: iterator.isOdd, or: parallelEdit, then: 'tx-lfeditor-fleft', else: 'tx-lfeditor-fright')}">
<fieldset class="tx-lfeditor-fieldset bgColor5 {f:if(condition: '{iterator.isOdd} || {parallelEdit}', then: 'tx-lfeditor-fleft', else: 'tx-lfeditor-fright')}">
<legend class="bgColor3 tx-lfeditor-constantMaxWidth400" title="{languageSelection}:{constKey}">
{f:if(condition: '{languageSelection} == \'default\'', then: 'en', else: '{languageSelection}')}:{constKey}
</legend>
<lfe:extendedIf condition="{languageSelection} == {defaultLanguage}" and="{defaultLanguagePermission} != 1">
<f:if condition="{languageSelection} == {defaultLanguage} && {defaultLanguagePermission} != 1">
<f:then>
<f:form.textarea
cols="80" rows="{numTextAreaRows}"
......@@ -67,7 +67,7 @@
lang="{f:if(condition: '{languageSelection} == \'default\'', then: 'en', else: '{languageSelection}')}"
class="tx-lfeditor-textarea" />
</f:else>
</lfe:extendedIf>
</f:if>
<f:if condition="{constValue.default}">
<p class="tx-lfeditor-defaultTranslation bgColor3">
{constValue.default}
......@@ -79,7 +79,7 @@
<legend class="bgColor3 tx-lfeditor-constantMaxWidth400" title="{referenceLanguageSelection}:{constKey}">
{f:if(condition: '{referenceLanguageSelection} == \'default\'', then: 'en', else: '{referenceLanguageSelection}')}:{constKey}
</legend>
<lfe:extendedIf condition="{referenceLanguageSelection} == {defaultLanguage}" and="{defaultLanguagePermission} != 1">
<f:if condition="{referenceLanguageSelection} == {defaultLanguage} && {defaultLanguagePermission} != 1">
<f:then>
<f:form.textarea
cols="80" rows="{numTextAreaRows}"
......@@ -97,7 +97,7 @@
lang="{f:if(condition: '{referenceLanguageSelection} == \'default\'', then: 'en', else: '{referenceLanguageSelection}')}"
class="tx-lfeditor-textarea" />
</f:else>
</lfe:extendedIf>
</f:if>
<f:if condition="{constValue.default}">
<p class="tx-lfeditor-defaultTranslation bgColor3">
{constValue.default}
......@@ -119,4 +119,4 @@
</div>
</f:form>
</f:if>
</f:section>
\ No newline at end of file
</f:section>
......@@ -7,7 +7,7 @@
</f:section>
<f:section name="main">
<lfe:extendedIf condition="{languageFileSelection}" and="{infos}">
<f:if condition="{languageFileSelection} && {infos}">
<lfe:addJavaScriptFile javaScriptFile="{f:uri.resource(path: 'Scripts/GeneralTable.js')}" />
<h2 class="uppercase">
<f:translate key="function.general.general" />
......@@ -108,7 +108,7 @@
<legend class="bgColor3">
<f:translate key="function.general.options" />
</legend>
<lfe:extendedIf condition="{langFileExtension} != 'xlf'" and="{editingMode} != 'l10n'">
<f:if condition="{langFileExtension} != 'xlf' && {editingMode} != 'l10n'">
<fieldset class="bgColor4">
<legend class="bgColor3">
<f:translate key="function.general.split.split" />
......@@ -126,7 +126,7 @@
</label>
</p>
</fieldset>
</lfe:extendedIf>
</f:if>
<fieldset class="bgColor4">
<legend class="bgColor3">
......@@ -150,5 +150,5 @@
<f:form.submit id="tx-lfeditor-button-submit" value="{f:translate(key:'button.save')}" />
</div>
</f:form>
</lfe:extendedIf>
</f:section>
\ No newline at end of file
</f:if>
</f:section>
......@@ -16,7 +16,7 @@
</f:section>
<f:section name="main">
<lfe:extendedIf condition="{extensionSelection}" and="{backups}">
<f:if condition="{extensionSelection} && {backups}">
<h2 class="uppercase">
<f:translate key="function.backupMgr.backupMgr" />
</h2>
......@@ -140,5 +140,5 @@
</f:for>
</fieldset>
</f:if>
</lfe:extendedIf>
</f:section>
\ No newline at end of file
</f:if>
</f:section>
......@@ -10,8 +10,7 @@
</f:section>
<f:section name="main">
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}"
and2="{constantSelection}" and3="{constantSelection} != '###default###'">
<f:if condition="{extensionSelection} && {languageFileSelection} && {constantSelection} && {constantSelection} != '###default###'">
<h2 class="uppercase">
<f:translate key="function.const.rename.rename" />
</h2>
......@@ -28,5 +27,5 @@
<f:form.submit id="tx-lfeditor-button-submit" value="{f:translate(key:'button.rename')}" />
</div>
</f:form>
</lfe:extendedIf>
</f:section>
\ No newline at end of file
</f:if>
</f:section>
......@@ -7,7 +7,7 @@
</f:section>
<f:section name="main">
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}">
<f:if condition="{extensionSelection} && {languageFileSelection}">
<h2 class="uppercase">
<f:translate key="function.const.search.search" />
</h2>
......@@ -51,5 +51,5 @@
</fieldset>
</f:if>
</f:form>
</lfe:extendedIf>
</f:section>
\ No newline at end of file
</f:if>
</f:section>
......@@ -10,7 +10,7 @@
</f:section>
<f:section name="main">
<lfe:extendedIf condition="{extensionSelection}" and="{languageFileSelection}" and2="{languageSelection}" and3="{fluidTree}">
<f:if condition="{extensionSelection} && {languageFileSelection} && {languageSelection} && {fluidTree}">
<f:form id="contentForm" action="selectExplodeToken">
<h2 class="uppercase">
<f:translate key="select.explodeToken" />
......@@ -63,5 +63,5 @@
</fieldset>
</fieldset>
</f:form>
</lfe:extendedIf>
</f:section>
\ No newline at end of file
</f:if>
</f:section>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment