Commit 86f42bc5 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] FormEngine: The factory

Creation of container and elements instances in the FormEngine is
hard coded and hard to overwrite or adapt.
The patch extends the existing NodeFactory with resolver code to
find an appropriate class for a given requested type. All FormEngine
internal container and element requests are now routed through
NodeFactory. This allows to loosen the strict dependency between
TCA config "type" to an implementing class by moving the resolving
code into the factory. This is done for SelectElement which is now
split into multiple smaller classes - one for each display type. The
NodeFactory is covered by unit tests since the resolving code will
become more complex and fine grained in the future.
As a side effect the patch resolves a hack in the FormDataTraverser
which no longer calls internal stuff of the select element.
The NodeFactory is prepared to be extended with an API for extensions
to steer and overwrite default implementations. This will be added
with a next patch.

Change-Id: I2253a0fe3240366d0d271a3cd82119ce3dc52012
Resolves: #67006
Releases: master
Reviewed-on: http://review.typo3.org/39517

Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 5569bee6
<?php
namespace TYPO3\CMS\Backend;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Generic backend exception
*/
class Exception extends \Exception {
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Base class for container and single elements - their abstracts extend from here.
*/
abstract class AbstractNode {
abstract class AbstractNode implements NodeInterface {
/**
* A list of global options given from parent to child elements
......
......@@ -18,6 +18,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Form\FlexFormsHelper;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Entry container to a flex form element. This container is created by
......@@ -76,9 +77,10 @@ class FlexFormContainer extends AbstractContainer {
$options = $this->globalOptions;
$options['flexFormDataStructureArray'] = $flexFormDataStructureArray;
$options['flexFormRowData'] = $flexFormRowData;
/** @var FlexFormLanguageContainer $flexFormLanguageContainer */
$flexFormLanguageContainer = GeneralUtility::makeInstance(FlexFormLanguageContainer::class);
return $flexFormLanguageContainer->setGlobalOptions($options)->render();
$options['type'] = 'flexFormLanguageContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
return $nodeFactory->create($options)->render();
}
/**
......
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Form\Container;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Flex form container implementation
......@@ -94,9 +95,10 @@ class FlexFormContainerContainer extends AbstractContainer {
$options['flexFormFieldIdentifierPrefix'] = $flexFormFieldIdentifierPrefix;
// Append container specific stuff to field prefix
$options['flexFormFormPrefix'] = $flexFormFormPrefix . '[' . $flexFormContainerCounter . '][' . $this->globalOptions['flexFormContainerName'] . '][el]';
/** @var FlexFormElementContainer $containerContent */
$containerContent = GeneralUtility::makeInstance(FlexFormElementContainer::class);
$containerContentResult = $containerContent->setGlobalOptions($options)->render();
$options['type'] = 'flexFormElementContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$containerContentResult = $nodeFactory->create($options)->render();
$html = array();
$html[] = '<div id="' . $flexFormFieldIdentifierPrefix . '" class="t3-form-field-container-flexsections t3-flex-section">';
......
......@@ -78,9 +78,10 @@ class FlexFormElementContainer extends AbstractContainer {
$options['flexFormRowData'] = is_array($flexFormRowData[$flexFormFieldName]['el']) ? $flexFormRowData[$flexFormFieldName]['el'] : array();
$options['flexFormSectionType'] = $flexFormFieldName;
$options['flexFormSectionTitle'] = $sectionTitle;
/** @var FlexFormSectionContainer $sectionContainer */
$sectionContainer = GeneralUtility::makeInstance(FlexFormSectionContainer::class);
$sectionContainerResult = $sectionContainer->setGlobalOptions($options)->render();
$options['type'] = 'flexFormSectionContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$sectionContainerResult = $nodeFactory->create($options)->render();
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $sectionContainerResult);
} else {
// Single element
......@@ -146,10 +147,10 @@ class FlexFormElementContainer extends AbstractContainer {
$options = $this->globalOptions;
$options['parameterArray'] = $fakeParameterArray;
$options['elementBaseName'] = $this->globalOptions['elementBaseName'] . $flexFormFormPrefix . '[' . $flexFormFieldName . '][' . $vDEFkey . ']';
$options['type'] = $flexFormFieldArray['TCEforms']['config']['type'];
/** @var NodeFactory $nodeFactory */
$nodeFactory = GeneralUtility::makeInstance(NodeFactory::class);
$child = $nodeFactory->create($flexFormFieldArray['TCEforms']['config']['type']);
$childResult = $child->setGlobalOptions($options)->render();
$nodeFactory = $this->globalOptions['nodeFactory'];
$childResult = $nodeFactory->create($options)->render();
$theTitle = htmlspecialchars($fakeParameterArray['fieldConf']['label']);
$defInfo = array();
......
......@@ -20,6 +20,7 @@ use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Handle flex form language overlays.
......@@ -98,14 +99,16 @@ class FlexFormLanguageContainer extends AbstractContainer {
$options['flexFormCurrentLanguage'] = $flexFormCurrentLanguage;
$options['flexFormNoEditDefaultLanguage'] = $flexFormNoEditDefaultLanguage;
if (!$hasTabs) {
/** @var FlexFormNoTabsContainer $flexFormNoTabsContainer */
$flexFormNoTabsContainer = GeneralUtility::makeInstance(FlexFormNoTabsContainer::class);
$flexFormNoTabsResult = $flexFormNoTabsContainer->setGlobalOptions($options)->render();
$options['type'] = 'flexFormNoTabsContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$flexFormNoTabsResult = $nodeFactory->create($options)->render();
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $flexFormNoTabsResult);
} else {
/** @var FlexFormTabsContainer $flexFormTabsContainer */
$flexFormTabsContainer = GeneralUtility::makeInstance(FlexFormTabsContainer::class);
$flexFormTabsContainerResult = $flexFormTabsContainer->setGlobalOptions($options)->render();
$options['type'] = 'flexFormTabsContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$flexFormTabsContainerResult = $nodeFactory->create($options)->render();
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $flexFormTabsContainerResult);
}
}
......
......@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Backend\Form\Container;
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Handle a flex form that has no tabs.
......@@ -77,9 +78,10 @@ class FlexFormNoTabsContainer extends AbstractContainer {
$options['flexFormFormPrefix'] = '[data][' . $flexFormSheetNameInRowData . '][' . $flexFormCurrentLanguage . ']';
$options['parameterArray'] = $parameterArray;
/** @var FlexFormElementContainer $flexFormElementContainer */
$flexFormElementContainer = GeneralUtility::makeInstance(FlexFormElementContainer::class);
return $flexFormElementContainer->setGlobalOptions($options)->render();
$options['type'] = 'flexFormElementContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
return $nodeFactory->create($options)->render();
}
}
......@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Handle flex form sections.
......@@ -75,9 +76,10 @@ class FlexFormSectionContainer extends AbstractContainer {
$options['flexFormContainerCounter'] = $flexFormContainerCounter;
$options['flexFormContainerTitle'] = $sectionTitle;
$options['flexFormContainerElementCollapsed'] = (bool)$existingSectionContainerData['el']['_TOGGLE'];
/** @var FlexFormContainerContainer $flexFormContainerContainer */
$flexFormContainerContainer = GeneralUtility::makeInstance(FlexFormContainerContainer::class);
$flexFormContainerContainerResult = $flexFormContainerContainer->setGlobalOptions($options)->render();
$options['type'] = 'flexFormContainerContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$flexFormContainerContainerResult = $nodeFactory->create($options)->render();
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $flexFormContainerContainerResult);
}
}
......@@ -103,9 +105,10 @@ class FlexFormSectionContainer extends AbstractContainer {
$options['flexFormContainerCounter'] = $flexFormFieldIdentifierPrefix . '-form';
$options['flexFormContainerTitle'] = $sectionTitle;
$options['flexFormContainerElementCollapsed'] = FALSE;
/** @var FlexFormContainerContainer $flexFormContainerContainer */
$flexFormContainerContainerTemplate = GeneralUtility::makeInstance(FlexFormContainerContainer::class);
$flexFormContainerContainerTemplateResult = $flexFormContainerContainerTemplate->setGlobalOptions($options)->render();
$options['type'] = 'flexFormContainerContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$flexFormContainerContainerTemplateResult = $nodeFactory->create($options)->render();
$uniqueId = str_replace('.', '', uniqid('idvar', TRUE));
$identifierPrefixJs = 'replace(/' . $flexFormFieldIdentifierPrefix . '-/g,"' . $flexFormFieldIdentifierPrefix . '-"+' . $uniqueId . '+"-")';
......
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Form\Container;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Handle flex forms that have tabs (multiple "sheets").
......@@ -91,9 +92,10 @@ class FlexFormTabsContainer extends AbstractContainer {
'tab',
$tabIdString . '-' . $tabCounter,
);
/** @var FlexFormElementContainer $flexFormElementContainer */
$flexFormElementContainer = GeneralUtility::makeInstance(FlexFormElementContainer::class);
$childReturn = $flexFormElementContainer->setGlobalOptions($options)->render();
$options['type'] = 'flexFormElementContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$childReturn = $nodeFactory->create($options)->render();
$tabsContent[] = array(
'label' => !empty($sheetDataStructure['ROOT']['TCEforms']['sheetTitle']) ? $languageService->sL($sheetDataStructure['ROOT']['TCEforms']['sheetTitle']) : $sheetName,
......
......@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Form\Container;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* A container rendering a "full record". This is an entry container used as first
......@@ -103,15 +104,15 @@ class FullRecordContainer extends AbstractContainer {
$options['additionalPreviewLanguageData'] = $this->additionalPreviewLanguageData;
if ($hasTabs) {
/** @var TabsContainer $TabsContainer */
$container = GeneralUtility::makeInstance(TabsContainer::class);
$container->setGlobalOptions($options);
$resultArray = $container->render();
$options['type'] = 'tabsContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$resultArray = $nodeFactory->create($options)->render();
} else {
/** @var NoTabsContainer $NoTabsContainer */
$container = GeneralUtility::makeInstance(NoTabsContainer::class);
$container->setGlobalOptions($options);
$resultArray = $container->render();
$options['type'] = 'noTabsContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$resultArray = $nodeFactory->create($options)->render();
}
return $resultArray;
......
......@@ -26,6 +26,7 @@ use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\InlineRelatedRecordResolver;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Inline element entry container.
......@@ -222,9 +223,10 @@ class InlineControlContainer extends AbstractContainer {
$options['inlineRelatedRecordConfig'] = $config;
$options['inlineData'] = $this->inlineData;
$options['inlineStructure'] = $inlineStackProcessor->getStructure();
/** @var InlineRecordContainer $inlineRecordContainer */
$inlineRecordContainer = GeneralUtility::makeInstance(InlineRecordContainer::class);
$childArray = $inlineRecordContainer->setGlobalOptions($options)->render();
$options['type'] = 'inlineRecordContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$childArray = $nodeFactory->create($options)->render();
$html .= $childArray['html'];
$childArray['html'] = '';
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $childArray);
......@@ -654,4 +656,4 @@ class InlineControlContainer extends AbstractContainer {
return $GLOBALS['LANG'];
}
}
\ No newline at end of file
}
......@@ -30,6 +30,7 @@ use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\InlineRelatedRecordResolver;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Render a single inline record relation.
......@@ -216,9 +217,10 @@ class InlineRecordContainer extends AbstractContainer {
$domObjectId . '-' . $table . '-' . $row['uid'],
);
$options['overruleTypesArray'] = $overruleTypesArray;
/** @var FullRecordContainer $entryContainer */
$entryContainer = GeneralUtility::makeInstance(FullRecordContainer::class);
return $entryContainer->setGlobalOptions($options)->render();
$options['type'] = 'fullRecordContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
return $nodeFactory->create($options)->render();
}
/**
......
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Form\Container;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Render a given list of field of a TCA table.
......@@ -71,10 +72,10 @@ class ListOfFieldsContainer extends AbstractContainer {
$options = $this->globalOptions;
$options['fieldsArray'] = $finalFieldsConfiguration;
/** @var PaletteAndSingleContainer $paletteAndSingleContainer */
$paletteAndSingleContainer = GeneralUtility::makeInstance(PaletteAndSingleContainer::class);
$paletteAndSingleContainer->setGlobalOptions($options);
return $paletteAndSingleContainer->render();
$options['type'] = 'paletteAndSingleContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
return $nodeFactory->create($options)->render();
}
/**
......
......@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Backend\Form\Container;
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Handle a record that has no tabs.
......@@ -30,10 +31,11 @@ class NoTabsContainer extends AbstractContainer {
* @return array As defined in initializeResultArray() of AbstractNode
*/
public function render() {
/** @var PaletteAndSingleContainer $paletteAndSingleContainer */
$paletteAndSingleContainer = GeneralUtility::makeInstance(PaletteAndSingleContainer::class);
$paletteAndSingleContainer->setGlobalOptions($this->globalOptions);
$resultArray = $paletteAndSingleContainer->render();
$options = $this->globalOptions;
$options['type'] = 'paletteAndSingleContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$resultArray = $nodeFactory->create($options)->render();
$resultArray['html'] = '<div class="tab-content">' . $resultArray['html'] . '</div>';
return $resultArray;
}
......
......@@ -19,6 +19,7 @@ use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Handle palettes and single fields.
......@@ -136,10 +137,10 @@ class PaletteAndSingleContainer extends AbstractContainer {
$options['fieldName'] = $fieldName;
$options['fieldExtra'] = $fieldConfiguration['fieldExtra'];
/** @var SingleFieldContainer $singleFieldContainer */
$singleFieldContainer = GeneralUtility::makeInstance(SingleFieldContainer::class);
$singleFieldContainer->setGlobalOptions($options);
$childResultArray = $singleFieldContainer->render();
$options['type'] = 'singleFieldContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$childResultArray = $nodeFactory->create($options)->render();
if (!empty($childResultArray['html'])) {
$mainStructureCounter ++;
......@@ -260,10 +261,10 @@ class PaletteAndSingleContainer extends AbstractContainer {
$options['fieldName'] = $fieldName;
$options['fieldExtra'] = $fieldArray['fieldExtra'];
/** @var SingleFieldContainer $singleFieldContainer */
$singleFieldContainer = GeneralUtility::makeInstance(SingleFieldContainer::class);
$singleFieldContainer->setGlobalOptions($options);
$singleFieldContentArray = $singleFieldContainer->render();
$options['type'] = 'singleFieldContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$singleFieldContentArray = $nodeFactory->create($options)->render();
if (!empty($singleFieldContentArray['html'])) {
$foundRealElement = TRUE;
......
......@@ -25,7 +25,6 @@ use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Utility\DiffUtility;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Backend\Form\Element\NoneElement;
/**
* Container around a "single field".
......@@ -160,10 +159,10 @@ class SingleFieldContainer extends AbstractContainer {
$options = $this->globalOptions;
$options['parameterArray'] = $parameterArray;
$options['elementBaseName'] = $newElementBaseName;
/** @var NodeFactory $childFactory */
$childFactory = GeneralUtility::makeInstance(NodeFactory::class);
$childElement = $childFactory->create($parameterArray['fieldConf']['config']['type']);
$resultArray = $childElement->setGlobalOptions($options)->render();
$options['type'] = $parameterArray['fieldConf']['config']['type'];
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$resultArray = $nodeFactory->create($options)->render();
$html = $resultArray['html'];
// @todo: the language handling, the null and the placeholder stuff should be embedded in the single
......@@ -253,9 +252,10 @@ class SingleFieldContainer extends AbstractContainer {
$options['table'] = '';
$options['parameterArray'] = $parameterArray;
$options['parameterArray']['itemFormElValue'] = GeneralUtility::fixed_lgd_cs($placeholder, 30);
/** @var NoneElement $noneElement */
$noneElement = GeneralUtility::makeInstance(NoneElement::class);
$noneElementResult = $noneElement->setGlobalOptions($options)->render();
$options['type'] = 'none';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$noneElementResult = $nodeFactory->create($options)->render();
$noneElementHtml = $noneElementResult['html'];
$placeholderWrap = array();
......
......@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Form\Container;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* An entry container to render just a single field.
......@@ -69,10 +70,10 @@ class SoloFieldContainer extends AbstractContainer {
$options['fieldName'] = $fieldName;
$options['fieldExtra'] = $fieldConfiguration['fieldExtra'];
/** @var SingleFieldContainer $singleFieldContainer */
$singleFieldContainer = GeneralUtility::makeInstance(SingleFieldContainer::class);
$singleFieldContainer->setGlobalOptions($options);
$resultArray = $singleFieldContainer->render();
$options['type'] = 'singleFieldContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$resultArray = $nodeFactory->create($options)->render();
}
}
}
......
......@@ -15,8 +15,8 @@ namespace TYPO3\CMS\Backend\Form\Container;
*/
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Render all tabs of a record that has tabs.
......@@ -86,11 +86,11 @@ class TabsContainer extends AbstractContainer {
foreach ($elements as $element) {
$options['fieldsArray'][] = implode(';', $element);
}
/** @var PaletteAndSingleContainer $paletteAndSingleContainer */
$paletteAndSingleContainer = GeneralUtility::makeInstance(PaletteAndSingleContainer::class);
$paletteAndSingleContainer->setGlobalOptions($options);
$options['type'] = 'paletteAndSingleContainer';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$childArray = $nodeFactory->create($options)->render();
$childArray = $paletteAndSingleContainer->render();
$tabsContent[] = array(
'label' => $tabWithLabelAndElements['label'],
'content' => $childArray['html'],
......
......@@ -30,6 +30,7 @@ use TYPO3\CMS\Backend\Form\DatabaseFileIconsHookInterface;
use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Base class for form elements of FormEngine. Contains several helper methods used by single elements.
......@@ -429,16 +430,17 @@ abstract class AbstractFormElement extends AbstractNode {
// Setting the item to a hidden-field.
$item = $itemKinds[1];
if (is_array($wizardConfiguration['hideParent'])) {
/** @var NoneElement $noneElement */
$noneElement = GeneralUtility::makeInstance(NoneElement::class);
$noneElementOptions = $this->globalOptions;
$noneElementOptions['parameterArray'] = array(
$options = $this->globalOptions;
$options['parameterArray'] = array(
'fieldConf' => array(
'config' => $wizardConfiguration['hideParent'],
),
'itemFormElValue' => $PA['itemFormElValue'],
);
$noneElementResult = $noneElement->setGlobalOptions($noneElementOptions)->render();
$options['type'] = 'none';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$noneElementResult = $nodeFactory->create($options)->render();
$item .= $noneElementResult['html'];
}
}
......
......@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Extbase\Utility\ArrayUtility;
use TYPO3\CMS\Backend\Form\NodeFactory;
/**
* Generation of image manipulation TCEform element
......@@ -68,15 +69,17 @@ class ImageManipulationElement extends AbstractFormElement {
}
if ($this->isGlobalReadonly() || $config['readOnly']) {
$formEngineDummy = new FormEngine();
$noneElement = GeneralUtility::makeInstance(NoneElement::class, $formEngineDummy);
$elementConfiguration = array(
$options = array();
$options['parameterArray'] = array(
'fieldConf' => array(
'config' => $config,
),
'itemFormElValue' => $parameterArray['itemFormElValue'],
);
return $noneElement->render('', '', '', $elementConfiguration);
$options['type'] = 'none';
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
return $nodeFactory->create($options)->render();
}
$file = $this->getFile($row, $config['file_field']);
......
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