public static SafeMarkup::format($string, array $args)
Formats a string for HTML display by replacing variable placeholders.
string $string: A string containing placeholders. The string itself will not be escaped, any unsafe content must be in $args and inserted via placeholders.
array $args: An array with placeholder replacements, keyed by placeholder. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for additional information about placeholders.
string|\Drupal\Component\Render\MarkupInterface The formatted string, which is an instance of MarkupInterface unless sanitization of an unsafe argument was suppressed (see above).
in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use \Drupal\Component\Render\FormattableMarkup.
\Drupal\Component\Render\FormattableMarkup::placeholderFormat()
\Drupal\Component\Render\FormattableMarkup
public static function format($string, array $args) { return new FormattableMarkup($string, $args); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!SafeMarkup.php/function/SafeMarkup::format/8.1.x