Commit 708ce0a9 authored by effulgentsia's avatar effulgentsia

Issue #2576533 by alexpott, stefan.r, Wim Leers, dawehner, xjm, effulgentsia,...

Issue #2576533 by alexpott, stefan.r, Wim Leers, dawehner, xjm, effulgentsia, catch: Rename SafeStringInterface to MarkupInterface and move related classes
parent 03bd7fc7
......@@ -13,7 +13,7 @@
use Drupal\Core\DrupalKernel;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Render\SafeString;
use Drupal\Core\Render\Markup;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\Utility\Error;
......@@ -403,7 +403,7 @@ function watchdog_exception($type, Exception $exception, $message = NULL, $varia
* drupal_set_message(t('An error occurred and processing did not complete.'), 'error');
* @endcode
*
* @param string|\Drupal\Component\Utility\SafeStringInterface $message
* @param string|\Drupal\Component\Render\MarkupInterface $message
* (optional) The translated message to be displayed to the user. For
* consistency with other messages, it should begin with a capital letter and
* end with a period.
......@@ -450,13 +450,13 @@ function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE)
$_SESSION['messages'][$type] = array();
}
// Convert strings which are safe to the simplest SafeString objects.
if (!($message instanceof SafeString) && SafeMarkup::isSafe($message)) {
$message = SafeString::create((string) $message);
// Convert strings which are safe to the simplest Markup objects.
if (!($message instanceof Markup) && SafeMarkup::isSafe($message)) {
$message = Markup::create((string) $message);
}
// Do not use strict type checking so that equivalent string and
// SafeStringInterface objects are detected.
// MarkupInterface objects are detected.
if ($repeat || !in_array($message, $_SESSION['messages'][$type])) {
$_SESSION['messages'][$type][] = $message;
}
......
......@@ -22,10 +22,10 @@
use Drupal\Core\Asset\AttachedAssets;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Render\SafeString;
use Drupal\Core\Render\Markup;
use Drupal\Core\Render\Renderer;
use Drupal\Core\Site\Settings;
use Drupal\Core\StringTranslation\TranslatableString;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
......@@ -33,7 +33,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Routing\GeneratorNotInitializedException;
use Drupal\Core\StringTranslation\PluralTranslatableString;
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\Element;
......@@ -144,10 +144,10 @@
* The delimiter used to split plural strings.
*
* @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0.
* Use \Drupal\Core\StringTranslation\PluralTranslatableString::DELIMITER
* Use \Drupal\Core\StringTranslation\PluralTranslatableMarkup::DELIMITER
* instead.
*/
const LOCALE_PLURAL_DELIMITER = PluralTranslatableString::DELIMITER;
const LOCALE_PLURAL_DELIMITER = PluralTranslatableMarkup::DELIMITER;
/**
* Prepares a 'destination' URL query parameter for use with url().
......@@ -262,7 +262,7 @@ function check_url($uri) {
* Optional language code to translate to a language other than what is used
* to display the page.
*
* @return \Drupal\Core\StringTranslation\TranslatableString
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* A translated string representation of the size.
*/
function format_size($size, $langcode = NULL) {
......@@ -284,21 +284,21 @@ function format_size($size, $langcode = NULL) {
$options = ['langcode' => $langcode];
switch ($unit) {
case 'KB':
return new TranslatableString('@size KB', $args, $options);
return new TranslatableMarkup('@size KB', $args, $options);
case 'MB':
return new TranslatableString('@size MB', $args, $options);
return new TranslatableMarkup('@size MB', $args, $options);
case 'GB':
return new TranslatableString('@size GB', $args, $options);
return new TranslatableMarkup('@size GB', $args, $options);
case 'TB':
return new TranslatableString('@size TB', $args, $options);
return new TranslatableMarkup('@size TB', $args, $options);
case 'PB':
return new TranslatableString('@size PB', $args, $options);
return new TranslatableMarkup('@size PB', $args, $options);
case 'EB':
return new TranslatableString('@size EB', $args, $options);
return new TranslatableMarkup('@size EB', $args, $options);
case 'ZB':
return new TranslatableString('@size ZB', $args, $options);
return new TranslatableMarkup('@size ZB', $args, $options);
case 'YB':
return new TranslatableString('@size YB', $args, $options);
return new TranslatableMarkup('@size YB', $args, $options);
}
}
}
......@@ -967,7 +967,7 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) {
* can be passed in to save another run of
* \Drupal\Core\Render\Element::children().
*
* @return string|\Drupal\Component\Utility\SafeStringInterface
* @return string|\Drupal\Component\Render\MarkupInterface
* The rendered HTML of all children of the element.
*
* @see drupal_render()
......@@ -982,7 +982,7 @@ function drupal_render_children(&$element, $children_keys = NULL) {
$output .= drupal_render($element[$key]);
}
}
return SafeString::create($output);
return Markup::create($output);
}
/**
......
......@@ -8,7 +8,7 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Render\SafeString;
use Drupal\Core\Render\Markup;
use Drupal\Core\Utility\Error;
use Symfony\Component\HttpFoundation\Response;
......@@ -74,7 +74,7 @@ function _drupal_error_handler_real($error_level, $message, $filename, $line, $c
'%type' => isset($types[$error_level]) ? $severity_msg : 'Unknown error',
// The standard PHP error handler considers that the error messages
// are HTML. We mimick this behavior here.
'@message' => SafeString::create(Xss::filterAdmin($message)),
'@message' => Markup::create(Xss::filterAdmin($message)),
'%function' => $caller['function'],
'%file' => $caller['file'],
'%line' => $caller['line'],
......
......@@ -12,7 +12,7 @@
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\SafeStringInterface;
use Drupal\Component\Render\MarkupInterface;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Config\Config;
......@@ -22,7 +22,7 @@
use Drupal\Core\Theme\ThemeSettings;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\SafeString;
use Drupal\Core\Render\Markup;
/**
* @defgroup content_flags Content markers
......@@ -386,7 +386,7 @@ function theme_get_setting($setting_name, $theme = NULL) {
* https://www.drupal.org/node/2575065
*/
function theme_render_and_autoescape($arg) {
if ($arg instanceOf SafeStringInterface) {
if ($arg instanceOf MarkupInterface) {
return (string) $arg;
}
$return = NULL;
......@@ -1292,7 +1292,7 @@ function template_preprocess_html(&$variables) {
if (!empty($variables['page']['#title'])) {
$head_title = array(
// Marking the title as safe since it has had the tags stripped.
'title' => SafeString::create(trim(strip_tags($variables['page']['#title']))),
'title' => Markup::create(trim(strip_tags($variables['page']['#title']))),
'name' => $site_config->get('name'),
);
}
......
......@@ -2,10 +2,15 @@
/**
* @file
* Contains Drupal\Component\Utility\FormattableString.
* Contains Drupal\Component\Render\FormattableMarkup.
*/
namespace Drupal\Component\Utility;
namespace Drupal\Component\Render;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper;
/**
* Formats a string for HTML display by replacing variable placeholders.
......@@ -13,11 +18,11 @@
* When cast to a string, this object replaces variable placeholders in the
* string with the arguments passed in during construction and escapes the
* values so they can be safely displayed as HTML. See the documentation of
* \Drupal\Component\Utility\FormattableString::placeholderFormat() for
* details on the supported placeholders and how to use them securely. Incorrect
* use of this class can result in security vulnerabilities.
* \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details
* on the supported placeholders and how to use them securely. Incorrect use of
* this class can result in security vulnerabilities.
*
* In most cases, you should use TranslatableString or PluralTranslatableString
* In most cases, you should use TranslatableMarkup or PluralTranslatableMarkup
* rather than this object, since they will translate the text (on
* non-English-only sites) in addition to formatting it. Variables concatenated
* without the insertion of language-specific words or punctuation are some
......@@ -56,11 +61,11 @@
*
* @ingroup sanitization
*
* @see \Drupal\Core\StringTranslation\TranslatableString
* @see \Drupal\Core\StringTranslation\PluralTranslatableString
* @see \Drupal\Component\Utility\FormattableString::placeholderFormat()
* @see \Drupal\Core\StringTranslation\TranslatableMarkup
* @see \Drupal\Core\StringTranslation\PluralTranslatableMarkup
* @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat()
*/
class FormattableString implements SafeStringInterface {
class FormattableMarkup implements MarkupInterface {
/**
* The arguments to replace placeholders with.
......@@ -75,12 +80,12 @@ class FormattableString implements SafeStringInterface {
* @param string $string
* A string containing placeholders. The string itself will not be escaped,
* any unsafe content must be in $args and inserted via placeholders.
* @param array $args
* @param array $arguments
* An array with placeholder replacements, keyed by placeholder. See
* \Drupal\Component\Utility\FormattableString::placeholderFormat() for
* \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for
* additional information about placeholders.
*
* @see \Drupal\Component\Utility\FormattableString::placeholderFormat()
* @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat()
*/
public function __construct($string, array $arguments) {
$this->string = (string) $string;
......@@ -125,17 +130,17 @@ public function jsonSerialize() {
* An associative array of replacements. Each array key should be the same
* as a placeholder in $string. The corresponding value should be a string
* or an object that implements
* \Drupal\Component\Utility\SafeStringInterface. The value replaces the
* \Drupal\Component\Render\MarkupInterface. The value replaces the
* placeholder in $string. Sanitization and formatting will be done before
* replacement. The type of sanitization and formatting depends on the first
* character of the key:
* - @variable: When the placeholder replacement value is:
* - A string, the replaced value in the returned string will be sanitized
* using \Drupal\Component\Utility\Html::escape().
* - A SafeStringInterface object, the replaced value in the returned
* string will not be sanitized.
* - A SafeStringInterface object cast to a string, the replaced value in
* the returned string be forcibly sanitized using
* - A MarkupInterface object, the replaced value in the returned string
* will not be sanitized.
* - A MarkupInterface object cast to a string, the replaced value in the
* returned string be forcibly sanitized using
* \Drupal\Component\Utility\Html::escape().
* @code
* $this->placeholderFormat('This will force HTML-escaping of the replacement value: @text', ['@text' => (string) $safe_string_interface_object));
......@@ -180,8 +185,8 @@ public function jsonSerialize() {
*
* @ingroup sanitization
*
* @see \Drupal\Core\StringTranslation\TranslatableString
* @see \Drupal\Core\StringTranslation\PluralTranslatableString
* @see \Drupal\Core\StringTranslation\TranslatableMarkup
* @see \Drupal\Core\StringTranslation\PluralTranslatableMarkup
* @see \Drupal\Component\Utility\Html::escape()
* @see \Drupal\Component\Utility\UrlHelper::stripDangerousProtocols()
* @see \Drupal\Core\Url::fromUri()
......@@ -192,8 +197,8 @@ protected static function placeholderFormat($string, array $args) {
switch ($key[0]) {
case '@':
// Escape if the value is not an object from a class that implements
// \Drupal\Component\Utility\SafeStringInterface, for example strings
// will be escaped.
// \Drupal\Component\Render\MarkupInterface, for example strings will
// be escaped.
// \Drupal\Component\Utility\SafeMarkup\SafeMarkup::isSafe() may
// return TRUE for content that is safe within HTML fragments, but not
// within other contexts, so this placeholder type must not be used
......@@ -210,7 +215,7 @@ protected static function placeholderFormat($string, array $args) {
// attribute to be encoded. If a caller wants to pass a value that is
// extracted from HTML and therefore is already HTML encoded, it must
// invoke
// \Drupal\Component\Utility\OutputStrategyInterface::renderFromHtml()
// \Drupal\Component\Render\OutputStrategyInterface::renderFromHtml()
// on it prior to passing it in as a placeholder value of this type.
// @todo Add some advice and stronger warnings.
// https://www.drupal.org/node/2569041.
......@@ -235,7 +240,7 @@ protected static function placeholderFormat($string, array $args) {
/**
* Escapes a placeholder replacement value if needed.
*
* @param string|\Drupal\Component\Utility\SafeStringInterface $value
* @param string|\Drupal\Component\Render\MarkupInterface $value
* A placeholder replacement value.
*
* @return string
......
<?php
/**
* @file
* Contains \Drupal\Component\Render\MarkupInterface.
*/
namespace Drupal\Component\Render;
/**
* Marks an object's __toString() method as returning markup.
*
* Objects that implement this interface will not be automatically XSS filtered
* by the render system or automatically escaped by the theme engine.
*
* If there is any risk of the object's __toString() method returning
* user-entered data that has not been filtered first, it must not be used. If
* the object that implements this does not perform automatic escaping or
* filtering itself, then it must be marked as "@internal". For example, Views
* has the internal ViewsRenderPipelineMarkup object to provide a custom render
* pipeline in order to render JSON and to fast render fields. By contrast,
* FormattableMarkup and TranslatableMarkup always sanitize their output when
* used correctly.
*
* If the object is going to be used directly in Twig templates it should
* implement \Countable so it can be used in if statements.
*
* @see \Drupal\Component\Render\MarkupTrait
* @see \Drupal\Component\Utility\SafeMarkup::isSafe()
* @see \Drupal\Core\Template\TwigExtension::escapeFilter()
* @see \Drupal\Component\Render\FormattableMarkup
* @see \Drupal\Core\StringTranslation\TranslatableMarkup
* @see \Drupal\views\Render\ViewsRenderPipelineMarkup
*/
interface MarkupInterface extends \JsonSerializable {
/**
* Returns markup.
*
* @return string
* The markup.
*/
public function __toString();
}
......@@ -2,17 +2,19 @@
/**
* @file
* Contains \Drupal\Component\Utility\SafeStringTrait.
* Contains \Drupal\Component\Render\MarkupTrait.
*/
namespace Drupal\Component\Utility;
namespace Drupal\Component\Render;
use Drupal\Component\Utility\Unicode;
/**
* Implements SafeStringInterface and Countable for rendered objects.
* Implements MarkupInterface and Countable for rendered objects.
*
* @see \Drupal\Component\Utility\SafeStringInterface
* @see \Drupal\Component\Render\MarkupInterface
*/
trait SafeStringTrait {
trait MarkupTrait {
/**
* The safe string.
......@@ -22,20 +24,20 @@ trait SafeStringTrait {
protected $string;
/**
* Creates a SafeString object if necessary.
* Creates a Markup object if necessary.
*
* If $string is equal to a blank string then it is not necessary to create a
* SafeString object. If $string is an object that implements
* SafeStringInterface it is returned unchanged.
* Markup object. If $string is an object that implements MarkupInterface it
* is returned unchanged.
*
* @param mixed $string
* The string to mark as safe. This value will be cast to a string.
*
* @return string|\Drupal\Component\Utility\SafeStringInterface
* @return string|\Drupal\Component\Render\MarkupInterface
* A safe string.
*/
public static function create($string) {
if ($string instanceof SafeStringInterface) {
if ($string instanceof MarkupInterface) {
return $string;
}
$string = (string) $string;
......@@ -48,7 +50,7 @@ public static function create($string) {
}
/**
* Returns the string version of the SafeString object.
* Returns the string version of the Markup object.
*
* @return string
* The safe string content.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\Component\Utility\OutputStrategyInterface.
* Contains \Drupal\Component\Render\OutputStrategyInterface.
*/
namespace Drupal\Component\Utility;
namespace Drupal\Component\Render;
/**
* Provides an output strategy that formats HTML strings for a given context.
......
<?php
/**
* @file
* Contains \Drupal\Component\Utility\PlainTextOutput.
* Contains \Drupal\Component\Render\PlainTextOutput.
*/
namespace Drupal\Component\Utility;
namespace Drupal\Component\Render;
use Drupal\Component\Utility\Html;
/**
* Provides an output strategy for transforming HTML into simple plain text.
......
......@@ -7,6 +7,9 @@
namespace Drupal\Component\Utility;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Render\MarkupInterface;
/**
* Manages known safe strings for rendering at the theme layer.
*
......@@ -47,7 +50,7 @@ class SafeMarkup {
/**
* Checks if a string is safe to output.
*
* @param string|\Drupal\Component\Utility\SafeStringInterface $string
* @param string|\Drupal\Component\Render\MarkupInterface $string
* The content to be checked.
* @param string $strategy
* The escaping strategy. Defaults to 'html'. Two escaping strategies are
......@@ -64,7 +67,7 @@ class SafeMarkup {
public static function isSafe($string, $strategy = 'html') {
// Do the instanceof checks first to save unnecessarily casting the object
// to a string.
return $string instanceOf SafeStringInterface || isset(static::$safeStrings[(string) $string][$strategy]) ||
return $string instanceOf MarkupInterface || isset(static::$safeStrings[(string) $string][$strategy]) ||
isset(static::$safeStrings[(string) $string]['all']);
}
......@@ -166,23 +169,23 @@ public static function checkPlain($text) {
* any unsafe content must be in $args and inserted via placeholders.
* @param array $args
* An array with placeholder replacements, keyed by placeholder. See
* \Drupal\Component\Utility\FormattableString::placeholderFormat() for
* \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for
* additional information about placeholders.
*
* @return string|\Drupal\Component\Utility\SafeStringInterface
* The formatted string, which is an instance of SafeStringInterface unless
* @return string|\Drupal\Component\Render\MarkupInterface
* The formatted string, which is an instance of MarkupInterface unless
* sanitization of an unsafe argument was suppressed (see above).
*
* @ingroup sanitization
*
* @see \Drupal\Component\Utility\FormattableString::placeholderFormat()
* @see \Drupal\Component\Utility\FormattableString
* @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat()
* @see \Drupal\Component\Render\FormattableMarkup
*
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
* Use \Drupal\Component\Utility\FormattableString.
* Use \Drupal\Component\Render\FormattableMarkup.
*/
public static function format($string, array $args) {
return new FormattableString($string, $args);
return new FormattableMarkup($string, $args);
}
}
<?php
/**
* @file
* Contains \Drupal\Component\Utility\SafeStringInterface.
*/
namespace Drupal\Component\Utility;
/**
* Marks an object's __toString() method as returning safe markup.
*
* All objects that implement this interface should be marked @internal.
*
* This interface should only be used on objects that emit known safe strings
* from their __toString() method. If there is any risk of the method returning
* user-entered data that has not been filtered first, it must not be used.
*
* If the object is going to be used directly in Twig templates it should
* implement \Countable so it can be used in if statements.
*
* @internal
* This interface is marked as internal because it should only be used by
* objects used during rendering. This interface should be used by modules if
* they interrupt the render pipeline and explicitly deal with SafeString
* objects created by the render system. Additionally, if a module reuses the
* regular render pipeline internally and passes processed data into it. For
* example, Views implements a custom render pipeline in order to render JSON
* and to fast render fields.
*
* @see \Drupal\Component\Utility\SafeStringTrait
* @see \Drupal\Component\Utility\SafeMarkup::isSafe()
* @see \Drupal\Core\Template\TwigExtension::escapeFilter()
*/
interface SafeStringInterface extends \JsonSerializable {
/**
* Returns a safe string.
*
* @return string
* The safe string.
*/
public function __toString();
}
......@@ -29,7 +29,7 @@ trait CommandWithAttachedAssetsTrait {
* If content is a render array, it may contain attached assets to be
* processed.
*
* @return string|\Drupal\Component\Utility\SafeStringInterface
* @return string|\Drupal\Component\Render\MarkupInterface
* HTML rendered content.
*/
protected function getRenderedContent() {
......
......@@ -8,7 +8,7 @@
namespace Drupal\Core\Annotation;
use Drupal\Component\Annotation\Plugin;
use Drupal\Core\StringTranslation\TranslatableString;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* @defgroup plugin_context Annotation for context definition
......@@ -113,7 +113,7 @@ public function __construct(array $values) {
// used in the classes they pass to.
foreach (['label', 'description'] as $key) {
// @todo Remove this workaround in https://www.drupal.org/node/2362727.
if (isset($values[$key]) && $values[$key] instanceof TranslatableString) {
if (isset($values[$key]) && $values[$key] instanceof TranslatableMarkup) {
$values[$key] = (string) $values[$key]->get();
}
else {
......
......@@ -8,7 +8,7 @@
namespace Drupal\Core\Annotation;
use Drupal\Component\Annotation\AnnotationBase;
use Drupal\Core\StringTranslation\TranslatableString;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* @defgroup plugin_translatable Annotation for translatable text
......@@ -60,7 +60,7 @@ class Translation extends AnnotationBase {
/**
* The string translation object.
*
* @var \Drupal\Core\StringTranslation\TranslatableString
* @var \Drupal\Core\StringTranslation\TranslatableMarkup
*/
protected $translation;
......@@ -86,7 +86,7 @@ public function __construct(array $values) {
'context' => $values['context'],
);
}
$this->translation = new TranslatableString($string, $arguments, $options);
$this->translation = new TranslatableMarkup($string, $arguments, $options);
}
/**
......
......@@ -48,7 +48,7 @@ public function label() {
$definition = $this->getPluginDefinition();
// Cast the admin label to a string since it is an object.
// @see \Drupal\Core\StringTranslation\TranslatableString
// @see \Drupal\Core\StringTranslation\TranslatableMarkup
return (string) $definition['admin_label'];
}
......
......@@ -8,7 +8,7 @@
namespace Drupal\Core\Config;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\SafeStringInterface;
use Drupal\Component\Render\MarkupInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
use Drupal\Core\Cache\RefinableCacheableDependencyTrait;
......@@ -278,7 +278,7 @@ public function getCacheMaxAge() {
}
/**
* Casts any objects that implement SafeStringInterface to string.
* Casts any objects that implement MarkupInterface to string.
*
* @param mixed $data
* The configuration data.
......@@ -287,12 +287,12 @@ public function getCacheMaxAge() {
* The data with any safe strings cast to string.
*/
protected function castSafeStrings($data) {
if ($data instanceof SafeStringInterface) {
if ($data instanceof MarkupInterface) {
$data = (string) $data;
}
else if (is_array($data)) {
array_walk_recursive($data, function (&$value) {
if ($value instanceof SafeStringInterface) {
if ($value instanceof MarkupInterface) {
$value = (string) $value;
}
});
......
......@@ -6,7 +6,7 @@
*/
namespace Drupal\Core\Entity\Annotation;
use Drupal\Core\StringTranslation\TranslatableString;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* Defines a config entity type annotation object.
......@@ -37,7 +37,7 @@ class ConfigEntityType extends EntityType {
* {@inheritdoc}
*/
public function get() {
$this->definition['group_label'] = new TranslatableString('Configuration', array(), array('context' => 'Entity type group'));
$this->definition['group_label'] = new TranslatableMarkup('Configuration', array(), array('context' => 'Entity type group'));
return parent::get();
}
......
......@@ -6,7 +6,7 @@
*/
namespace Drupal\Core\Entity\Annotation;
use Drupal\Core\StringTranslation\TranslatableString;
use Drupal\Core\StringTranslation\TranslatableMarkup;