Feature: #88198 - TCA-based Slug modifiers for extensions¶
See Issue #88198
The new “slug” TCA type now includes a possibility to hook into the generation of a slug via custom TCA generation options.
Hooks can be registered via
$GLOBALS['TCA'][$tableName]['columns'][$fieldName]['config']['generatorOptions']['postModifiers'] = My\Class::class . '->method';
EXT:myextension/Configuration/TCA/Overrides/table.php, where $tableName can be a table like
$fieldName matches the slug field name, e.g.
$GLOBALS['TCA']['pages']['columns']['slug']['config']['generatorOptions']['postModifiers'] = My\Class::class . '->modifySlug';
The method then receives an parameter array with the following values:
[ 'slug' ... the slug to be used 'workspaceId' ... the workspace ID, "0" if in live workspace 'configuration' ... the configuration of the TCA field 'record' ... the full record to be used 'pid' ... the resolved parent page ID 'prefix' ... the prefix that was added 'tableName' ... the table of the slug field 'fieldName' ... the field name of the slug field ];
All hooks need to return the modified slug value.
Any extension now allows to modify a specific slug, for instance only for a specific part of the page tree.
It is also possible for extensions to implement custom functionality like “Do not include in slug generation” as known from RealURL.