You are here

protected function EntityReferenceHierarchySelect::sanitizeLabel in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/EntityReferenceHierarchySelect.php \Drupal\entity_hierarchy\Plugin\Field\FieldWidget\EntityReferenceHierarchySelect::sanitizeLabel()

Sanitizes a string label to display as an option.

Parameters

string $label: The label to sanitize.

Overrides OptionsWidgetBase::sanitizeLabel

File

src/Plugin/Field/FieldWidget/EntityReferenceHierarchySelect.php, line 102

Class

EntityReferenceHierarchySelect
Select widget.

Namespace

Drupal\entity_hierarchy\Plugin\Field\FieldWidget

Code

protected function sanitizeLabel(&$label) {

  // Select form inputs allow unencoded HTML entities, but no HTML tags.
  $label = Html::decodeEntities(strip_tags($label));
}