TYPO3 CMS  TYPO3_7-6
AbstractValidator.php
Go to the documentation of this file.
1 <?php
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 
19 
21 {
27  const LOCALISATION_OBJECT_NAME = 'tx_form_system_validate';
28 
32  protected $formUtility;
33 
37  protected $rawArgument;
38 
42  protected $supportedOptions = [
43  'element' => ['', 'The name of the element', 'string', true],
44  'errorMessage' => ['', 'The error message', 'array', true],
45  ];
46 
53  protected $acceptsEmptyValues = false;
54 
58  public function setRawArgument($rawArgument)
59  {
60  $this->rawArgument = $rawArgument;
61  }
62 
67  {
68  $this->formUtility = $formUtility;
69  }
70 
78  public function substituteMarkers($message)
79  {
80  return $message;
81  }
82 
90  public function getLocalLanguageLabel($type = '')
91  {
92  $label = static::LOCALISATION_OBJECT_NAME . '.' . $type;
93  $message = LocalizationUtility::translate($label, 'form');
94  return $message;
95  }
96 
107  public function renderMessage($message = null, $type = null, $messageType = 'message')
108  {
109  $message = $this->formUtility->renderItem(
110  $message,
111  $type,
112  $this->getLocalLanguageLabel($messageType)
113  );
114  return $this->substituteMarkers($message);
115  }
116 }
static translate($key, $extensionName, $arguments=null)
renderMessage($message=null, $type=null, $messageType='message')