Actions
Feature #102159
openTCA Type Slug - Prefix user function additional parameters
Start date:
2023-10-13
Due date:
% Done:
0%
Estimated time:
PHP Version:
8.2
Tags:
Complexity:
Sprint Focus:
Description
We would very much like to able to send addtional parameters to the prefix function. This is currently not possible.
'config' => [
'type' => 'slug',
'appearance' => [
'prefix' => SlugService::class . '->jobPrefix',
'parameters' => [
'foo' => 'bar'
]
],
'generatorOptions' => [
'fields' => ['title'],
'replacements' => SlugUtility::REPLACEMENTS
],
'fallbackCharacter' => '-',
'eval' => 'uniqueInSite',
'size' => 60
]
In TcaSlug.php a solution to pass the provided parameters:
if ($prefix !== '') {
//$parameters = ['site' => $site, 'languageId' => $languageId, 'table' => $table, 'row' => $row];
$parameters = [
'site' => $site, 'languageId' => $languageId, 'table' => $table, 'row' => $row,
'parameters' => $fieldConfig['config']['appearance']['parameters'] ?? []
];
$prefix = GeneralUtility::callUserFunction($prefix, $parameters, $this);
} elseif ($site instanceof SiteInterface) {
// default behaviour used for pages
$prefix = $this->getPrefixForSite($site, $languageId);
}
We believe this would be a welcomed extension of the Slug type for TCA.
Updated by Henrik Jensen over 1 year ago
- Target version set to next-patchlevel
- PHP Version set to 8.2
Actions