Feature #50740
closed
Provide syntax "__row|uid_local|fieldname" for $TCA[...]['config']['default']
Added by Michael Bakonyi over 11 years ago.
Updated almost 9 years ago.
Category:
FormEngine aka TCEforms
Description
With
$TCA['sys_file_reference']['columns']['title']['config']['placeholder'] = '__row|uid_local|title'
it is possible to get data from a related record, which is added as non-editable placeholder-attribute.
To make it possible for an editor to really use the content of the field I think it would make sense to enable the syntax above for
$TCA['sys_file_reference']['columns']['title']['config']['default']
aswell.
It is possible to add this functionality by copying the code from TYPO3\CMS\Backend\Form -> getPlaceholderAttribute via the hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass']
But I think this could/should be a core-feature. So maybe it would make sense to externalize the function TYPO3\CMS\Backend\Form -> getPlaceholderAttribute to the GeneralUtility for example so that it can be used on various places ..?
I meant not externalizing the the complete function getPlaceholderAttribute but only the code which fetches the content from the related field of course.
- Priority changed from Should have to Could have
- Complexity set to medium
We want to reduce the number of functions for GeneralUtility, thus is should be at a more descriptive location.
Anyway, your proposal sounds valid for me.
Basically there is no need to put the Code in GeneralUtility.
The hook will get a reference to the calling FormEngine object:
foreach ($this->hookObjectsMainFields as $hookObj) {
if (method_exists($hookObj, 'getMainFields_preProcess')) {
$hookObj->getMainFields_preProcess($table, $row, $this);
}
}
IMHO the only required change is the visibility of the getPlaceholderAttribute() from protected to public.
My proposal wasn't focused to use GeneralUtility – you now best where to put the code. My feature-request was to make the mentioned setting available by default to enhance the UX-behavior, respectively to make it easily possible for integrators to set this up without the need of a hook.
- Status changed from New to Rejected
Won't have this time as the given syntax provides little benefit for the default values - these are meant for new records which don't have any relations/values in _row yet. So there are no relations to follow using the given syntax.
If you change your data structure the preferred solution is to use a migration script to set the values for new fields once (in batch).
Also available in: Atom
PDF