You are here

public static function EntityEmbedDialog::escapeValue in Entity Embed 8

Form element validation handler; Escapes the value an element.

This should be used for any element in the embed form which may contain HTML that should be serialized as an attribute element on the embed.

File

src/Form/EntityEmbedDialog.php, line 848

Class

EntityEmbedDialog
Provides a form to embed entities by specifying data attributes.

Namespace

Drupal\entity_embed\Form

Code

public static function escapeValue($element, FormStateInterface $form_state) {
  if ($value = trim($element['#value'])) {
    $form_state
      ->setValueForElement($element, Html::escape($value));
  }
}