Bug #90734
closed
inlineParentUid field is set to NULL in some cases when using FormInlineAjaxController
Added by Oliver Bartsch over 4 years ago.
Updated over 4 years ago.
Category:
FormEngine aka TCEforms
Description
Opening an inline record calls the /record/inline/details route which targets FormInlineAjaxController::detailAction().
There, the composed parentData might not hold the databaseRow which is used in FormInlineAjaxController::compileChild() to set the inlineParentUid.
This information is however needed for custom FromDataProvides to e.g. retrieve information of the parent record and use them as conditions to adjust the inline elements TCA or similar.
- Private changed from No to Yes
After calling this->compileChild() there is the assignment $childData['inlineParentUid'] = (int)$parent['uid'] which is too late as the the compileChild() calls the FormDataCompiler::compile() inside without the inlineParentUid
- Private changed from Yes to No
Steps to reproduce (using styleguide extension)¶
- Add a custom FormDataProvider (See example code below)
- Create a new record (type: tx_styleguide_inline_1n)
- Add an inline element (tx_styleguide_inline_1n_child)
- Save record
- Open the inline element by clicking on it (The inline element must be collapsed when the FormEngine loads)
- Debug the $result['inlineParentUid'] in your custom FormDataProvider -> It is NULL
Example code:
// Register fromDataProvider in ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['tcaDatabaseRecord'][\TYPO3\CMS\Styleguide\Backend\Form\FormDataProvider\ProcessInline::class] =
[
'depends' => [
\TYPO3\CMS\Backend\Form\FormDataProvider\TcaInline::class
]
];
// Create FormDataProvider in EXT:styleguide/Classes/Backend/Form/FormDataProvider/ProcessInline.php
<?php
declare(strict_types=1);
namespace TYPO3\CMS\Styleguide\Backend\Form\FormDataProvider;
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
class ProcessInline implements FormDataProviderInterface
{
/**
* @param array $result
*
* @return array
*/
public function addData(array $result): array
{
// Debug $result['inlineParentUid'] here
return $result;
}
}
- Status changed from New to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF