Bug #86876

TCA columnsOverrides ignores default value

Added by Roman B├╝chler 3 months ago. Updated about 2 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2018-11-07
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Defining a differnet default value for a field in the 'types' array doesn't work.

For example it would be useful to set the default frame for a content element of type gridelement_pi1 to none. To do so the TCA might be overriden as following:

File: ext/myplugin/Configuration/TCA/Overrides/gridelements.php
File content:

$columnsOverrides = [];
$columnsOverrides['frame_class']['config'] = [
    'default' => 'none',
];
$GLOBALS['TCA']['tt_content']['types']['gridelements_pi1'] = array_merge(
    $GLOBALS['TCA']['tt_content']['types']['gridelements_pi1'],
    ['columnsOverrides' => $columnsOverrides]
);

History

#1 Updated by Michael Stucki 3 months ago

  • Status changed from New to Closed

Wrong project!

#2 Updated by Michael Stucki 3 months ago

  • Project changed from forge.typo3.org to TYPO3 Core
  • Status changed from Closed to New
  • TYPO3 Version set to 9

#3 Updated by Thomas Goetz about 2 months ago

  • Subject changed from TCA columnsOverrides default to TCA columnsOverrides ignores default value
  • PHP Version set to 7.2

I have the same problem. I've defined the field `author` in tt_content table:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
    'tt_content',
    [
        'author' => [
            'config' => [
                'type' => 'input',
                'size' => 30,
            ],
            'exclude' => '1',
            'label' => 'Autor',
        ],
    ]
);

I added this field to my own CE 'myext_quotation'.
When I add 'default' => 'Test' into the `addTCAcolumns`, it is perfectly working with my CE.

But now I override the filed for my CE `myext_quotation` like this:

$GLOBALS['TCA']['tt_content']['types']['myext_quotation'] = [
    'columnsOverrides' => [
        'author' => [
            'config' => [
                'type' => 'input',
                'default' => 'Hallo',
            ],
        ],
    ],
];

When I now add a new element of this Type, the field has the value of the 'addTCAcolumns' block.
If i leave the default value initially empty and then override the filed it gets ignored.

Also available in: Atom PDF