Project

General

Profile

Actions

Task #104733

closed

[DOCS] Use createValidator instead of addValidator in the code example for EXT:form API when setting options

Added by Sébastien Delcroix 3 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-08-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Since #96998, there's no more __construct() method more in Extbase validators, thus they can't be instanciated with options anymore, they have to implement setOptions.
The following code doesn't work since TYPO3v12 :

$message->addValidator(GeneralUtility::makeInstance(StringLengthValidator::class, ['minimum' => 5, 'maximum' => 20]));

Instead the method createValidator must be used like this :

$message->createValidator(
    'StringLength',
    ['minimum' => 5, 'maximum' => 20]
);

The form extension documentation contains a code example on how to build forms programmatically that must be updated to respect this (
https://docs.typo3.org/c/typo3/cms-form/main/en-us/D/FrontendRendering/Index.html#apireference-frontendrendering-programmatically )

I'll try to provide a patch (that would be my first contribution using the official gerrit process).


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #96998: Streamline Extbase validatorsClosed2022-02-22

Actions
Actions

Also available in: Atom PDF