Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation: #102326 - RegularExpressionValidator validator option "errorMessage" #4303

Open
simonschaufi opened this issue Sep 10, 2024 · 0 comments

Comments

@simonschaufi
Copy link
Collaborator

Deprecation: #102326 - RegularExpressionValidator validator option "errorMessage"

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.2/Deprecation-102326-RegularExpressionValidatorValidatorOptionErrorMessage.html

Deprecation: #102326 - RegularExpressionValidator validator option "errorMessage"

See 102326

Description

The validator option errorMessage can be used to provide a custom
string as error message for validation failures of the
RegularExpressionValidator. In order to streamline error message
translation keys with all other validators, the validator option
errorMessage has been marked as deprecated in TYPO3 v13 and will be
removed with TYPO3 v14.

Impact

Using the validator option errorMessage of the
RegularExpressionValidator will trigger a PHP deprecation warning.

Affected installations

TYPO3 installations using the validator option errorMessage of the
RegularExpressionValidator.

Migration

The new validator option message must be used to provide a custom and
translatable error message for failed validation.

Before:

use TYPO3\CMS\Extbase\Annotation as Extbase;

#[Extbase\Validate([
    'validator' => 'RegularExpression',
    'options' => [
        'regularExpression' => '/^simple[0-9]expression$/',
        'errorMessage' => 'Error message or LLL schema string',
    ],
])]
protected string $myProperty = '';

After:

use TYPO3\CMS\Extbase\Annotation as Extbase;

#[Extbase\Validate([
    'validator' => 'RegularExpression',
    'options' => [
        'regularExpression' => '/^simple[0-9]expression$/',
        'message' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:my.languageKey'
    ],
])]
protected string $myProperty = '';

Backend, NotScanned, ext:extbase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant