function FileUploadForm::buildEntityFormElement
Same name in other branches
- 8.9.x core/modules/media_library/src/Form/FileUploadForm.php \Drupal\media_library\Form\FileUploadForm::buildEntityFormElement()
- 10 core/modules/media_library/src/Form/FileUploadForm.php \Drupal\media_library\Form\FileUploadForm::buildEntityFormElement()
- 11.x core/modules/media_library/src/Form/FileUploadForm.php \Drupal\media_library\Form\FileUploadForm::buildEntityFormElement()
Overrides AddFormBase::buildEntityFormElement
File
-
core/
modules/ media_library/ src/ Form/ FileUploadForm.php, line 262
Class
- FileUploadForm
- Creates a form to create media entities from uploaded files.
Namespace
Drupal\media_library\FormCode
protected function buildEntityFormElement(MediaInterface $media, array $form, FormStateInterface $form_state, $delta) {
$element = parent::buildEntityFormElement($media, $form, $form_state, $delta);
$source_field = $this->getSourceFieldName($media->bundle->entity);
if (isset($element['fields'][$source_field])) {
$element['fields'][$source_field]['widget'][0]['#process'][] = [
static::class,
'hideExtraSourceFieldComponents',
];
}
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.