#84265record pid invalid when using a Userfunction as TCA displayCond
Description
Depending on the pid of a new created record I want to hide or show a field. This works when I click in the page tree on the sys folder and then create in the list view a new element. The record pid in my userfunction is set, and contains the correct one. If I then use the dropdown and click on “Save and create a new one”, then the record pid is set to ‘-9’. Now my condition is not working, and the field is not shown. After I press “Save”, my field is there, because the pid is set.
TCA:
'fieldname' => [
'displayCond' => 'USER:Vendor\\Extensionname\\User\\TcaUserFunctions->displayIfCorrectPid',
'exclude' => false,
'label' => 'My label',
'config' => [
'type' => 'input',
'size' => 16,
'eval' => 'datetime,required'
]
]
Userfunction:
/**
* Checks if pid = 10
*
* @param array $configuration
* @param \TYPO3\CMS\Backend\Form\FormDataProvider\EvaluateDisplayConditions $evaluateDisplayConditions
* @return bool
*/
public function displayIfCorrectPid(array $configuration, $evaluateDisplayConditions = null)
{
if($configuration['record']['pid'] == 10) {
return true;
}
return false;
}
Not 100% sure though if it is meant to be reading out the pid of the element in a condition like this.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.