function format_string

Same name in other branches
  1. 7.x includes/bootstrap.inc \format_string()

Formats a string for HTML display by replacing variable placeholders.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Component\Render\FormattableMarkup instead.

See also

https://www.drupal.org/node/2302363

\Drupal\Component\Render\FormattableMarkup::placeholderFormat()

\Drupal\Component\Render\FormattableMarkup

t()

Related topics

1 call to format_string()
FormatStringTest::testFormatString in core/tests/Drupal/KernelTests/Core/Bootstrap/FormatStringTest.php
Tests error triggering on format_string.

File

core/includes/bootstrap.inc, line 371

Code

function format_string($string, array $args) {
    @trigger_error("format_string() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \\Drupal\\Component\\Render\\FormattableMarkup instead. See https://www.drupal.org/node/2302363", E_USER_DEPRECATED);
    return new FormattableMarkup($string, $args);
}

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