Feature: #89573 - Allow flexible base url for slug fields in FormEngine
See forge#89573
Description
It is now possible to add a custom base url for TCA columns of type slug
. The
base url is displayed in front of the input field in FormEngine.
To add a custom base url a user
can be assigned to the new setting
prefix
which is available under ['columns']
at the fields TCA definition.
'config' => [
'type' => 'slug',
'appearance' => [
'prefix' => \Vendor\Extension\UserFunctions\FormEngine\SlugPrefix::class . '->getPrefix'
]
]
The user
receives two parameters. The first parameter is the parameters
array containing the site object, the language id, the current table and the
current row. The second parameter is the reference object Tca
. The
user
should return the string which is then used as the base url in
FormEngine.
<?php
declare(strict_types = 1);
namespace Vendor\Extension\UserFunctions\FormEngine
use TYPO3\CMS\Backend\Form\FormDataProvider\TcaSlug;
class SlugPrefix
{
public function getPrefix(array $parameters, TcaSlug $reference): string
{
return 'custom base url';
}
}
Impact
Developers are enabled to provide custom base urls for their slug fields. If you are already using slug fields in your TCA, nothing changes as the current behaviour is still used as the default.