function TranslatableMarkup::render

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php \Drupal\Core\StringTranslation\TranslatableMarkup::render()
  2. 10 core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php \Drupal\Core\StringTranslation\TranslatableMarkup::render()
  3. 11.x core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php \Drupal\Core\StringTranslation\TranslatableMarkup::render()

Renders the object as a string.

Return value

string The translated string.

Overrides ToStringTrait::render

1 call to TranslatableMarkup::render()
TranslatableMarkup::count in core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php
Returns the string length.
1 method overrides TranslatableMarkup::render()
PluralTranslatableMarkup::render in core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php
Renders the object as a string.

File

core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php, line 188

Class

TranslatableMarkup
Provides translatable markup class.

Namespace

Drupal\Core\StringTranslation

Code

public function render() {
    if (!isset($this->translatedMarkup)) {
        $this->translatedMarkup = $this->getStringTranslation()
            ->translateString($this);
    }
    // Handle any replacements.
    if ($args = $this->getArguments()) {
        return $this->placeholderFormat($this->translatedMarkup, $args);
    }
    return $this->translatedMarkup;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.