You are here

public function EntityFormProxy::validate in Lightning Media 8.2

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

File

src/Plugin/EntityBrowser/Widget/EntityFormProxy.php, line 198

Class

EntityFormProxy
Base class for EB widgets which wrap around an (inline) entity form.

Namespace

Drupal\lightning_media\Plugin\EntityBrowser\Widget

Code

public function validate(array &$form, FormStateInterface $form_state) {
  parent::validate($form, $form_state);
  $value = $this
    ->getInputValue($form_state);
  try {
    $this->helper
      ->getBundleFromInput($value, TRUE, $this
      ->getAllowedBundles($form_state));
  } catch (IndeterminateBundleException $e) {
    $form_state
      ->setError($form['widget'], $e
      ->getMessage());
  }
  if ($form_state
    ->hasValue('bundle')) {
    $form_state
      ->setError($form['widget'], $this
      ->t('You must select the bundle.'));
  }
}