public function MediaEntityDropzoneJsEbWidget::buildConfigurationForm in DropzoneJS 8
Same name and namespace in other branches
- 8.2 modules/eb_widget/src/Plugin/EntityBrowser/Widget/MediaEntityDropzoneJsEbWidget.php \Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\Widget\MediaEntityDropzoneJsEbWidget::buildConfigurationForm()
Overrides DropzoneJsEbWidget::buildConfigurationForm
1 call to MediaEntityDropzoneJsEbWidget::buildConfigurationForm()
- InlineEntityFormMediaWidget::buildConfigurationForm in modules/
eb_widget/ src/ Plugin/ EntityBrowser/ Widget/ InlineEntityFormMediaWidget.php
1 method overrides MediaEntityDropzoneJsEbWidget::buildConfigurationForm()
- InlineEntityFormMediaWidget::buildConfigurationForm in modules/
eb_widget/ src/ Plugin/ EntityBrowser/ Widget/ InlineEntityFormMediaWidget.php
File
- modules/
eb_widget/ src/ Plugin/ EntityBrowser/ Widget/ MediaEntityDropzoneJsEbWidget.php, line 111
Class
- MediaEntityDropzoneJsEbWidget
- Provides an Entity Browser widget that uploads uploads media entities.
Namespace
Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\WidgetCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['media_entity_bundle'] = [
'#type' => 'select',
'#title' => $this
->t('Media type'),
'#required' => TRUE,
'#description' => $this
->t('The type of media entity to create from the uploaded file(s).'),
];
$bundle = $this
->getBundle();
if ($bundle) {
$form['media_entity_bundle']['#default_value'] = $bundle
->id();
}
$bundles = $this->entityTypeManager
->getStorage('media_bundle')
->loadMultiple();
if (!empty($bundles)) {
foreach ($bundles as $bundle) {
$form['media_entity_bundle']['#options'][$bundle
->id()] = $bundle
->label();
}
}
else {
$form['media_entity_bundle']['#disabled'] = TRUE;
$form['media_entity_bundle']['#description'] = $this
->t('You must @create_bundle before using this widget.', [
'@create_bundle' => Link::createFromRoute($this
->t('create a media bundle'), 'media.bundle_add')
->toString(),
]);
}
return $form;
}