You are here

public static function SafeMarkup::isSafe 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::isSafe()

Checks if a string is safe to output.

Parameters

string|\Drupal\Component\Render\MarkupInterface $string: The content to be checked.

string $strategy: (optional) This value is ignored.

Return value

bool TRUE if the string has been marked secure, FALSE otherwise.

Deprecated

in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Instead, you should just check if a variable is an instance of \Drupal\Component\Render\MarkupInterface.

22 calls to SafeMarkup::isSafe()
Attribute::createAttributeValue in core/lib/Drupal/Core/Template/Attribute.php
Creates the different types of attribute values.
CommentPreviewTest::testCommentPreview in core/modules/comment/src/Tests/CommentPreviewTest.php
Tests comment preview.
drupal_set_message in core/includes/bootstrap.inc
Sets a message to display to the user.
FieldPluginBase::renderText in core/modules/views/src/Plugin/views/field/FieldPluginBase.php
Performs an advanced text render for the item.
FormattableMarkup::placeholderEscape in core/lib/Drupal/Component/Render/FormattableMarkup.php
Escapes a placeholder replacement value if needed.

... See full list

File

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

Class

SafeMarkup
Contains deprecated functionality related to sanitization of markup.

Namespace

Drupal\Component\Utility

Code

public static function isSafe($string, $strategy = 'html') {
  return $string instanceof MarkupInterface;
}