You are here

public static function SafeMarkup::format in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Component/Utility/SafeMarkup.php \Drupal\Component\Utility\SafeMarkup::format()

Formats a string for HTML display by replacing variable placeholders.

Parameters

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.

Return value

string|\Drupal\Component\Render\MarkupInterface The formatted string, which is an instance of MarkupInterface unless sanitization of an unsafe argument was suppressed (see above).

Deprecated

in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use \Drupal\Component\Render\FormattableMarkup.

See also

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

\Drupal\Component\Render\FormattableMarkup

179 calls to SafeMarkup::format()
AccessDeniedTest::testAccessDenied in core/modules/system/src/Tests/System/AccessDeniedTest.php
AggregatorRenderingTest::testFeedPage in core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
Creates a feed and checks that feed's page.
AssertContentTrait::assertFieldById in core/modules/simpletest/src/AssertContentTrait.php
Asserts that a field exists with the given ID and value.
AssertContentTrait::assertFieldByName in core/modules/simpletest/src/AssertContentTrait.php
Asserts that a field exists with the given name and value.
AssertContentTrait::assertFieldChecked in core/modules/simpletest/src/AssertContentTrait.php
Asserts that a checkbox field in the current page is checked.

... See full list

File

core/lib/Drupal/Component/Utility/SafeMarkup.php, line 93
Contains \Drupal\Component\Utility\SafeMarkup.

Class

SafeMarkup
Contains deprecated functionality related to sanitization of markup.

Namespace

Drupal\Component\Utility

Code

public static function format($string, array $args) {
  return new FormattableMarkup($string, $args);
}