public function EmbedCode::validate in Lightning Media 8.4
Same name and namespace in other branches
- 8 src/Plugin/EntityBrowser/Widget/EmbedCode.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EmbedCode::validate()
- 8.2 src/Plugin/EntityBrowser/Widget/EmbedCode.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EmbedCode::validate()
- 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 55
Class
- EmbedCode
- An Entity Browser widget for creating media entities from embed codes.
Namespace
Drupal\lightning_media\Plugin\EntityBrowser\WidgetCode
public function validate(array &$form, FormStateInterface $form_state) {
$value = $this
->getCurrentValue($form_state);
if ($value) {
parent::validate($form, $form_state);
}
elseif ($form_state
->isSubmitted()) {
$form_state
->setError($form['widget']['input'], $this
->t('You must enter a URL or embed code.'));
}
}