You are here

public function FileUpload::getForm in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.4 src/Plugin/EntityBrowser/Widget/FileUpload.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\FileUpload::getForm()
  2. 8 src/Plugin/EntityBrowser/Widget/FileUpload.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\FileUpload::getForm()
  3. 8.2 src/Plugin/EntityBrowser/Widget/FileUpload.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\FileUpload::getForm()

Overrides EntityFormProxy::getForm

File

src/Plugin/EntityBrowser/Widget/FileUpload.php, line 53

Class

FileUpload
An Entity Browser widget for creating media entities from uploaded files.

Namespace

Drupal\lightning_media\Plugin\EntityBrowser\Widget

Code

public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) {
  $form = parent::getForm($original_form, $form_state, $additional_widget_parameters);
  $form['input'] = [
    '#type' => 'ajax_upload',
    '#title' => $this
      ->t('File'),
    '#required' => TRUE,
    '#process' => [
      [
        $this,
        'processUploadElement',
      ],
    ],
    '#upload_validators' => $this
      ->getUploadValidators(),
    '#weight' => 70,
  ];
  return $form;
}