Issue Bug Closed

#90141Slug recreation is not availabe for generator fields that are configured as "readonly"

David Rellstab 01/17/20, 11:35 updated 04/01/20, 21:14

Description

When the generator field of a slug configuration has the TCA option “readonly” the Slug recreation button is disabled, even though the recreation is possible if started programmatically.

Example:

Have a fairly standard slug field config:

'config' => [
  'type' => 'slug',
      'generatorOptions' => [
      'fields' => ['title'],
      'fieldSeparator' => '/',
      'prefixParentPageSlug' => true,
      'replacements' => [
          '/' => '-',
       ],
   ],
   'fallbackCharacter' => '-',
   'eval' => 'uniqueInSite'
]

And the title field, that is readonly (e.g. if the title is provided by an external service):

'title' => [
    'label' => 'Title',
    'config' => [
    'type' => 'input',
        'readOnly' => true
    ],
],

The problem seems to be in the Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SlugElement.ts on Line 211.

The selector only considers [data-formengine-input-name=”’ + field + ‘”] as a valid source field, while the readonly input fields don’t have those data-Attributes.

In my opinion the disabled-State of the recreate-Button should not be dependent on the state of GUI-Elements. For example if no valid generator fields are configured there still might be postModifiers Hooks that will return a slug eventually.

Basically the same underlying issue as in https://forge.typo3.org/issues/89187 but the patch on that issue will not work for this one.

Reviews 2