comparison core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
20 * @see \Drupal\Core\Annotation\Translation 20 * @see \Drupal\Core\Annotation\Translation
21 */ 21 */
22 class TranslatableMarkup extends FormattableMarkup { 22 class TranslatableMarkup extends FormattableMarkup {
23 23
24 use ToStringTrait; 24 use ToStringTrait;
25
26 /**
27 * The string to be translated.
28 *
29 * @var string
30 */
31 protected $string;
32 25
33 /** 26 /**
34 * The translated markup without placeholder replacements. 27 * The translated markup without placeholder replacements.
35 * 28 *
36 * @var string 29 * @var string
137 public function __construct($string, array $arguments = [], array $options = [], TranslationInterface $string_translation = NULL) { 130 public function __construct($string, array $arguments = [], array $options = [], TranslationInterface $string_translation = NULL) {
138 if (!is_string($string)) { 131 if (!is_string($string)) {
139 $message = $string instanceof TranslatableMarkup ? '$string ("' . $string->getUntranslatedString() . '") must be a string.' : '$string ("' . (string) $string . '") must be a string.'; 132 $message = $string instanceof TranslatableMarkup ? '$string ("' . $string->getUntranslatedString() . '") must be a string.' : '$string ("' . (string) $string . '") must be a string.';
140 throw new \InvalidArgumentException($message); 133 throw new \InvalidArgumentException($message);
141 } 134 }
142 $this->string = $string; 135 parent::__construct($string, $arguments);
143 $this->arguments = $arguments;
144 $this->options = $options; 136 $this->options = $options;
145 $this->stringTranslation = $string_translation; 137 $this->stringTranslation = $string_translation;
146 } 138 }
147 139
148 /** 140 /**