[TYPO3-mvc] Customize extbase BooleanValidator? Unique IDs for error messages?

Jigal van Hemert jigal.van.hemert at typo3.org
Sat Oct 31 12:18:56 CET 2015


Hi Master Chief (it's regarded polite here to use your real name),

On 11/10/2015 12:37, Master Chief wrote:
> I'm using an extension which relies on the extbase default validators.
> Using typoscript and the appropriate key I was able to change the error
> texts via
> plugin.tx_extbase._LOCAL_LANG.de.KEY = X
>
> The BooleanValidator.php is written a bit differently, as it doesn't use
> the translateErrorMessage method so I was unsure about the key. I
> changed the BooleanValidator.php accordingly:

This validator was left out of the process of making the error messages 
translatable. It's fixed for version 7 with
https://forge.typo3.org/issues/66973

> and it works. But I assume this is not a best practice apporach :) So
> the question is, what is the best way to accomplish the goal? (custom
> text for extbase validator)

To fix this in your installation I'd first try to create a version with 
the translation mechanism and use the XCLASS mechanism to override the 
original function.

> Is this an open todo in extbase? the other validators seem to be
> consistent. And finally, did I get it right that the IDs are globally
> unique? How are they created? (for example if a new developer wants to
> add a validator).

I assume that you mean the number in the last parameter of addError()? 
That is meant to be unique and therefore we simply use the Unix 
timestamp at the time that the developer inserts this number in the 
code. Chances are small that two numbers are generated at the same time. 
If an Exception is thrown then this number is used to link to a wiki 
page where the community can leave further hints on how to solve/prevent 
that exception.
(It's also useful to find the location in the code that throws the error 
:-) )

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-project-typo3v4mvc mailing list