Commit a208e8f6 authored by Christian Weiske's avatar Christian Weiske Committed by Markus Klein
Browse files

[FEATURE] Make new content element wizard tab sort order configurable

It is possible to influence the order of the tabs in the new
content element wizard by setting "before" and "after" values in
Page TSconfig:

    mod.wizards.newContentElement.wizardItems.special.before = common
    mod.wizards.newContentElement.wizardItems.forms.after = common,special

Releases: master
Resolves: #71876
Change-Id: I67ed31535394f16d0437563aa405c6e92a56e0fe
Reviewed-on: https://review.typo3.org/44976

Reviewed-by: Alexander Stehlik's avatarAlexander Stehlik <alexander.stehlik@gmail.com>
Tested-by: Alexander Stehlik's avatarAlexander Stehlik <alexander.stehlik@gmail.com>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
parent 1c1cebe1
......@@ -24,6 +24,7 @@ use TYPO3\CMS\Backend\Wizard\NewContentElementWizardHookInterface;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Service\DependencyOrderingService;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
......@@ -370,6 +371,12 @@ class NewContentElementController extends AbstractModule
$wizards = $this->config['wizardItems.'];
$appendWizards = $this->wizard_appendWizards($wizards['elements.']);
if (is_array($wizards)) {
foreach ($wizards as $groupKey => $wizardGroup) {
$this->prepareDependencyOrdering($wizards[$groupKey], 'before');
$this->prepareDependencyOrdering($wizards[$groupKey], 'after');
}
$wizards = GeneralUtility::makeInstance(DependencyOrderingService::class)->orderByDependencies($wizards);
foreach ($wizards as $groupKey => $wizardGroup) {
$groupKey = rtrim($groupKey, '.');
$showItems = GeneralUtility::trimExplode(',', $wizardGroup['show'], true);
......@@ -537,6 +544,22 @@ class NewContentElementController extends AbstractModule
}
}
/**
* Prepare a wizard tab configuration for sorting.
*
* @param array $wizardGroup TypoScript wizard tab configuration
* @param string $key Which array key should be prepared
*
* @return void
*/
protected function prepareDependencyOrdering(&$wizardGroup, $key)
{
if (isset($wizardGroup[$key])) {
$wizardGroup[$key] = GeneralUtility::trimExplode(',', $wizardGroup[$key]);
$wizardGroup[$key] = array_map(function ($s) {return $s . '.';}, $wizardGroup[$key]);
}
}
/**
* Returns LanguageService
*
......
=============================================================================
Feature: #71876 - Make new content element wizard tab sort order configurable
=============================================================================
Description
===========
It is possible to influence the order of the tabs in the new content element
wizard by setting ``before`` and ``after`` values in Page TSconfig:
.. code-block:: typoscript
mod.wizards.newContentElement.wizardItems.special.before = common
mod.wizards.newContentElement.wizardItems.forms.after = common,special
Supports Markdown
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