function AddFormBase::submitForm
Same name in other branches
- 8.9.x core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::submitForm()
- 10 core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::submitForm()
- 11.x core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::submitForm()
Overrides FormInterface::submitForm
File
-
core/
modules/ media_library/ src/ Form/ AddFormBase.php, line 673
Class
- AddFormBase
- Provides a base class for creating media items from within the media library.
Namespace
Drupal\media_library\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ($this->getAddedMediaItems($form_state) as $delta => $media) {
EntityFormDisplay::collectRenderDisplay($media, 'media_library')->extractFormValues($media, $form['media'][$delta]['fields'], $form_state);
$this->prepareMediaEntityForSave($media);
$media->save();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.