Bug #102269
openTCA Type Slug generatorOptions - postModifiers in combination with columnsOnly
0%
Description
When editing the slug field for pages using columnsOnly the necessary title field is not included when there is a postModifier present.
In version 9 and below it looked like this
From 10.4 and forward:
in EditDocumentController (https://api.typo3.org/12.4/_edit_document_controller_8php_source.html)
protected function addSlugFieldsToColumnsOnly(array $queryParams): void { $data = $queryParams['edit'] ?? []; $data = array_keys($data); $table = reset($data); if ($this->columnsOnly && $table !== false && isset($GLOBALS['TCA'][$table])) { $fields = GeneralUtility::trimExplode(',', $this->columnsOnly, true); foreach ($fields as $field) { $postModifiers = $GLOBALS['TCA'][$table]['columns'][$field]['config']['generatorOptions']['postModifiers'] ?? []; if (isset($GLOBALS['TCA'][$table]['columns'][$field]) && $GLOBALS['TCA'][$table]['columns'][$field]['config']['type'] === 'slug' && (!is_array($postModifiers) || $postModifiers === []) ) { foreach ($GLOBALS['TCA'][$table]['columns'][$field]['config']['generatorOptions']['fields'] ?? [] as $fields) { $this->columnsOnly .= ',' . (is_array($fields) ? implode(',', $fields) : $fields); } } } } }
in combination with:
TCA/Overrides/pages.php
$GLOBALS['TCA']['pages']['columns']['slug']['config']['generatorOptions']['postModifiers'][] = \B13\Masi\SlugModifier::class . '->modifyGeneratedSlugForPage';
This scenario triggers this core error when pressing the recalculate slug button:
#1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Undefined array key "values" in /var/www/html/vendor/typo3/cms-backend/Classes/Controller/FormSlugAjaxController.php line 75
It seems that the postModifier condition (!is_array($postModifiers) || $postModifiers === []) in function addSlugFieldsToColumnsOnly is the culprit.
This bug seems to have be present since v10.4
Files