W3cubDocs

/Drupal 8

public static function SafeMarkup::isSafe

public static SafeMarkup::isSafe($string, $strategy = 'html')

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.

File

core/lib/Drupal/Component/Utility/SafeMarkup.php, line 38

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

© 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::isSafe/8.1.x