‪TYPO3CMS  ‪main
TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController Class Reference

Public Member Functions

 __construct (protected readonly UriBuilder $uriBuilder, protected readonly BackendViewFactory $backendViewFactory, protected readonly EventDispatcherInterface $eventDispatcher, protected readonly DependencyOrderingService $dependencyOrderingService,)
 
 handleRequest (ServerRequestInterface $request)
 
array< string, migrateCommonGroupToDefault(array $wizardsFromPageTs):array { if(!array_key_exists( 'common.', $wizardsFromPageTs)) { return $wizardsFromPageTs;} if( $wizardsFromPageTs[ 'default.'][ 'elements.'][ 'removeItems'] ?? false) { $wizardsFromPageTs[ 'default.'][ 'removeItems']=GeneralUtility::trimExplode(',', $wizardsFromPageTs[ 'default.'][ 'elements.'][ 'removeItems'] ?? '', true);} elseif( $wizardsFromPageTs[ 'default.'][ 'removeItems'] ?? false) { $wizardsFromPageTs[ 'default.'][ 'removeItems']=GeneralUtility::trimExplode(',', $wizardsFromPageTs[ 'default.'][ 'removeItems'], true);} if( $wizardsFromPageTs[ 'common.'][ 'elements.'][ 'removeItems'] ?? false) { $wizardsFromPageTs[ 'common.'][ 'removeItems']=GeneralUtility::trimExplode(',', $wizardsFromPageTs[ 'common.'][ 'elements.'][ 'removeItems'] ?? '', true);} elseif( $wizardsFromPageTs[ 'common.'][ 'removeItems'] ?? false) { $wizardsFromPageTs[ 'common.'][ 'removeItems']=GeneralUtility::trimExplode(',', $wizardsFromPageTs[ 'common.'][ 'removeItems'], true);} $defaultItems=array_merge_recursive( $wizardsFromPageTs[ 'default.'] ??[], $wizardsFromPageTs[ 'common.']);unset( $wizardsFromPageTs[ 'common.']);if( $defaultItems !==[]) { $wizardsFromPageTs[ 'default.']=$defaultItems;} return $wizardsFromPageTs;} protected getAppendWizards(array $wizardElements):array { $returnElements=[];foreach( $wizardElements as $key=> $wizardItem) { preg_match('/^[a-zA-Z0-9]+_/', $key, $group);$wizardGroup=$group[0] ? substr( $group[0], 0, -1) . '.' :$key;$returnElements[ $wizardGroup][ 'elements.'][substr( $key, strlen( $wizardGroup)) . '.']=$wizardItem;} return $returnElements;} protected function prepareWizardItem(array $itemConf):array { $itemConf=array_replace_recursive($itemConf,['title'=> trim( $this->getLanguageService() ->sL( $itemConf[ 'title'] ?? '')), 'description'=> trim( $this->getLanguageService() ->sL( $itemConf[ 'description'] ?? '')), 'iconIdentifier'=> $itemConf[ 'iconIdentifier'] ?? null, 'saveAndClose'=>bool)( $itemConf[ 'saveAndClose'] ?? false), 'defaultValues'=> unset ($itemConf['tt_content_defValues'], $itemConf['tt_content_defValues.'])
 

Public Attributes

return $itemConf
 

Protected Member Functions

 wizardAction (ServerRequestInterface $request)
 
 positionMapAction (ServerRequestInterface $request)
 
 getWizards ()
 
 loadAvailableWizardsFromContentElements ()
 
 loadAvailableWizardsFromPluginSubTypes ()
 
 loadAvailableWizards (string $typeField, bool $isPluginSubType=false)
 
array< string, migrateCommonGroupToDefault(array $wizardsFromPageTs):array { if(!array_key_exists( 'common.', $wizardsFromPageTs)) { return $wizardsFromPageTs;} if( $wizardsFromPageTs[ 'default.'][ 'elements.'][ 'removeItems'] ?? false) { $wizardsFromPageTs[ 'default.'][ 'removeItems']=GeneralUtility::trimExplode(',', $wizardsFromPageTs[ 'default.'][ 'elements.'][ 'removeItems'] ?? '', true);} elseif( $wizardsFromPageTs[ 'default.'][ 'removeItems'] ?? false) { $wizardsFromPageTs[ 'default.'][ 'removeItems']=GeneralUtility::trimExplode(',', $wizardsFromPageTs[ 'default.'][ 'removeItems'], true);} if( $wizardsFromPageTs[ 'common.'][ 'elements.'][ 'removeItems'] ?? false) { $wizardsFromPageTs[ 'common.'][ 'removeItems']=GeneralUtility::trimExplode(',', $wizardsFromPageTs[ 'common.'][ 'elements.'][ 'removeItems'] ?? '', true);} elseif( $wizardsFromPageTs[ 'common.'][ 'removeItems'] ?? false) { $wizardsFromPageTs[ 'common.'][ 'removeItems']=GeneralUtility::trimExplode(',', $wizardsFromPageTs[ 'common.'][ 'removeItems'], true);} $defaultItems=array_merge_recursive( $wizardsFromPageTs[ 'default.'] ??[], $wizardsFromPageTs[ 'common.']);unset( $wizardsFromPageTs[ 'common.']);if( $defaultItems !==[]) { $wizardsFromPageTs[ 'default.']=$defaultItems;} return $wizardsFromPageTs;} protected function getAppendWizards(array $wizardElements):array { $returnElements=[];foreach( $wizardElements as $key=> $wizardItem) { preg_match('/^[a-zA-Z0-9]+_/', $key, $group);$wizardGroup=$group[0] ? substr( $group[0], 0, -1) . '.' :$key;$returnElements[ $wizardGroup][ 'elements.'][substr( $key, strlen( $wizardGroup)) . '.']=$wizardItem;} return $returnElements;} protected function prepareWizardItem(array $itemConf):array { $itemConf=array_replace_recursive($itemConf,['title'=> trim( $this->getLanguageService() ->sL( $itemConf[ 'title'] ?? '')), 'description'=> trim( $this->getLanguageService() ->sL( $itemConf[ 'description'] ?? '')), 'iconIdentifier'=> $itemConf[ 'iconIdentifier'] ?? null, 'saveAndClose'=>bool)( $itemConf[ 'saveAndClose'] ?? false), 'defaultValues'=> array_replace_recursive ( $itemConf['tt_content_defValues'] ??[], $itemConf['tt_content_defValues.'] ??[], $itemConf['defaultValues'] ??[])
 
 removeWizardsByPageTs (array $wizards, mixed $wizardsItemsPageTs)
 
 removeInvalidWizardItems (array $wizardItems)
 
 prepareDependencyOrdering (array $wizardGroup, string $key)
 
 getLanguageService ()
 
 getBackendUser ()
 

Protected Attributes

int $id = 0
 
int $uid_pid = 0
 
array $pageInfo = []
 
int $sys_language = 0
 
string $returnUrl = ''
 
int null $colPos = null
 

Detailed Description

New Content element wizard. This is the modal that pops up when clicking "+content" in page module, which will trigger wizardAction() since there is a colPos given. Method positionMapAction() is triggered for instance from the list module "+content" on tt_content table header, and from list module doc-header "+" and then "Click here for wizard".

This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.

Definition at line 47 of file NewContentElementController.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::__construct ( protected readonly UriBuilder  $uriBuilder,
protected readonly BackendViewFactory  $backendViewFactory,
protected readonly EventDispatcherInterface  $eventDispatcher,
protected readonly DependencyOrderingService  $dependencyOrderingService 
)

Definition at line 60 of file NewContentElementController.php.

Member Function Documentation

◆ array_replace_recursive()

array<string, migrateCommonGroupToDefault(array $wizardsFromPageTs): array { if (!array_key_exists('common.', $wizardsFromPageTs)) { return $wizardsFromPageTs; } if ($wizardsFromPageTs['default.']['elements.']['removeItems'] ?? false) { $wizardsFromPageTs['default.']['removeItems'] = GeneralUtility::trimExplode(',', $wizardsFromPageTs['default.']['elements.']['removeItems'] ?? '', true); } elseif ($wizardsFromPageTs['default.']['removeItems'] ?? false) { $wizardsFromPageTs['default.']['removeItems'] = GeneralUtility::trimExplode(',', $wizardsFromPageTs['default.']['removeItems'], true); } if ($wizardsFromPageTs['common.']['elements.']['removeItems'] ?? false) { $wizardsFromPageTs['common.']['removeItems'] = GeneralUtility::trimExplode(',', $wizardsFromPageTs['common.']['elements.']['removeItems'] ?? '', true); } elseif ($wizardsFromPageTs['common.']['removeItems'] ?? false) { $wizardsFromPageTs['common.']['removeItems'] = GeneralUtility::trimExplode(',', $wizardsFromPageTs['common.']['removeItems'], true); } $defaultItems = array_merge_recursive($wizardsFromPageTs['default.'] ?? [], $wizardsFromPageTs['common.']); unset($wizardsFromPageTs['common.']); if ($defaultItems !== []) { $wizardsFromPageTs['default.'] = $defaultItems; } return $wizardsFromPageTs; } protected function getAppendWizards(array $wizardElements): array { $returnElements = []; foreach ($wizardElements as $key => $wizardItem) { preg_match('/^[a-zA-Z0-9]+_/', $key, $group); $wizardGroup = $group[0] ? substr($group[0], 0, -1) . '.' : $key; $returnElements[$wizardGroup]['elements.'][substr($key, strlen($wizardGroup)) . '.'] = $wizardItem; } return $returnElements; } protected function prepareWizardItem(array $itemConf): array { $itemConf = array_replace_recursive( $itemConf, [ 'title' => trim($this->getLanguageService()->sL($itemConf['title'] ?? '')), 'description' => trim($this->getLanguageService()->sL($itemConf['description'] ?? '')), 'iconIdentifier' => $itemConf['iconIdentifier'] ?? null, 'saveAndClose' =>bool)($itemConf['saveAndClose'] ?? false), 'defaultValues' => TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::array_replace_recursive (   $itemConf ??[ 'tt_content_defValues'][],
  $itemConf ??[ 'tt_content_defValues.'][],
  $itemConf ??[ 'defaultValues'][] 
)
protected

This method returns the wizard items, defined in Page TSconfig for b/w compatibility.

Additionally, it migrates previously defined wizard items in the common group to the new default group, which is defined in TCA.

Parameters
array<string,array>‪$wizardsFromPageTs
Returns
‪array<string, array>

Referenced by TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\getWizards(), and TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\loadAvailableWizards().

◆ getBackendUser()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::getBackendUser ( )
protected

◆ getLanguageService()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::getLanguageService ( )
protected

◆ getWizards()

◆ handleRequest()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::handleRequest ( ServerRequestInterface  $request)

◆ loadAvailableWizards()

◆ loadAvailableWizardsFromContentElements()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::loadAvailableWizardsFromContentElements ( )
protected

◆ loadAvailableWizardsFromPluginSubTypes()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::loadAvailableWizardsFromPluginSubTypes ( )
protected

◆ positionMapAction()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::positionMapAction ( ServerRequestInterface  $request)
protected

◆ prepareDependencyOrdering()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::prepareDependencyOrdering ( array  $wizardGroup,
string  $key 
)
protected

◆ removeInvalidWizardItems()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::removeInvalidWizardItems ( array  $wizardItems)
protected

Checks the array for elements which might contain invalid default values and will unset them! Looks for the "defaultValues" key in each element and if found it will traverse that array as fieldname / value pairs and check.

Definition at line 433 of file NewContentElementController.php.

References $GLOBALS, TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\getBackendUser(), TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\getLanguageService(), TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode(), and TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\unset().

Referenced by TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\getWizards().

◆ removeWizardsByPageTs()

TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::removeWizardsByPageTs ( array  $wizards,
mixed  $wizardsItemsPageTs 
)
protected

◆ unset()

array<string, migrateCommonGroupToDefault(array $wizardsFromPageTs): array { if (!array_key_exists('common.', $wizardsFromPageTs)) { return $wizardsFromPageTs; } if ($wizardsFromPageTs['default.']['elements.']['removeItems'] ?? false) { $wizardsFromPageTs['default.']['removeItems'] = GeneralUtility::trimExplode(',', $wizardsFromPageTs['default.']['elements.']['removeItems'] ?? '', true); } elseif ($wizardsFromPageTs['default.']['removeItems'] ?? false) { $wizardsFromPageTs['default.']['removeItems'] = GeneralUtility::trimExplode(',', $wizardsFromPageTs['default.']['removeItems'], true); } if ($wizardsFromPageTs['common.']['elements.']['removeItems'] ?? false) { $wizardsFromPageTs['common.']['removeItems'] = GeneralUtility::trimExplode(',', $wizardsFromPageTs['common.']['elements.']['removeItems'] ?? '', true); } elseif ($wizardsFromPageTs['common.']['removeItems'] ?? false) { $wizardsFromPageTs['common.']['removeItems'] = GeneralUtility::trimExplode(',', $wizardsFromPageTs['common.']['removeItems'], true); } $defaultItems = array_merge_recursive($wizardsFromPageTs['default.'] ?? [], $wizardsFromPageTs['common.']); unset($wizardsFromPageTs['common.']); if ($defaultItems !== []) { $wizardsFromPageTs['default.'] = $defaultItems; } return $wizardsFromPageTs; } protected getAppendWizards(array $wizardElements): array { $returnElements = []; foreach ($wizardElements as $key => $wizardItem) { preg_match('/^[a-zA-Z0-9]+_/', $key, $group); $wizardGroup = $group[0] ? substr($group[0], 0, -1) . '.' : $key; $returnElements[$wizardGroup]['elements.'][substr($key, strlen($wizardGroup)) . '.'] = $wizardItem; } return $returnElements; } protected function prepareWizardItem(array $itemConf): array { $itemConf = array_replace_recursive( $itemConf, [ 'title' => trim($this->getLanguageService()->sL($itemConf['title'] ?? '')), 'description' => trim($this->getLanguageService()->sL($itemConf['description'] ?? '')), 'iconIdentifier' => $itemConf['iconIdentifier'] ?? null, 'saveAndClose' =>bool)($itemConf['saveAndClose'] ?? false), 'defaultValues' => TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::unset (   $itemConf[ 'tt_content_defValues'],
  $itemConf[ 'tt_content_defValues.'] 
)

◆ wizardAction()

Member Data Documentation

◆ $colPos

int null TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::$colPos = null
protected

If set, the content is destined for a specific column.

Definition at line 58 of file NewContentElementController.php.

Referenced by TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\handleRequest().

◆ $id

int TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::$id = 0
protected

Definition at line 49 of file NewContentElementController.php.

◆ $itemConf

return TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::$itemConf

◆ $pageInfo

array TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::$pageInfo = []
protected

Definition at line 51 of file NewContentElementController.php.

◆ $returnUrl

string TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::$returnUrl = ''
protected

◆ $sys_language

int TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::$sys_language = 0
protected

◆ $uid_pid

int TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::$uid_pid = 0
protected

Definition at line 50 of file NewContentElementController.php.