[FEATURE] Add a new TCA type "slug"
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / master / Feature-84729-NewTCATypeSlug.rst
1 .. include:: ../../Includes.txt
2
3 =====================================
4 Feature: #84729 - New TCA type "slug"
5 =====================================
6
7 See :issue:`84729`
8
9 Description
10 ===========
11
12 A new TCA field type called `slug` has been added to TYPO3 Core. Its main purpose is to define parts of a URL
13 path to generate and resolve URLs.
14
15 With a URL like `https://www.typo3.org/ch/community/values/core-values/` a URL slug is typically a part like
16 `/community` or `/community/values/core-values`.
17
18 Within TYPO3, a slug is always part of the URL "path" - it does not scheme, host, HTTP verb, etc.
19
20 A slug is usually added to a TCA-based database table, contain some rules for evaluation and definition.
21
22 In contrast to concepts within RealURL of "URL segments", a slug is a segment of a URL, but it is not limited
23 to be separated by slashes. Therefore, a slug can contain slashes.
24
25 In the future, it could be possible to generate slugs for any TCA table, but its's main usage will be for the "pages"
26 TCA structure.
27
28 If a TCA table contains a field called "slug", it needs to be filled for every existing record. It can
29 be shown and edited via regular Backend Forms, and is also evaluated during persistence via DataHandler.
30
31 The default behaviour of a slug is as follows:
32 - A slug only contains characters which are allowed within URLs. Spaces, commas and other special characters
33 are converted to a fallback character.
34 - A slug is always lower-cased.
35 - A slug is unicode-aware.
36
37 The following options apply to the new TCA type:
38 'type' => 'slug',
39 'config' => [
40 'generatorOptions' => [
41 'fields' => ['title', 'nav_title'],
42 'fieldSeparator' => '/',
43 'prefixParentPageSlug' => true
44 ]
45 'fallbackCharacter' => '-',
46 'eval' => 'uniqueInSite'
47 ]
48
49 In addition the new 'eval' option 'uniqueInSite' to evaluate if a record is unique in a page tree (specific to a
50 language).
51
52 The new slug TCA type allows for two `eval` options `uniqueInSite` or `uniqueInPid` (useful for third-party
53 records), and no other eval setting is checked for. It is possible to set both eval options, however it is
54 recommended not to do so.
55
56 It is possible to build a default value from the rootline (very helpful for pages, or categorized slugs),
57 but also to just generate a "speaking" segment from e.g. a news title.
58
59 Sanitization and Validation configuration options apply when persisting a record via DataHandler.
60
61 .. index:: TCA, ext:core