[FEATURE] Add inline AJAX validation for TCA type slug 93/57993/21
authorBenni Mack <benni@typo3.org>
Wed, 22 Aug 2018 21:09:19 +0000 (23:09 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 31 Aug 2018 14:20:10 +0000 (16:20 +0200)
commit4ec0a91c385138187fdb26936c1d4b09d0077aaf
tree7a84be05f055b05d5a6a6cfbb00e807b46e62bc0
parentd4e4ff2ceb095908067cc458855a4e7bc3ac469b
[FEATURE] Add inline AJAX validation for TCA type slug

The TCA type slug field is "disabled" / "readonly" by default but
actually has a toggle button (like InputLinkField) to enable that field.

For new records it works like this:
- A title is entered, then the slug field gets prefilled "as-you-type"
  and the editor will see the URL directly. There is a check if the
- If a slug is manually entered:
- It is validated by "isUniqueInSite" to see if that slug is still
   free.
- If the slug is already taken, a proposal is shown below the input
   field to use the proposal for the slug. In any case, when saving,
   the same validation process kicks in anyways.

Existing records do not change their slug by changing the page title,
but only if the slug field gets modified directly.

So for existing records, the following use-cases exist, when a slug
gets manually modified:
- If the page slug is already in use, a proposal for another
  available slug is shown.
- If the page has subpages, a warning will be shown that all
  subpages need to be manually modified (not implemented yet)
- If the page slug will be changed on save, a message is shown that you
  should create a redirect (not implemented yet)

Resolves: #85931
Releases: master
Change-Id: Iabb5f02d43463b3a2bb70197cc8c9585bce1d32d
Reviewed-on: https://review.typo3.org/57993
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Controller/FormSlugAjaxController.php [new file with mode: 0644]
typo3/sysext/backend/Classes/Form/Element/InputSlugElement.php
typo3/sysext/backend/Configuration/Backend/AjaxRoutes.php
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SlugElement.js [new file with mode: 0644]
typo3/sysext/core/Configuration/TCA/pages.php
typo3/sysext/core/Documentation/Changelog/master/Feature-84729-NewTCATypeSlug.rst
typo3/sysext/core/Resources/Private/Language/locallang_core.xlf