Issue Bug Closed

#95628NewContentElementController's "saveAndClose" functionality does create content elements with setting pi_flexform in tt_content to null

Denis Mir 10/13/21, 13:12 updated 06/08/24, 07:42

Description

When using the `NewContentElementController` and its `saveAndClose` functionality, the `pi_flexform` field gets set to `null` although a flexform is defined for the specific content element. As opposed to not using the `saveAndClose` functionality and saving the content element manually which fills the `pi_flexform` field.
This is a problem due to defaults coming from this flexform field (that a template would use) not being available in the frontend template (or the processor processing the flexform). An editor has to manually reopen and save the content element to get the `pi_flexform` field correctly set.

This is the part of the code that leads to this behaviour:

                    if (($wInfo['saveAndClose'] ?? false)) {
                        $viewVariables['target'] = (string)$this->uriBuilder->buildUriFromRoute('tce_db', [
                            'data' => [
                                'tt_content' => [
                                    StringUtility::getUniqueId('NEW') => array_replace($defVals, [
                                        'colPos' => $this->colPos,
                                        'pid' => $this->uid_pid,
                                        'sys_language_uid' => $this->sys_language,
                                    ]),
                                ],
                            ],
                            'redirect' => $this->R_URI,
                        ]);
                    }

Reviews 0

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

History 3

  1. Denis Mir changed subject NewContentElementController's "saveAndClose" functionality does create content elements with setting pi_flexform to null NewContentElementController's "saveAndClose" functionality does create content elements with setting pi_flexform in tt_content to null 10/13/21, 13:13

  2. Georg Ringer changed Duplicates #91997 06/08/24, 07:40

  3. Georg Ringer commented and changed status New Closed 06/08/24, 07:42

    closing as duplicate of #91997 – an alternative way how to add flexforms is linked there as well