TYPO3  7.6
form/Classes/Domain/Validator/AbstractValidator.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Form\Domain\Validator;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
20 {
26  const LOCALISATION_OBJECT_NAME = 'tx_form_system_validate';
27 
31  protected $formUtility;
32 
36  protected $rawArgument;
37 
41  protected $supportedOptions = array(
42  'element' => array('', 'The name of the element', 'string', true),
43  'errorMessage' => array('', 'The error message', 'array', true),
44  );
45 
52  protected $acceptsEmptyValues = false;
53 
57  public function setRawArgument($rawArgument)
58  {
59  $this->rawArgument = $rawArgument;
60  }
61 
66  {
67  $this->formUtility = $formUtility;
68  }
69 
77  public function substituteMarkers($message)
78  {
79  return $message;
80  }
81 
89  public function getLocalLanguageLabel($type = '')
90  {
91  $label = static::LOCALISATION_OBJECT_NAME . '.' . $type;
92  $message = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($label, 'form');
93  return $message;
94  }
95 
106  public function renderMessage($message = null, $type = null, $messageType = 'message')
107  {
108  $message = $this->formUtility->renderItem(
109  $message,
110  $type,
111  $this->getLocalLanguageLabel($messageType)
112  );
113  return $this->substituteMarkers($message);
114  }
115 }