You are here

public function EmbedCode::validate in Lightning Media 8.2

Same name and namespace in other branches
  1. 8.4 src/Plugin/EntityBrowser/Widget/EmbedCode.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EmbedCode::validate()
  2. 8 src/Plugin/EntityBrowser/Widget/EmbedCode.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EmbedCode::validate()
  3. 8.3 src/Plugin/EntityBrowser/Widget/EmbedCode.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EmbedCode::validate()

Overrides EntityFormProxy::validate

File

src/Plugin/EntityBrowser/Widget/EmbedCode.php, line 68

Class

EmbedCode
An Entity Browser widget for creating media entities from embed codes.

Namespace

Drupal\lightning_media\Plugin\EntityBrowser\Widget

Code

public function validate(array &$form, FormStateInterface $form_state) {
  $value = trim($this
    ->getInputValue($form_state));
  if ($value) {
    parent::validate($form, $form_state);
  }
  else {
    $form_state
      ->setError($form['widget'], $this
      ->t('You must enter a URL or embed code.'));
  }
}