Issue Feature Rejected

#100195Make Shortcut Target [shortcut] a required field for pages.doktype = 4 (Shortcut)

Sybille Peters 03/17/23, 09:00 updated 06/10/24, 15:30

Description

is a bit difficult to solve:

!!! If shortcut_mode != 0, the shortcut is not necessary. So we can’t just make it a required field in this case.
!!! If we add a displayCond (see below) and make it reuqired, we can’t switch from shortcut_mode = 0 to shortcut_mode != 0 and empty ‘shortcut’ (because due to the displayCond the form would be saved and this is prevented by the required)

1. shortcut should only be displayed if shortcut_mode=0
2. if displayed, shortcut should be required
3. ?? if a translation, empty shortcut seems to be ok as well (though other fields behave differently)

Thus, the following code cannot be used:

Configuration/TCA/Overrides/pages.php:

    // condition: show shortcut if shortcut_mode = 0
    $GLOBALS['TCA']['pages']['columns']['shortcut']['displayCond'] = 'FIELD:shortcut_mode:=:0';

    // override type "shortcut": make it a a required field
    $GLOBALS['TCA']['pages']['types'][(string)\TYPO3\CMS\Core\Domain\Repository\PageRepository::DOKTYPE_SHORTCUT]['columnsOverrides'] =
    [
        'shortcut' => [
            'config' => [
                'eval' => 'required',
            ],
        ],
    ];

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.