You are here

public static function Utility::escapeHtml in Search API 8

Escapes HTML special characters in plain text, if necessary.

Parameters

string|\Drupal\Component\Render\MarkupInterface $text: The text to escape.

Return value

\Drupal\Component\Render\MarkupInterface If a markup object was passed as $text, it is returned as-is. Otherwise, the text is escaped and returned

10 calls to Utility::escapeHtml()
AddHierarchy::findHierarchicalProperties in src/Plugin/search_api/processor/AddHierarchy.php
Finds all hierarchical properties nested on an entity-typed property.
AggregatedFieldProperty::buildConfigurationForm in src/Plugin/search_api/processor/Property/AggregatedFieldProperty.php
Constructs a configuration form for a field based on this property.
ContentEntity::getEntityBundleOptions in src/Plugin/search_api/datasource/ContentEntity.php
Retrieves the available bundles of this entity type as an options list.
IndexForm::buildEntityForm in src/Form/IndexForm.php
Builds the form for the basic index properties.
IndexForm::buildTrackerConfigForm in src/Form/IndexForm.php
Builds the tracker configuration form.

... See full list

File

src/Utility/Utility.php, line 264

Class

Utility
Contains utility methods for the Search API.

Namespace

Drupal\search_api\Utility

Code

public static function escapeHtml($text) {
  if ($text instanceof MarkupInterface) {
    return $text;
  }
  return Markup::create(Html::escape((string) $text));
}