You are here

protected function AddFormBase::validateMediaEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::validateMediaEntity()

Validate a created media item.

Parameters

\Drupal\media\MediaInterface $media: The media item to validate.

array $form: The complete form.

\Drupal\Core\Form\FormStateInterface $form_state: The current form state.

int $delta: The delta of the media item.

1 call to AddFormBase::validateMediaEntity()
AddFormBase::validateForm in core/modules/media_library/src/Form/AddFormBase.php
Form validation handler.

File

core/modules/media_library/src/Form/AddFormBase.php, line 664

Class

AddFormBase
Provides a base class for creating media items from within the media library.

Namespace

Drupal\media_library\Form

Code

protected function validateMediaEntity(MediaInterface $media, array $form, FormStateInterface $form_state, $delta) {
  $form_display = EntityFormDisplay::collectRenderDisplay($media, 'media_library');
  $form_display
    ->extractFormValues($media, $form['media'][$delta]['fields'], $form_state);
  $form_display
    ->validateFormValues($media, $form['media'][$delta]['fields'], $form_state);
}