You are here

public function FileUpload::processUploadElement 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::processUploadElement()
  2. 8 src/Plugin/EntityBrowser/Widget/FileUpload.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\FileUpload::processUploadElement()
  3. 8.2 src/Plugin/EntityBrowser/Widget/FileUpload.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\FileUpload::processUploadElement()

Processes the upload element.

Parameters

array $element: The upload element.

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

Return value

array The processed upload element.

File

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

Class

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

Namespace

Drupal\lightning_media\Plugin\EntityBrowser\Widget

Code

public function processUploadElement(array $element, FormStateInterface $form_state) {
  $element = AjaxUpload::process($element, $form_state);
  $element['upload_button']['#ajax']['callback'] = $element['remove']['#ajax']['callback'] = [
    static::class,
    'ajax',
  ];
  $element['remove']['#value'] = $this
    ->t('Cancel');
  return $element;
}