‪TYPO3CMS  11.5
TYPO3\CMS\Backend\Controller\FormSlugAjaxController Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Controller\FormSlugAjaxController:
TYPO3\CMS\Backend\Controller\AbstractFormEngineAjaxController TYPO3\CMS\Backend\Form\FormResultTrait

Public Member Functions

 __construct (Context $context)
 
ResponseInterface suggestAction (ServerRequestInterface $request)
 

Protected Member Functions

bool checkRequest (ServerRequestInterface $request)
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Backend\Controller\AbstractFormEngineAjaxController
array createExecutableStringRepresentationOfRegisteredRequireJsModules (array $result, bool $skipInstructions=false)
 
 addRegisteredRequireJsModulesToJavaScriptItems (array $result, JavaScriptItems $items)
 
string getRelativePathToStylesheetFile (string $stylesheetFile)
 
array getLabelsFromLocalizationFile ($file)
 
LanguageService null getLanguageService ()
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Backend\Form\FormResultTrait
 serializeJavaScriptModuleInstructionItems (JavaScriptModuleInstruction $instruction)
 

Private Attributes

Context $context
 

Detailed Description

Handle FormEngine AJAX calls for Slug validation and sanitization

This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.

Definition at line 35 of file FormSlugAjaxController.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Controller\FormSlugAjaxController::__construct ( Context  $context)

Member Function Documentation

◆ checkRequest()

bool TYPO3\CMS\Backend\Controller\FormSlugAjaxController::checkRequest ( ServerRequestInterface  $request)
protected
Parameters
ServerRequestInterface$request
Returns
‪bool
Exceptions

Definition at line 159 of file FormSlugAjaxController.php.

Referenced by TYPO3\CMS\Backend\Controller\FormSlugAjaxController\suggestAction().

◆ suggestAction()

ResponseInterface TYPO3\CMS\Backend\Controller\FormSlugAjaxController::suggestAction ( ServerRequestInterface  $request)

Validates a given slug against the site and give a suggestion when it's already in use

For new records this will look like this:

  • ‪If "slug" field is empty, take the other fields, and generate the slug based on the sent fields.
    • ‪JS: adapt the "placeholder" value only, as on save the field will be filled with the value via DataHandler
  • ‪If "slug" field is not empty (= "unlocked" and manually typed in)
    • ‪sanitize the slug
      • ‪If 'uniqueInSite' is set check if it's unique for the site
        • ‪If not unique propose another slug and return this with the flag hasConflicts = true
      • ‪If 'uniqueInPid' is set check if it's unique for the pid
        • ‪If not unique propose another slug and return this with the flag hasConflicts = true

For existing records:

  • ‪sanitize the slug
    • ‪If 'uniqueInSite' is set check if it's unique for the site
      • ‪If not unique propose another slug and return this with the flag hasConflicts = true
    • ‪If 'uniqueInPid' is set check if it's unique for the pid
      • ‪If not unique propose another slug and return this with the flag hasConflicts = true
    • ‪If the slug has changed from the existing database record (
      Todo:
      ‪)
      • ‪Show a message that the old URL will stop working (possibly add a redirect via checkbox)
      • ‪If the page has subpages, show a warning that the subpages WILL NOT BE MODIFIED and keep the OLD url
Parameters
ServerRequestInterface$request
Returns
‪ResponseInterface
Exceptions

Definition at line 71 of file FormSlugAjaxController.php.

References $GLOBALS, TYPO3\CMS\Backend\Controller\FormSlugAjaxController\checkRequest(), TYPO3\CMS\Core\DataHandling\Model\RecordStateFactory\forName(), TYPO3\CMS\Core\Utility\ArrayUtility\mergeRecursiveWithOverrule(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Member Data Documentation

◆ $context

Context TYPO3\CMS\Backend\Controller\FormSlugAjaxController::$context
private