Bug #89560

InputSlugElement cannot use 'uid' for slug suggestion Ajax request

Added by Johannes Schlier 21 days ago. Updated 12 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-10-31
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

Description

When we have a slug field that is defined to use the uid and e.g. the name of a record for generating a slug, the refresh button does not work.

Example TCA configuration:

'slug' => [
  'label' => 'slug',
  'config' => [
    'type' => 'slug',
    'size' => 128,
    'generatorOptions' => [
      'fields' => ['name', 'uid'],
      'fieldSeparator' => '-',
      'replacements' => [
        '/' => '-'
      ],
    ],
    'fallbackCharacter' => '-',
    'eval' => 'uniqueInPid',
    'default' => ''
  ]
]

This configuration is valid and produces the correct result when the slug field is cleared and automatically filled by the DataHandler upon saving.
Using the refresh button does not work however. The SlugElement TS/JS searches for FormEngine input fields and adds the values of those to its request.
The uid however is not a FormEngine input field and therefore cannot be read and added to the fields that are used to generate the slug.

Two workarounds are known. But they come with lots of problems.
1.
Telling editors to clear the field instead of using the refresh button (as they are used to from pages).
This works but is a burden upon the editors and there will surely be some who use the refresh button anyway, resulting in "wrong"/inconsistent slugs.

2.
Adding the uid as a FormEngine input field. This allows the SlugElement.ts/js to read the uid value, as long as it is not set to read only.
Even when hidden by put into a hidden palette, it can still be manipulated and break everything.

Of course the SlugElement.ts/js does know about the uid, so it should be a simple thing to add it to the values sent to the FormSlugAjaxController.

Associated revisions

Revision 29af6f5c (diff)
Added by Johannes Schlier 12 days ago

[BUGFIX] Allow usage of uid in slug generation via Ajax

This commit adds an option to the slug input type which allows it
to use the uid of a record when the update slug button is pressed
in the FormEngine.

Resolves: #89560
Releases: master, 9.5
Change-Id: Id645714f1b26e20e511022d1c74ea793964ffa19
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62170
Reviewed-by: Daniel Sattler <>
Reviewed-by: Oliver Bartsch <>
Reviewed-by: Wolfgang Klinger <>
Reviewed-by: Susanne Moog <>
Reviewed-by: Andreas Fernandez <>
Tested-by: TYPO3com <>
Tested-by: Oliver Bartsch <>
Tested-by: Susanne Moog <>
Tested-by: Andreas Fernandez <>

Revision 3a1af2fc (diff)
Added by Johannes Schlier 12 days ago

[BUGFIX] Allow usage of uid in slug generation via Ajax

This commit adds an option to the slug input type which allows it
to use the uid of a record when the update slug button is pressed
in the FormEngine.

Resolves: #89560
Releases: master, 9.5
Change-Id: Id645714f1b26e20e511022d1c74ea793964ffa19
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62263
Tested-by: TYPO3com <>
Tested-by: Andreas Fernandez <>
Reviewed-by: Andreas Fernandez <>

History

#1 Updated by Gerrit Code Review 21 days ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62170

#2 Updated by Gerrit Code Review 18 days ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62170

#3 Updated by Gerrit Code Review 12 days ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62263

#4 Updated by Anonymous 12 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF