SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | ||
| 3 | - | namespace Drupal\Component\Plugin; |
| 3 | + | namespace Drupal\Core\Annotation; |
| 4 | ||
| 5 | /** | |
| 6 | * @Annotation | |
| 7 | */ | |
| 8 | class Translation {
| |
| 9 | protected $translation; | |
| 10 | ||
| 11 | - | public function __construct($value) {
|
| 11 | + | public function __construct($values) {
|
| 12 | - | $this->translation = t($value['value']); |
| 12 | + | $string = $values['value']; |
| 13 | if (!empty($values['context'])) {
| |
| 14 | $options = array( | |
| 15 | 'context' => $values['context'], | |
| 16 | ); | |
| 17 | } | |
| 18 | else {
| |
| 19 | $options = array( | |
| 20 | 'context' => 'plugin annotation', | |
| 21 | ); | |
| 22 | } | |
| 23 | $this->translation = t($string, array(), $options); | |
| 24 | } | |
| 25 | ||
| 26 | public function getTranslation() {
| |
| 27 | return $this->translation; | |
| 28 | } | |
| 29 | } |