Project

General

Profile

Actions

Feature #102159

open

TCA Type Slug - Prefix user function additional parameters

Added by Henrik Jensen 7 months ago. Updated 7 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
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.

Actions #1

Updated by Henrik Jensen 7 months ago

  • Target version set to next-patchlevel
  • PHP Version set to 8.2
Actions

Also available in: Atom PDF