public function EntityFormProxy::validate in Lightning Media 8.3
Same name and namespace in other branches
- 8.4 src/Plugin/EntityBrowser/Widget/EntityFormProxy.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EntityFormProxy::validate()
- 8 src/Plugin/EntityBrowser/Widget/EntityFormProxy.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EntityFormProxy::validate()
- 8.2 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 141
Class
- EntityFormProxy
- Base class for EB widgets which wrap around an (inline) entity form.
Namespace
Drupal\lightning_media\Plugin\EntityBrowser\WidgetCode
public function validate(array &$form, FormStateInterface $form_state) {
parent::validate($form, $form_state);
$value = $this
->getCurrentValue($form_state);
$types = $this
->getTypesByValue($value);
if (empty($types)) {
$error = sprintf('Input did not match any media types: %s', $value instanceof EntityInterface ? $value
->label() : var_export($value, TRUE));
$form_state
->setError($form['widget']['input'], $error);
}
}