Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

TranslatableBase.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Base;
8
12 trait TranslatableBase
13 {
14 private $messageTemplate;
15
16 private $parameters = [];
17
18 public function setMessageTemplate($messageTemplate)
19 {
20 $this->messageTemplate = $messageTemplate;
21 }
22
23 public function getMessageTemplate()
24 {
25 return $this->messageTemplate;
26 }
27
28 public function setParameters(array $parameters)
29 {
30 $this->parameters = $parameters;
31 }
32
33 public function addParameter($name, $value)
34 {
35 $this->parameters[$name] = $value;
36 }
37
38 public function addParameters(array $parameters)
39 {
40 $this->parameters += $parameters;
41 }
42
43 public function getParameters()
44 {
45 return $this->parameters;
46 }
47
48 public function getBaseTranslation()
49 {
50 return strtr($this->messageTemplate, $this->parameters);
51 }
52 }
eZ\Publish\Core\Base\addParameter
addParameter($name, $value)
Definition: TranslatableBase.php:33
eZ\Publish\Core\Base\TranslatableBase
trait TranslatableBase
Trait providing a default implementation of Translatable.
Definition: TranslatableBase.php:13
eZ\Publish\Core\Base\getBaseTranslation
getBaseTranslation()
Definition: TranslatableBase.php:48
eZ\Publish\Core\Base\addParameters
addParameters(array $parameters)
Definition: TranslatableBase.php:38
eZ\Publish\Core\Base\getParameters
getParameters()
Definition: TranslatableBase.php:43
eZ\Publish\Core\Base\getMessageTemplate
getMessageTemplate()
Definition: TranslatableBase.php:23
eZ\Publish\Core\Base\setParameters
setParameters(array $parameters)
Definition: TranslatableBase.php:28
eZ\Publish\Core\Base\setMessageTemplate
setMessageTemplate($messageTemplate)
Definition: TranslatableBase.php:18
eZ\Publish\Core\Base\$parameters
$parameters
Definition: TranslatableBase.php:16
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.