Feature #90130

Introduce option for syncing fields with slug in TCA type "slug"

Added by Christian Eßl 4 months ago. Updated 3 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2020-01-16
Due date:
% Done:

0%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

I propose a new option for the "generatorOptions" config in a TCA slug type to automatically sync changes made in one of the configured fields with the slug. (defaulting to false)

'type' => 'slug',
    'config' => [
        'generatorOptions' => [
            'fields' => ['title'],
            'sync' => true,
            'replacements' => [
                '/' => ''
            ],
        ]
        'fallbackCharacter' => '-',
        'prependSlash' => true,
        'eval' => 'uniqueInPid'
    ]

So if "sync" is set to true, changing the "title" field in a backend form would automatically trigger a "recreate" for the connected slug, to keep the changes in sync.

History

#1 Updated by Christian Eßl 4 months ago

One edge case would be: If the slug was has been manually been overriden before. - Should the syncing be then ignored?

Maybe two different syncing modes: "always sync" and "only sync if was not manually overriden"

#2 Updated by Stephan Bauer 3 months ago

This would be great.
It would be possible to set the field to readonly or hide the field.

#3 Updated by Christian Eßl 3 months ago

But I think, if this should be a feature in slugs, it should be completely optional, defaulting to FALSE, as you could automatically "destroy" a previously saved slug of a frontend url, that could already have been indexed and out there in the web.
And automatically updating the slug would also require to automatically create a new sys_redirect entry. (As is already done in master, when you change a slug)

Also available in: Atom PDF