- →$input Drupal\Core\Entity\ContentEntityType(42)
- contents
- Available methods (85)
- Static class properties (2)
- →protected revision_metadata_keys -> array(4)
- 'revision_user' => string(12) "revision_uid"
- 'revision_created' => string(18) "revision_timestamp"
- 'revision_log_message' => string(12) "revision_log"
- 'revision_default' => string(16) "revision_default"
- →protected requiredRevisionMetadataKeys -> array(1)
- 'revision_default' => string(16) "revision_default"
- protected static_cache -> boolTRUE
- protected render_cache -> boolTRUE
- protected persistent_cache -> boolTRUE
- →protected entity_keys -> array(12)
- 'id' => string(3) "nid"
- 'revision' => string(3) "vid"
- 'bundle' => string(4) "type"
- 'label' => string(5) "title"
- 'langcode' => string(8) "langcode"
- 'uuid' => string(4) "uuid"
- 'status' => string(6) "status"
- 'published' => string(6) "status"
- 'uid' => string(3) "uid"
- 'owner' => string(3) "uid"
- 'default_langcode' => string(16) "default_langcode"
- 'revision_translation_affected' => string(29) "revision_translation_affected"
- protected id -> string(4) "node"
- protected originalClass -> string(23) "Drupal\node\Entity\Node"
- →protected handlers -> array(9)
- 'storage' => string(23) "Drupal\node\NodeStorage"
- 'storage_schema' => string(29) "Drupal\node\NodeStorageSchema"
- 'view_builder' => string(27) "Drupal\node\NodeViewBuilder"
- 'access' => string(36) "Drupal\node\NodeAccessControlHandler"
- 'views_data' => string(25) "Drupal\node\NodeViewsData"
- →'form' => array(5)
- 'default' => string(20) "Drupal\node\NodeForm"
- 'delete' => string(31) "Drupal\node\Form\NodeDeleteForm"
- 'edit' => string(20) "Drupal\node\NodeForm"
- 'delete-multiple-confirm' => string(31) "Drupal\node\Form\DeleteMultiple"
- 'book_outline' => string(32) "Drupal\book\Form\BookOutlineForm"
- →'route_provider' => array(1)
- 'html' => string(36) "Drupal\node\Entity\NodeRouteProvider"
- 'list_builder' => string(27) "Drupal\node\NodeListBuilder"
- 'translation' => string(34) "Drupal\node\NodeTranslationHandler"
- protected admin_permission -> NULL
- protected permission_granularity -> string(6) "bundle"
- →protected links -> array(13)
- 'canonical' => string(12) "/node/{node}"
- 'delete-form' => string(19) "/node/{node}/delete"
- 'delete-multiple-form' => string(26) "/admin/content/node/delete"
- 'edit-form' => string(17) "/node/{node}/edit"
- 'version-history' => string(22) "/node/{node}/revisions"
- 'revision' => string(43) "/node/{node}/revisions/{node_revision}/view"
- 'create' => string(5) "/node"
- 'book-outline-form' => string(20) "/node/{node}/outline"
- 'book-remove-form' => string(27) "/node/{node}/outline/remove"
- 'devel-load' => string(18) "/devel/node/{node}"
- 'devel-render' => string(25) "/devel/node/{node}/render"
- 'devel-definition' => string(29) "/devel/node/{node}/definition"
- 'token-devel' => string(24) "/node/{node}/devel/token"
- protected label_callback -> NULL
- protected bundle_entity_type -> string(9) "node_type"
- protected bundle_of -> NULL
- →protected bundle_label -> Drupal\Core\StringTranslation\TranslatableMarkup(5)
- contents
- Available methods (14)
- protected translatedMarkup -> NULL
- protected options -> array(0)
- protected stringTranslation -> NULL
- protected string -> string(12) "Content type"
- protected arguments -> array(0)
- →public __construct($string, array $arguments = array(), array $options = array(), Drupal\Core\StringTranslation\TranslationInterface $string_translation = NULL)
Constructs a new class instance. When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t(). Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup object directly. Calling the trait's t() method or instantiating a new TranslatableMarkup object serves two purposes: - At run-time it translates user-visible text into the appropriate language. - Static analyzers detect calls to t() and new TranslatableMarkup, and add the first argument (the string to be translated) to the database of strings that need translation. These strings are expected to be in English, so the first argument should always be in English. To allow the site to be localized, it is important that all human-readable text that will be displayed on the site or sent to a user is made available in one of the ways supported by the @link https://www.drupal.org/node/322729 Localization API @endlink. See the @link https://www.drupal.org/node/322729 Localization API @endlink pages for more information, including recommendations on how to break up or not break up strings for translation. @section sec_translating_vars Translating Variables $string should always be an English literal string. $string should never contain a variable, such as: @code new TranslatableMarkup($text) @endcode There are several reasons for this: - Using a variable for $string that is user input is a security risk. - Using a variable for $string that has even guaranteed safe text (for example, user interface text provided literally in code), will not be picked up by the localization static text processor. (The parameter could be a variable if the entire string in $text has been passed into t() or new TranslatableMarkup() elsewhere as the first argument, but that strategy is not recommended.) It is especially important never to call new TranslatableMarkup($user_text) or t($user_text) where $user_text is some text that a user entered -- doing that can lead to cross-site scripting and other security problems. However, you can use variable substitution in your string, to put variable text such as user names or link URLs into translated text. Variable substitution looks like this: @code new TranslatableMarkup("@name's blog", array('@name' => $account->getDisplayName())); @endcode Basically, you can put placeholders like @name into your string, and the method will substitute the sanitized values at translation time. (See the Localization API pages referenced above and the documentation of \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details about how to safely and correctly define variables in your string.) Translators can then rearrange the string as necessary for the language (e.g., in Spanish, it might be "blog de @name"). @param string $string A string containing the English text to translate. @param array $arguments (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details. @param array $options (optional) An associative array of additional options, with the following elements: - 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page. - 'context' (defaults to the empty context): The context the source string belongs to. @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation (optional) The string translation service. @throws \InvalidArgumentException Exception thrown when $string is not a string. @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat() @see \Drupal\Core\StringTranslation\StringTranslationTrait::t() @ingroup sanitization Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:129
- →public __sleep()
Magic __sleep() method to avoid serializing the string translator. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:203
- →public __toString()
Implements the magic __toString() method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:13
- →public count() -> int
Returns the string length. @return int The length of the string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:227
- →public getArguments() -> mixed[]
Gets all arguments from this translated string. @return mixed[] The array of arguments. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:178
- →public getOption($name) -> mixed
Gets a specific option from this translated string. @param string $name Option name. @return mixed The value of this option or empty string of option is not set. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:158
- →public getOptions() -> mixed[]
Gets all options from this translated string. @return mixed[] The array of options. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:168
- →public getUntranslatedString() -> string
Gets the untranslated string value stored in this translated string. @return string The string stored in this wrapper. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145
- →public jsonSerialize() -> string
Returns a representation of the object for use in JSON serialization. @return string The safe string content. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:118
- →public render() -> string
Renders the object as a string. @return string The translated string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:188
- →protected static placeholderEscape($value) -> string
Escapes a placeholder replacement value if needed. @param string|\Drupal\Component\Render\MarkupInterface $value A placeholder replacement value. @return string The properly escaped replacement value. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:264
- →protected static placeholderFormat($string, array $args) -> string
Replaces placeholders in a string with values. @param string $string A string containing placeholders. The string itself is expected to be safe and correct HTML. Any unsafe content must be in $args and inserted via placeholders. @param array $args 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\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 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)); @endcode Use this placeholder as the default choice for anything displayed on the site, but not within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - %variable: Use when the replacement value is to be wrapped in <em> tags. A call like: @code $string = "%output_text"; $arguments = ['%output_text' => 'text output here.']; $this->placeholderFormat($string, $arguments); @endcode makes the following HTML code: @code <em class="placeholder">text output here.</em> @endcode As with @variable, do not use this within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - :variable: Return value is escaped with \Drupal\Component\Utility\Html::escape() and filtered for dangerous protocols using UrlHelper::stripDangerousProtocols(). Use this when using the "href" attribute, ensuring the attribute value is always wrapped in quotes: @code // Secure (with quotes): $this->placeholderFormat('<a href=":url">@variable</a>', [':url' => $url, '@variable' => $variable]); // Insecure (without quotes): $this->placeholderFormat('<a href=:url>@variable</a>', [':url' => $url, '@variable' => $variable]); @endcode When ":variable" comes from arbitrary user input, the result is secure, but not guaranteed to be a valid URL (which means the resulting output could fail HTML validation). To guarantee a valid URL, use Url::fromUri($user_input)->toString() (which either throws an exception or returns a well-formed URL) before passing the result into a ":variable" placeholder. @return string A formatted HTML string with the placeholders replaced. @ingroup sanitization @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() Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:194
- →protected _die()
For test purposes, wrap die() in an overridable method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:31
- →protected getStringTranslation() -> \Drupal\Core\StringTranslation\TranslationInterface
Gets the string translation service. @return \Drupal\Core\StringTranslation\TranslationInterface The string translation service. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:213
- protected base_table -> string(4) "node"
- protected revision_data_table -> string(19) "node_field_revision"
- protected revision_table -> string(13) "node_revision"
- protected data_table -> string(15) "node_field_data"
- protected internal -> boolFALSE
- protected translatable -> boolTRUE
- protected show_revision_ui -> boolTRUE
- →protected label -> Drupal\Core\StringTranslation\TranslatableMarkup(5)
- contents
- Available methods (14)
- protected translatedMarkup -> NULL
- protected options -> array(0)
- protected stringTranslation -> NULL
- protected string -> string(7) "Content"
- protected arguments -> array(0)
- →public __construct($string, array $arguments = array(), array $options = array(), Drupal\Core\StringTranslation\TranslationInterface $string_translation = NULL)
Constructs a new class instance. When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t(). Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup object directly. Calling the trait's t() method or instantiating a new TranslatableMarkup object serves two purposes: - At run-time it translates user-visible text into the appropriate language. - Static analyzers detect calls to t() and new TranslatableMarkup, and add the first argument (the string to be translated) to the database of strings that need translation. These strings are expected to be in English, so the first argument should always be in English. To allow the site to be localized, it is important that all human-readable text that will be displayed on the site or sent to a user is made available in one of the ways supported by the @link https://www.drupal.org/node/322729 Localization API @endlink. See the @link https://www.drupal.org/node/322729 Localization API @endlink pages for more information, including recommendations on how to break up or not break up strings for translation. @section sec_translating_vars Translating Variables $string should always be an English literal string. $string should never contain a variable, such as: @code new TranslatableMarkup($text) @endcode There are several reasons for this: - Using a variable for $string that is user input is a security risk. - Using a variable for $string that has even guaranteed safe text (for example, user interface text provided literally in code), will not be picked up by the localization static text processor. (The parameter could be a variable if the entire string in $text has been passed into t() or new TranslatableMarkup() elsewhere as the first argument, but that strategy is not recommended.) It is especially important never to call new TranslatableMarkup($user_text) or t($user_text) where $user_text is some text that a user entered -- doing that can lead to cross-site scripting and other security problems. However, you can use variable substitution in your string, to put variable text such as user names or link URLs into translated text. Variable substitution looks like this: @code new TranslatableMarkup("@name's blog", array('@name' => $account->getDisplayName())); @endcode Basically, you can put placeholders like @name into your string, and the method will substitute the sanitized values at translation time. (See the Localization API pages referenced above and the documentation of \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details about how to safely and correctly define variables in your string.) Translators can then rearrange the string as necessary for the language (e.g., in Spanish, it might be "blog de @name"). @param string $string A string containing the English text to translate. @param array $arguments (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details. @param array $options (optional) An associative array of additional options, with the following elements: - 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page. - 'context' (defaults to the empty context): The context the source string belongs to. @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation (optional) The string translation service. @throws \InvalidArgumentException Exception thrown when $string is not a string. @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat() @see \Drupal\Core\StringTranslation\StringTranslationTrait::t() @ingroup sanitization Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:129
- →public __sleep()
Magic __sleep() method to avoid serializing the string translator. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:203
- →public __toString()
Implements the magic __toString() method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:13
- →public count() -> int
Returns the string length. @return int The length of the string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:227
- →public getArguments() -> mixed[]
Gets all arguments from this translated string. @return mixed[] The array of arguments. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:178
- →public getOption($name) -> mixed
Gets a specific option from this translated string. @param string $name Option name. @return mixed The value of this option or empty string of option is not set. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:158
- →public getOptions() -> mixed[]
Gets all options from this translated string. @return mixed[] The array of options. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:168
- →public getUntranslatedString() -> string
Gets the untranslated string value stored in this translated string. @return string The string stored in this wrapper. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145
- →public jsonSerialize() -> string
Returns a representation of the object for use in JSON serialization. @return string The safe string content. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:118
- →public render() -> string
Renders the object as a string. @return string The translated string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:188
- →protected static placeholderEscape($value) -> string
Escapes a placeholder replacement value if needed. @param string|\Drupal\Component\Render\MarkupInterface $value A placeholder replacement value. @return string The properly escaped replacement value. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:264
- →protected static placeholderFormat($string, array $args) -> string
Replaces placeholders in a string with values. @param string $string A string containing placeholders. The string itself is expected to be safe and correct HTML. Any unsafe content must be in $args and inserted via placeholders. @param array $args 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\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 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)); @endcode Use this placeholder as the default choice for anything displayed on the site, but not within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - %variable: Use when the replacement value is to be wrapped in <em> tags. A call like: @code $string = "%output_text"; $arguments = ['%output_text' => 'text output here.']; $this->placeholderFormat($string, $arguments); @endcode makes the following HTML code: @code <em class="placeholder">text output here.</em> @endcode As with @variable, do not use this within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - :variable: Return value is escaped with \Drupal\Component\Utility\Html::escape() and filtered for dangerous protocols using UrlHelper::stripDangerousProtocols(). Use this when using the "href" attribute, ensuring the attribute value is always wrapped in quotes: @code // Secure (with quotes): $this->placeholderFormat('<a href=":url">@variable</a>', [':url' => $url, '@variable' => $variable]); // Insecure (without quotes): $this->placeholderFormat('<a href=:url>@variable</a>', [':url' => $url, '@variable' => $variable]); @endcode When ":variable" comes from arbitrary user input, the result is secure, but not guaranteed to be a valid URL (which means the resulting output could fail HTML validation). To guarantee a valid URL, use Url::fromUri($user_input)->toString() (which either throws an exception or returns a well-formed URL) before passing the result into a ":variable" placeholder. @return string A formatted HTML string with the placeholders replaced. @ingroup sanitization @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() Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:194
- →protected _die()
For test purposes, wrap die() in an overridable method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:31
- →protected getStringTranslation() -> \Drupal\Core\StringTranslation\TranslationInterface
Gets the string translation service. @return \Drupal\Core\StringTranslation\TranslationInterface The string translation service. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:213
- →protected label_collection -> Drupal\Core\StringTranslation\TranslatableMarkup(5)
- contents
- Available methods (14)
- protected translatedMarkup -> NULL
- protected options -> array(0)
- protected stringTranslation -> NULL
- protected string -> string(7) "Content"
- protected arguments -> array(0)
- →public __construct($string, array $arguments = array(), array $options = array(), Drupal\Core\StringTranslation\TranslationInterface $string_translation = NULL)
Constructs a new class instance. When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t(). Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup object directly. Calling the trait's t() method or instantiating a new TranslatableMarkup object serves two purposes: - At run-time it translates user-visible text into the appropriate language. - Static analyzers detect calls to t() and new TranslatableMarkup, and add the first argument (the string to be translated) to the database of strings that need translation. These strings are expected to be in English, so the first argument should always be in English. To allow the site to be localized, it is important that all human-readable text that will be displayed on the site or sent to a user is made available in one of the ways supported by the @link https://www.drupal.org/node/322729 Localization API @endlink. See the @link https://www.drupal.org/node/322729 Localization API @endlink pages for more information, including recommendations on how to break up or not break up strings for translation. @section sec_translating_vars Translating Variables $string should always be an English literal string. $string should never contain a variable, such as: @code new TranslatableMarkup($text) @endcode There are several reasons for this: - Using a variable for $string that is user input is a security risk. - Using a variable for $string that has even guaranteed safe text (for example, user interface text provided literally in code), will not be picked up by the localization static text processor. (The parameter could be a variable if the entire string in $text has been passed into t() or new TranslatableMarkup() elsewhere as the first argument, but that strategy is not recommended.) It is especially important never to call new TranslatableMarkup($user_text) or t($user_text) where $user_text is some text that a user entered -- doing that can lead to cross-site scripting and other security problems. However, you can use variable substitution in your string, to put variable text such as user names or link URLs into translated text. Variable substitution looks like this: @code new TranslatableMarkup("@name's blog", array('@name' => $account->getDisplayName())); @endcode Basically, you can put placeholders like @name into your string, and the method will substitute the sanitized values at translation time. (See the Localization API pages referenced above and the documentation of \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details about how to safely and correctly define variables in your string.) Translators can then rearrange the string as necessary for the language (e.g., in Spanish, it might be "blog de @name"). @param string $string A string containing the English text to translate. @param array $arguments (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details. @param array $options (optional) An associative array of additional options, with the following elements: - 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page. - 'context' (defaults to the empty context): The context the source string belongs to. @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation (optional) The string translation service. @throws \InvalidArgumentException Exception thrown when $string is not a string. @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat() @see \Drupal\Core\StringTranslation\StringTranslationTrait::t() @ingroup sanitization Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:129
- →public __sleep()
Magic __sleep() method to avoid serializing the string translator. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:203
- →public __toString()
Implements the magic __toString() method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:13
- →public count() -> int
Returns the string length. @return int The length of the string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:227
- →public getArguments() -> mixed[]
Gets all arguments from this translated string. @return mixed[] The array of arguments. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:178
- →public getOption($name) -> mixed
Gets a specific option from this translated string. @param string $name Option name. @return mixed The value of this option or empty string of option is not set. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:158
- →public getOptions() -> mixed[]
Gets all options from this translated string. @return mixed[] The array of options. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:168
- →public getUntranslatedString() -> string
Gets the untranslated string value stored in this translated string. @return string The string stored in this wrapper. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145
- →public jsonSerialize() -> string
Returns a representation of the object for use in JSON serialization. @return string The safe string content. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:118
- →public render() -> string
Renders the object as a string. @return string The translated string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:188
- →protected static placeholderEscape($value) -> string
Escapes a placeholder replacement value if needed. @param string|\Drupal\Component\Render\MarkupInterface $value A placeholder replacement value. @return string The properly escaped replacement value. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:264
- →protected static placeholderFormat($string, array $args) -> string
Replaces placeholders in a string with values. @param string $string A string containing placeholders. The string itself is expected to be safe and correct HTML. Any unsafe content must be in $args and inserted via placeholders. @param array $args 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\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 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)); @endcode Use this placeholder as the default choice for anything displayed on the site, but not within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - %variable: Use when the replacement value is to be wrapped in <em> tags. A call like: @code $string = "%output_text"; $arguments = ['%output_text' => 'text output here.']; $this->placeholderFormat($string, $arguments); @endcode makes the following HTML code: @code <em class="placeholder">text output here.</em> @endcode As with @variable, do not use this within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - :variable: Return value is escaped with \Drupal\Component\Utility\Html::escape() and filtered for dangerous protocols using UrlHelper::stripDangerousProtocols(). Use this when using the "href" attribute, ensuring the attribute value is always wrapped in quotes: @code // Secure (with quotes): $this->placeholderFormat('<a href=":url">@variable</a>', [':url' => $url, '@variable' => $variable]); // Insecure (without quotes): $this->placeholderFormat('<a href=:url>@variable</a>', [':url' => $url, '@variable' => $variable]); @endcode When ":variable" comes from arbitrary user input, the result is secure, but not guaranteed to be a valid URL (which means the resulting output could fail HTML validation). To guarantee a valid URL, use Url::fromUri($user_input)->toString() (which either throws an exception or returns a well-formed URL) before passing the result into a ":variable" placeholder. @return string A formatted HTML string with the placeholders replaced. @ingroup sanitization @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() Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:194
- →protected _die()
For test purposes, wrap die() in an overridable method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:31
- →protected getStringTranslation() -> \Drupal\Core\StringTranslation\TranslationInterface
Gets the string translation service. @return \Drupal\Core\StringTranslation\TranslationInterface The string translation service. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:213
- →protected label_singular -> Drupal\Core\StringTranslation\TranslatableMarkup(5)
- contents
- Available methods (14)
- protected translatedMarkup -> NULL
- protected options -> array(0)
- protected stringTranslation -> NULL
- protected string -> string(12) "content item"
- protected arguments -> array(0)
- →public __construct($string, array $arguments = array(), array $options = array(), Drupal\Core\StringTranslation\TranslationInterface $string_translation = NULL)
Constructs a new class instance. When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t(). Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup object directly. Calling the trait's t() method or instantiating a new TranslatableMarkup object serves two purposes: - At run-time it translates user-visible text into the appropriate language. - Static analyzers detect calls to t() and new TranslatableMarkup, and add the first argument (the string to be translated) to the database of strings that need translation. These strings are expected to be in English, so the first argument should always be in English. To allow the site to be localized, it is important that all human-readable text that will be displayed on the site or sent to a user is made available in one of the ways supported by the @link https://www.drupal.org/node/322729 Localization API @endlink. See the @link https://www.drupal.org/node/322729 Localization API @endlink pages for more information, including recommendations on how to break up or not break up strings for translation. @section sec_translating_vars Translating Variables $string should always be an English literal string. $string should never contain a variable, such as: @code new TranslatableMarkup($text) @endcode There are several reasons for this: - Using a variable for $string that is user input is a security risk. - Using a variable for $string that has even guaranteed safe text (for example, user interface text provided literally in code), will not be picked up by the localization static text processor. (The parameter could be a variable if the entire string in $text has been passed into t() or new TranslatableMarkup() elsewhere as the first argument, but that strategy is not recommended.) It is especially important never to call new TranslatableMarkup($user_text) or t($user_text) where $user_text is some text that a user entered -- doing that can lead to cross-site scripting and other security problems. However, you can use variable substitution in your string, to put variable text such as user names or link URLs into translated text. Variable substitution looks like this: @code new TranslatableMarkup("@name's blog", array('@name' => $account->getDisplayName())); @endcode Basically, you can put placeholders like @name into your string, and the method will substitute the sanitized values at translation time. (See the Localization API pages referenced above and the documentation of \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details about how to safely and correctly define variables in your string.) Translators can then rearrange the string as necessary for the language (e.g., in Spanish, it might be "blog de @name"). @param string $string A string containing the English text to translate. @param array $arguments (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details. @param array $options (optional) An associative array of additional options, with the following elements: - 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page. - 'context' (defaults to the empty context): The context the source string belongs to. @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation (optional) The string translation service. @throws \InvalidArgumentException Exception thrown when $string is not a string. @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat() @see \Drupal\Core\StringTranslation\StringTranslationTrait::t() @ingroup sanitization Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:129
- →public __sleep()
Magic __sleep() method to avoid serializing the string translator. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:203
- →public __toString()
Implements the magic __toString() method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:13
- →public count() -> int
Returns the string length. @return int The length of the string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:227
- →public getArguments() -> mixed[]
Gets all arguments from this translated string. @return mixed[] The array of arguments. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:178
- →public getOption($name) -> mixed
Gets a specific option from this translated string. @param string $name Option name. @return mixed The value of this option or empty string of option is not set. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:158
- →public getOptions() -> mixed[]
Gets all options from this translated string. @return mixed[] The array of options. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:168
- →public getUntranslatedString() -> string
Gets the untranslated string value stored in this translated string. @return string The string stored in this wrapper. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145
- →public jsonSerialize() -> string
Returns a representation of the object for use in JSON serialization. @return string The safe string content. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:118
- →public render() -> string
Renders the object as a string. @return string The translated string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:188
- →protected static placeholderEscape($value) -> string
Escapes a placeholder replacement value if needed. @param string|\Drupal\Component\Render\MarkupInterface $value A placeholder replacement value. @return string The properly escaped replacement value. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:264
- →protected static placeholderFormat($string, array $args) -> string
Replaces placeholders in a string with values. @param string $string A string containing placeholders. The string itself is expected to be safe and correct HTML. Any unsafe content must be in $args and inserted via placeholders. @param array $args 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\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 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)); @endcode Use this placeholder as the default choice for anything displayed on the site, but not within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - %variable: Use when the replacement value is to be wrapped in <em> tags. A call like: @code $string = "%output_text"; $arguments = ['%output_text' => 'text output here.']; $this->placeholderFormat($string, $arguments); @endcode makes the following HTML code: @code <em class="placeholder">text output here.</em> @endcode As with @variable, do not use this within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - :variable: Return value is escaped with \Drupal\Component\Utility\Html::escape() and filtered for dangerous protocols using UrlHelper::stripDangerousProtocols(). Use this when using the "href" attribute, ensuring the attribute value is always wrapped in quotes: @code // Secure (with quotes): $this->placeholderFormat('<a href=":url">@variable</a>', [':url' => $url, '@variable' => $variable]); // Insecure (without quotes): $this->placeholderFormat('<a href=:url>@variable</a>', [':url' => $url, '@variable' => $variable]); @endcode When ":variable" comes from arbitrary user input, the result is secure, but not guaranteed to be a valid URL (which means the resulting output could fail HTML validation). To guarantee a valid URL, use Url::fromUri($user_input)->toString() (which either throws an exception or returns a well-formed URL) before passing the result into a ":variable" placeholder. @return string A formatted HTML string with the placeholders replaced. @ingroup sanitization @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() Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:194
- →protected _die()
For test purposes, wrap die() in an overridable method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:31
- →protected getStringTranslation() -> \Drupal\Core\StringTranslation\TranslationInterface
Gets the string translation service. @return \Drupal\Core\StringTranslation\TranslationInterface The string translation service. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:213
- →protected label_plural -> Drupal\Core\StringTranslation\TranslatableMarkup(5)
- contents
- Available methods (14)
- protected translatedMarkup -> NULL
- protected options -> array(0)
- protected stringTranslation -> NULL
- protected string -> string(13) "content items"
- protected arguments -> array(0)
- →public __construct($string, array $arguments = array(), array $options = array(), Drupal\Core\StringTranslation\TranslationInterface $string_translation = NULL)
Constructs a new class instance. When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t(). Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup object directly. Calling the trait's t() method or instantiating a new TranslatableMarkup object serves two purposes: - At run-time it translates user-visible text into the appropriate language. - Static analyzers detect calls to t() and new TranslatableMarkup, and add the first argument (the string to be translated) to the database of strings that need translation. These strings are expected to be in English, so the first argument should always be in English. To allow the site to be localized, it is important that all human-readable text that will be displayed on the site or sent to a user is made available in one of the ways supported by the @link https://www.drupal.org/node/322729 Localization API @endlink. See the @link https://www.drupal.org/node/322729 Localization API @endlink pages for more information, including recommendations on how to break up or not break up strings for translation. @section sec_translating_vars Translating Variables $string should always be an English literal string. $string should never contain a variable, such as: @code new TranslatableMarkup($text) @endcode There are several reasons for this: - Using a variable for $string that is user input is a security risk. - Using a variable for $string that has even guaranteed safe text (for example, user interface text provided literally in code), will not be picked up by the localization static text processor. (The parameter could be a variable if the entire string in $text has been passed into t() or new TranslatableMarkup() elsewhere as the first argument, but that strategy is not recommended.) It is especially important never to call new TranslatableMarkup($user_text) or t($user_text) where $user_text is some text that a user entered -- doing that can lead to cross-site scripting and other security problems. However, you can use variable substitution in your string, to put variable text such as user names or link URLs into translated text. Variable substitution looks like this: @code new TranslatableMarkup("@name's blog", array('@name' => $account->getDisplayName())); @endcode Basically, you can put placeholders like @name into your string, and the method will substitute the sanitized values at translation time. (See the Localization API pages referenced above and the documentation of \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details about how to safely and correctly define variables in your string.) Translators can then rearrange the string as necessary for the language (e.g., in Spanish, it might be "blog de @name"). @param string $string A string containing the English text to translate. @param array $arguments (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details. @param array $options (optional) An associative array of additional options, with the following elements: - 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page. - 'context' (defaults to the empty context): The context the source string belongs to. @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation (optional) The string translation service. @throws \InvalidArgumentException Exception thrown when $string is not a string. @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat() @see \Drupal\Core\StringTranslation\StringTranslationTrait::t() @ingroup sanitization Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:129
- →public __sleep()
Magic __sleep() method to avoid serializing the string translator. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:203
- →public __toString()
Implements the magic __toString() method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:13
- →public count() -> int
Returns the string length. @return int The length of the string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:227
- →public getArguments() -> mixed[]
Gets all arguments from this translated string. @return mixed[] The array of arguments. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:178
- →public getOption($name) -> mixed
Gets a specific option from this translated string. @param string $name Option name. @return mixed The value of this option or empty string of option is not set. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:158
- →public getOptions() -> mixed[]
Gets all options from this translated string. @return mixed[] The array of options. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:168
- →public getUntranslatedString() -> string
Gets the untranslated string value stored in this translated string. @return string The string stored in this wrapper. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145
- →public jsonSerialize() -> string
Returns a representation of the object for use in JSON serialization. @return string The safe string content. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:118
- →public render() -> string
Renders the object as a string. @return string The translated string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:188
- →protected static placeholderEscape($value) -> string
Escapes a placeholder replacement value if needed. @param string|\Drupal\Component\Render\MarkupInterface $value A placeholder replacement value. @return string The properly escaped replacement value. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:264
- →protected static placeholderFormat($string, array $args) -> string
Replaces placeholders in a string with values. @param string $string A string containing placeholders. The string itself is expected to be safe and correct HTML. Any unsafe content must be in $args and inserted via placeholders. @param array $args 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\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 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)); @endcode Use this placeholder as the default choice for anything displayed on the site, but not within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - %variable: Use when the replacement value is to be wrapped in <em> tags. A call like: @code $string = "%output_text"; $arguments = ['%output_text' => 'text output here.']; $this->placeholderFormat($string, $arguments); @endcode makes the following HTML code: @code <em class="placeholder">text output here.</em> @endcode As with @variable, do not use this within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - :variable: Return value is escaped with \Drupal\Component\Utility\Html::escape() and filtered for dangerous protocols using UrlHelper::stripDangerousProtocols(). Use this when using the "href" attribute, ensuring the attribute value is always wrapped in quotes: @code // Secure (with quotes): $this->placeholderFormat('<a href=":url">@variable</a>', [':url' => $url, '@variable' => $variable]); // Insecure (without quotes): $this->placeholderFormat('<a href=:url>@variable</a>', [':url' => $url, '@variable' => $variable]); @endcode When ":variable" comes from arbitrary user input, the result is secure, but not guaranteed to be a valid URL (which means the resulting output could fail HTML validation). To guarantee a valid URL, use Url::fromUri($user_input)->toString() (which either throws an exception or returns a well-formed URL) before passing the result into a ":variable" placeholder. @return string A formatted HTML string with the placeholders replaced. @ingroup sanitization @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() Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:194
- →protected _die()
For test purposes, wrap die() in an overridable method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:31
- →protected getStringTranslation() -> \Drupal\Core\StringTranslation\TranslationInterface
Gets the string translation service. @return \Drupal\Core\StringTranslation\TranslationInterface The string translation service. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:213
- →protected label_count -> array(3)
- 'singular' => string(19) "@count content item"
- 'plural' => string(20) "@count content items"
- 'context' => NULL
- protected uri_callback -> NULL
- protected group -> string(7) "content"
- →protected group_label -> Drupal\Core\StringTranslation\TranslatableMarkup(5)
- contents
- Available methods (14)
- protected translatedMarkup -> NULL
- →protected options -> array(1)
- 'context' => string(17) "Entity type group"
- protected stringTranslation -> NULL
- protected string -> string(7) "Content"
- protected arguments -> array(0)
- →public __construct($string, array $arguments = array(), array $options = array(), Drupal\Core\StringTranslation\TranslationInterface $string_translation = NULL)
Constructs a new class instance. When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t(). Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup object directly. Calling the trait's t() method or instantiating a new TranslatableMarkup object serves two purposes: - At run-time it translates user-visible text into the appropriate language. - Static analyzers detect calls to t() and new TranslatableMarkup, and add the first argument (the string to be translated) to the database of strings that need translation. These strings are expected to be in English, so the first argument should always be in English. To allow the site to be localized, it is important that all human-readable text that will be displayed on the site or sent to a user is made available in one of the ways supported by the @link https://www.drupal.org/node/322729 Localization API @endlink. See the @link https://www.drupal.org/node/322729 Localization API @endlink pages for more information, including recommendations on how to break up or not break up strings for translation. @section sec_translating_vars Translating Variables $string should always be an English literal string. $string should never contain a variable, such as: @code new TranslatableMarkup($text) @endcode There are several reasons for this: - Using a variable for $string that is user input is a security risk. - Using a variable for $string that has even guaranteed safe text (for example, user interface text provided literally in code), will not be picked up by the localization static text processor. (The parameter could be a variable if the entire string in $text has been passed into t() or new TranslatableMarkup() elsewhere as the first argument, but that strategy is not recommended.) It is especially important never to call new TranslatableMarkup($user_text) or t($user_text) where $user_text is some text that a user entered -- doing that can lead to cross-site scripting and other security problems. However, you can use variable substitution in your string, to put variable text such as user names or link URLs into translated text. Variable substitution looks like this: @code new TranslatableMarkup("@name's blog", array('@name' => $account->getDisplayName())); @endcode Basically, you can put placeholders like @name into your string, and the method will substitute the sanitized values at translation time. (See the Localization API pages referenced above and the documentation of \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details about how to safely and correctly define variables in your string.) Translators can then rearrange the string as necessary for the language (e.g., in Spanish, it might be "blog de @name"). @param string $string A string containing the English text to translate. @param array $arguments (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details. @param array $options (optional) An associative array of additional options, with the following elements: - 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page. - 'context' (defaults to the empty context): The context the source string belongs to. @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation (optional) The string translation service. @throws \InvalidArgumentException Exception thrown when $string is not a string. @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat() @see \Drupal\Core\StringTranslation\StringTranslationTrait::t() @ingroup sanitization Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:129
- →public __sleep()
Magic __sleep() method to avoid serializing the string translator. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:203
- →public __toString()
Implements the magic __toString() method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:13
- →public count() -> int
Returns the string length. @return int The length of the string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:227
- →public getArguments() -> mixed[]
Gets all arguments from this translated string. @return mixed[] The array of arguments. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:178
- →public getOption($name) -> mixed
Gets a specific option from this translated string. @param string $name Option name. @return mixed The value of this option or empty string of option is not set. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:158
- →public getOptions() -> mixed[]
Gets all options from this translated string. @return mixed[] The array of options. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:168
- →public getUntranslatedString() -> string
Gets the untranslated string value stored in this translated string. @return string The string stored in this wrapper. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145
- →public jsonSerialize() -> string
Returns a representation of the object for use in JSON serialization. @return string The safe string content. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:118
- →public render() -> string
Renders the object as a string. @return string The translated string. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:188
- →protected static placeholderEscape($value) -> string
Escapes a placeholder replacement value if needed. @param string|\Drupal\Component\Render\MarkupInterface $value A placeholder replacement value. @return string The properly escaped replacement value. Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:264
- →protected static placeholderFormat($string, array $args) -> string
Replaces placeholders in a string with values. @param string $string A string containing placeholders. The string itself is expected to be safe and correct HTML. Any unsafe content must be in $args and inserted via placeholders. @param array $args 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\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 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)); @endcode Use this placeholder as the default choice for anything displayed on the site, but not within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - %variable: Use when the replacement value is to be wrapped in <em> tags. A call like: @code $string = "%output_text"; $arguments = ['%output_text' => 'text output here.']; $this->placeholderFormat($string, $arguments); @endcode makes the following HTML code: @code <em class="placeholder">text output here.</em> @endcode As with @variable, do not use this within HTML attributes, JavaScript, or CSS. Doing so is a security risk. - :variable: Return value is escaped with \Drupal\Component\Utility\Html::escape() and filtered for dangerous protocols using UrlHelper::stripDangerousProtocols(). Use this when using the "href" attribute, ensuring the attribute value is always wrapped in quotes: @code // Secure (with quotes): $this->placeholderFormat('<a href=":url">@variable</a>', [':url' => $url, '@variable' => $variable]); // Insecure (without quotes): $this->placeholderFormat('<a href=:url>@variable</a>', [':url' => $url, '@variable' => $variable]); @endcode When ":variable" comes from arbitrary user input, the result is secure, but not guaranteed to be a valid URL (which means the resulting output could fail HTML validation). To guarantee a valid URL, use Url::fromUri($user_input)->toString() (which either throws an exception or returns a well-formed URL) before passing the result into a ":variable" placeholder. @return string A formatted HTML string with the placeholders replaced. @ingroup sanitization @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() Inherited from Drupal\Component\Render\FormattableMarkup Defined in <ROOT>/core/lib/Drupal/Component/Render/FormattableMarkup.php:194
- →protected _die()
For test purposes, wrap die() in an overridable method. Defined in <ROOT>/core/lib/Drupal/Component/Utility/ToStringTrait.php:31
- →protected getStringTranslation() -> \Drupal\Core\StringTranslation\TranslationInterface
Gets the string translation service. @return \Drupal\Core\StringTranslation\TranslationInterface The string translation service. Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:213
- protected field_ui_base_route -> string(26) "entity.node_type.edit_form"
- protected common_reference_target -> boolTRUE
- →protected list_cache_contexts -> array(1)
- string(21) "user.node_grants:view"
- →protected list_cache_tags -> array(1)
- string(9) "node_list"
- →protected constraints -> array(4)
- 'EntityChanged' => NULL
- 'EntityUntranslatableFields' => NULL
- 'BookOutline' => array(0)
- 'MenuSettings' => array(0)
- →protected additional -> array(1)
- 'token_type' => string(4) "node"
- protected class -> string(23) "Drupal\node\Entity\Node"
- protected provider -> string(4) "node"
- protected _serviceIds -> array(0)
- protected _entityStorages -> array(0)
- protected stringTranslation -> NULL
- →public __construct($definition)
{@inheritdoc} Defined in <ROOT>/core/lib/Drupal/Core/Entity/ContentEntityType.php:27
- →public __sleep()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php:30
- →public __wakeup()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php:65
- →public addConstraint($constraint_name, $options = NULL)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:909
- →public entityClassImplements($interface)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:442
- →public get($property)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:345
- →public getAccessControlClass()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:604
- →public getAdminPermission()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:619
- →public getBaseTable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:722
- →public getBundleConfigDependency($bundle)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:917
- →public getBundleEntityType()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:693
- →public getBundleLabel()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:707
- →public getBundleOf()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:700
- →public getClass()
{@inheritdoc} Inherited from Drupal\Component\Plugin\Definition\PluginDefinition Defined in <ROOT>/core/lib/Drupal/Component/Plugin/Definition/PluginDefinition.php:49
- →public getCollectionLabel()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:787
- →public getConfigDependencyKey()
{@inheritdoc} Defined in <ROOT>/core/lib/Drupal/Core/Entity/ContentEntityType.php:57
- →public getConstraints()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:894
- →public getCountLabel($count)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:820
- →public getDataTable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:765
- →public getFormClass($operation)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:524
- →public getGroup()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:849
- →public getGroupLabel()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:856
- →public getHandlerClass($handler_type, $nested = false)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:464
- →public getHandlerClasses()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:457
- →public getKey($key)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:406
- →public getKeys()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:399
- →public getLabel()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:772
- →public getLabelCallback()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:668
- →public getLinkTemplate($key)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:640
- →public getLinkTemplates()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:633
- →public getListBuilderClass()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:553
- →public getListCacheContexts()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:863
- →public getListCacheTags()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:870
- →public getLowercaseLabel()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:779
- →public getOriginalClass()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:422
- →public getPermissionGranularity()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:626
- →public getPluralLabel()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:809
- →public getProvider()
{@inheritdoc} Inherited from Drupal\Component\Plugin\Definition\PluginDefinition Defined in <ROOT>/core/lib/Drupal/Component/Plugin/Definition/PluginDefinition.php:56
- →public getRevisionDataTable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:751
- →public getRevisionMetadataKey($key)
{@inheritdoc} Defined in <ROOT>/core/lib/Drupal/Core/Entity/ContentEntityType.php:104
- →public getRevisionMetadataKeys($include_backwards_compatibility_field_names = true)
{@inheritdoc} Defined in <ROOT>/core/lib/Drupal/Core/Entity/ContentEntityType.php:80
- →public getRevisionTable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:758
- →public getRouteProviderClasses()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:597
- →public getSingularLabel()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:798
- →public getStorageClass()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:498
- →public getUriCallback()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:834
- →public getViewBuilderClass()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:575
- →public hasFormClasses()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:539
- →public hasHandlerClass($handler_type, $nested = false)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:483
- →public hasKey($key)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:414
- →public hasLabelCallback()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:685
- →public hasLinkTemplate($key)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:648
- →public hasListBuilderClass()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:568
- →public hasRevisionMetadataKey($key)
{@inheritdoc} Defined in <ROOT>/core/lib/Drupal/Core/Entity/ContentEntityType.php:112
- →public hasRouteProviders()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:546
- →public hasViewBuilderClass()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:590
- →public id()
{@inheritdoc} Inherited from Drupal\Component\Plugin\Definition\PluginDefinition Defined in <ROOT>/core/lib/Drupal/Component/Plugin/Definition/PluginDefinition.php:34
- →public isCommonReferenceTarget()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:887
- →public isInternal()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:371
- →public isPersistentlyCacheable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:392
- →public isRenderCacheable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:385
- →public isRevisionable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:743
- →public isStaticallyCacheable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:378
- →public isSubclassOf($class)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:449
- →public isTranslatable()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:736
- →public set($property, $value)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:358
- →public setAccessClass($class)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:611
- →public setClass($class)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:429
- →public setConstraints(array $constraints)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:901
- →public setFormClass($operation, $class)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:531
- →public setHandlerClass($handler_type, $value)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:475
- →public setLabelCallback($callback)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:676
- →public setLinkTemplate($key, $path)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:656
- →public setListBuilderClass($class)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:560
- →public setRevisionMetadataKey($key, $field_name)
{@inheritdoc} Defined in <ROOT>/core/lib/Drupal/Core/Entity/ContentEntityType.php:120
- →public setStorageClass($class)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:505
- →public setStringTranslation(Drupal\Core\StringTranslation\TranslationInterface $translation) -> $this
Sets the string translation service to use. @param \Drupal\Core\StringTranslation\TranslationInterface $translation The string translation service. @return $this Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php:118
- →public setUriCallback($callback)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:841
- →public setViewBuilderClass($class)
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:582
- →public showRevisionUi()
{@inheritdoc} Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/Entity/EntityType.php:729
- →protected checkStorageClass($class)
{@inheritdoc} @throws \InvalidArgumentException If the provided class does not implement \Drupal\Core\Entity\ContentEntityStorageInterface. @see \Drupal\Core\Entity\ContentEntityStorageInterface Defined in <ROOT>/core/lib/Drupal/Core/Entity/ContentEntityType.php:70
- →protected formatPlural($count, $singular, $plural, array $args = array(), array $options = array())
Formats a string containing a count of items. @see \Drupal\Core\StringTranslation\TranslationInterface::formatPlural() Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php:79
- →protected getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language. @see \Drupal\locale\PluralFormulaInterface::getNumberOfPlurals() Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php:88
- →protected getStringTranslation() -> \Drupal\Core\StringTranslation\TranslationInterface
Gets the string translation service. @return \Drupal\Core\StringTranslation\TranslationInterface The string translation service. Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php:102
- →protected t($string, array $args = array(), array $options = array()) -> \Drupal\Core\StringTranslation\TranslatableMarkup
Translates a string to the current language or to a given language. See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines. In order for strings to be localized, make them available in one of the ways supported by the @link https://www.drupal.org/node/322729 Localization API @endlink. When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t(). Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup object. @param string $string A string containing the English text to translate. @param array $args (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details. @param array $options (optional) An associative array of additional options, with the following elements: - 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page. - 'context' (defaults to the empty context): The context the source string belongs to. See the @link i18n Internationalization topic @endlink for more information about string contexts. @return \Drupal\Core\StringTranslation\TranslatableMarkup An object that, when cast to a string, returns the translated string. @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat() @see \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() @ingroup sanitization Inherited from Drupal\Core\Entity\EntityType Defined in <ROOT>/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php:70
- constant ID_MAX_LENGTH :: integer32
- constant BUNDLE_MAX_LENGTH :: integer32