TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Form\Validation\AbstractValidator Class Reference
Inheritance diagram for TYPO3\CMS\Form\Validation\AbstractValidator:
TYPO3\CMS\Form\Validation\ValidatorInterface tx_form_System_Validate_Abstract TYPO3\CMS\Form\Validation\AlphabeticValidator TYPO3\CMS\Form\Validation\AlphanumericValidator TYPO3\CMS\Form\Validation\BetweenValidator TYPO3\CMS\Form\Validation\DateValidator TYPO3\CMS\Form\Validation\DigitValidator TYPO3\CMS\Form\Validation\EmailValidator TYPO3\CMS\Form\Validation\EqualsValidator TYPO3\CMS\Form\Validation\FileAllowedTypesValidator TYPO3\CMS\Form\Validation\FileMaximumSizeValidator TYPO3\CMS\Form\Validation\FileMinimumSizeValidator TYPO3\CMS\Form\Validation\FloatValidator TYPO3\CMS\Form\Validation\GreaterThanValidator TYPO3\CMS\Form\Validation\InArrayValidator TYPO3\CMS\Form\Validation\IntegerValidator TYPO3\CMS\Form\Validation\IpValidator TYPO3\CMS\Form\Validation\LengthValidator TYPO3\CMS\Form\Validation\LessthanValidator TYPO3\CMS\Form\Validation\RegExpValidator TYPO3\CMS\Form\Validation\RequiredValidator TYPO3\CMS\Form\Validation\UriValidator

Public Member Functions

 injectRequestHandler (\TYPO3\CMS\Form\Request $requestHandler)
 
 __construct ($arguments)
 
 setFieldName ($fieldName)
 
 getFieldName ()
 
 getMessage ()
 
 getError ()
 
 setMessage ($message='', $type='TEXT')
 
 setError ($error='', $type='TEXT')
 
 setShowMessage ($show)
 
 messageMustBeDisplayed ()
 
- Public Member Functions inherited from TYPO3\CMS\Form\Validation\ValidatorInterface
 isValid ()
 

Protected Member Functions

 substituteValues ($message)
 
 getLocalLanguageLabel ($type)
 

Protected Attributes

 $fieldName
 
 $message = array()
 
 $error = array()
 
 $showMessage = TRUE
 
 $localizationHandler
 
 $requestHandler
 
 $localCobj
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! Abstract for validation

Author
Patrick Broens patri.nosp@m.ck@p.nosp@m.atric.nosp@m.kbro.nosp@m.ens.n.nosp@m.l

Definition at line 22 of file AbstractValidator.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ getError()

TYPO3\CMS\Form\Validation\AbstractValidator::getError ( )

Returns the error

Returns
array Typoscript for cObj

Implements TYPO3\CMS\Form\Validation\ValidatorInterface.

Definition at line 138 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$error.

◆ getFieldName()

TYPO3\CMS\Form\Validation\AbstractValidator::getFieldName ( )

Returns the field name

Returns
string The field name

Implements TYPO3\CMS\Form\Validation\ValidatorInterface.

Definition at line 120 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$fieldName.

◆ getLocalLanguageLabel()

TYPO3\CMS\Form\Validation\AbstractValidator::getLocalLanguageLabel (   $type)
protected

Get the local language label(s) for the message In some cases this method will be override by rule class

Parameters
string$typeThe type
Returns
string The local language message label

Definition at line 249 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$message.

Referenced by TYPO3\CMS\Form\Validation\AbstractValidator\setError(), and TYPO3\CMS\Form\Validation\AbstractValidator\setMessage().

◆ getMessage()

TYPO3\CMS\Form\Validation\AbstractValidator::getMessage ( )

Returns the message

Returns
array Typoscript for cObj

Implements TYPO3\CMS\Form\Validation\ValidatorInterface.

Definition at line 129 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$message.

◆ injectRequestHandler()

TYPO3\CMS\Form\Validation\AbstractValidator::injectRequestHandler ( \TYPO3\CMS\Form\Request  $requestHandler)

Inject the Request Handler

Parameters
\TYPO3\CMS\Form\Request$requestHandler
Returns
void

Definition at line 85 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$requestHandler.

Referenced by TYPO3\CMS\Form\Validation\AbstractValidator\__construct().

◆ messageMustBeDisplayed()

TYPO3\CMS\Form\Validation\AbstractValidator::messageMustBeDisplayed ( )

Returns TRUE when message needs to be displayed

Returns
boolean

Implements TYPO3\CMS\Form\Validation\ValidatorInterface.

Definition at line 227 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$showMessage.

◆ setError()

TYPO3\CMS\Form\Validation\AbstractValidator::setError (   $error = '',
  $type = 'TEXT' 
)

Set the error, like 'This field is required' for the validation rule

The output will be a Typoscript array to use as cObj If no parameter is given, it will take the default locallang label If only first parameter, then it's supposed to be a TEXT cObj When both are filled, it's supposed to be a cObj made by the administrator In the last case, no markers will be substituted

Parameters
mixed$errorMessage as string or TS
string$typeName of the cObj
Returns
void

Definition at line 188 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$error, TYPO3\CMS\Form\Validation\AbstractValidator\getLocalLanguageLabel(), and TYPO3\CMS\Form\Validation\AbstractValidator\substituteValues().

Referenced by TYPO3\CMS\Form\Validation\AbstractValidator\__construct().

◆ setFieldName()

TYPO3\CMS\Form\Validation\AbstractValidator::setFieldName (   $fieldName)

Set the fieldName

Parameters
string$fieldNameThe field name
Returns
object The rule object

Implements TYPO3\CMS\Form\Validation\ValidatorInterface.

Definition at line 110 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$fieldName.

Referenced by TYPO3\CMS\Form\Validation\AbstractValidator\__construct().

◆ setMessage()

TYPO3\CMS\Form\Validation\AbstractValidator::setMessage (   $message = '',
  $type = 'TEXT' 
)

Set the message, like 'required' for the validation rule and substitutes markers for values, like maximum

The output will be a Typoscript array to use as cObj If no parameter is given, it will take the default locallang label If only first parameter, then it's supposed to be a TEXT cObj When both are filled, it's supposed to be a cObj made by the administrator In the last case, no markers will be substituted

Parameters
mixed$messageMessage as string or TS
string$typeName of the cObj
Returns
void

Implements TYPO3\CMS\Form\Validation\ValidatorInterface.

Definition at line 156 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$message, TYPO3\CMS\Form\Validation\AbstractValidator\getLocalLanguageLabel(), and TYPO3\CMS\Form\Validation\AbstractValidator\substituteValues().

Referenced by TYPO3\CMS\Form\Validation\AbstractValidator\__construct().

◆ setShowMessage()

TYPO3\CMS\Form\Validation\AbstractValidator::setShowMessage (   $show)

Set if message needs to be displayed

Parameters
boolean$showTRUE is display
Returns
object The rule object

Implements TYPO3\CMS\Form\Validation\ValidatorInterface.

Definition at line 213 of file AbstractValidator.php.

Referenced by TYPO3\CMS\Form\Validation\AbstractValidator\__construct().

◆ substituteValues()

TYPO3\CMS\Form\Validation\AbstractValidator::substituteValues (   $message)
protected

Substitute makers in the message text In some cases this method will be override by rule class

Parameters
string$messageMessage text with markers
Returns
string Message text with substituted markers

Definition at line 238 of file AbstractValidator.php.

References TYPO3\CMS\Form\Validation\AbstractValidator\$message.

Referenced by TYPO3\CMS\Form\Validation\AbstractValidator\setError(), and TYPO3\CMS\Form\Validation\AbstractValidator\setMessage().

Member Data Documentation

◆ $error

TYPO3\CMS\Form\Validation\AbstractValidator::$error = array()
protected

◆ $fieldName

TYPO3\CMS\Form\Validation\AbstractValidator::$fieldName
protected

◆ $localCobj

TYPO3\CMS\Form\Validation\AbstractValidator::$localCobj
protected

Definition at line 77 of file AbstractValidator.php.

◆ $localizationHandler

TYPO3\CMS\Form\Validation\AbstractValidator::$localizationHandler
protected

Definition at line 63 of file AbstractValidator.php.

◆ $message

◆ $requestHandler

TYPO3\CMS\Form\Validation\AbstractValidator::$requestHandler
protected

◆ $showMessage

TYPO3\CMS\Form\Validation\AbstractValidator::$showMessage = TRUE
protected