Project

General

Profile

Actions

Bug #102269

open

TCA Type Slug generatorOptions - postModifiers in combination with columnsOnly

Added by Henrik Jensen 7 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-10-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

No data to display

Actions

Also available in: Atom PDF