You are here

function format_string in Drupal 8

Same name and namespace in other branches
  1. 7 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

File

core/includes/bootstrap.inc, line 371
Functions that need to be loaded on every Drupal request.

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);
}