FormSlugAjaxController

class \TYPO3\CMS\Backend\Controller\FormSlugAjaxController

Extends
AbstractFormEngineAjaxController

Handle FormEngine AJAX calls for Slug validation and sanitization

Table of Contents

Methods

__construct()  : mixed
suggestAction()  : ResponseInterface
Validates a given slug against the site and give a suggestion when it's already in use
addRegisteredRequireJsModulesToJavaScriptItems()  : void
checkRequest()  : bool
createExecutableStringRepresentationOfRegisteredRequireJsModules()  : array
Gets result array from FormEngine and returns string with js modules that need to be loaded and evaluated by JavaScript.
getLabelsFromLocalizationFile()  : array
Parse a language file and get a label/value array from it.
getLanguageService()  : LanguageService|null
getRelativePathToStylesheetFile()  : string
Resolve a CSS file position, possibly prefixed with 'EXT:'
serializeJavaScriptModuleInstructionItems()  : array

Methods

suggestAction()

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

public suggestAction(ServerRequestInterface $request) : ResponseInterface

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

$request : ServerRequestInterface

Tags

throws
RuntimeException

Return values

ResponseInterface

addRegisteredRequireJsModulesToJavaScriptItems()

protected addRegisteredRequireJsModulesToJavaScriptItems(array $result, JavaScriptItems $items) : void

Parameters

$result : array
$items : JavaScriptItems

checkRequest()

protected checkRequest(ServerRequestInterface $request) : bool

Parameters

$request : ServerRequestInterface

Tags

throws
InvalidArgumentException

Return values

bool

createExecutableStringRepresentationOfRegisteredRequireJsModules()

Gets result array from FormEngine and returns string with js modules that need to be loaded and evaluated by JavaScript.

protected createExecutableStringRepresentationOfRegisteredRequireJsModules(array $result[, bool $skipInstructions = false ]) : array

Parameters

$result : array
$skipInstructions : bool = false

whether to skip JavaScriptModuleInstruction

Return values

array

getLabelsFromLocalizationFile()

Parse a language file and get a label/value array from it.

protected getLabelsFromLocalizationFile(string $file) : array

Parameters

$file : string

EXT:path/to/file

Return values

array —

Label/value array

getRelativePathToStylesheetFile()

Resolve a CSS file position, possibly prefixed with 'EXT:'

protected getRelativePathToStylesheetFile(string $stylesheetFile) : string

Parameters

$stylesheetFile : string

Given file, possibly prefixed with EXT:

Return values

string —

Web root relative position to file

On this page