You are here

public static function InteractiveUpload::upload in Lightning Media 8

Same name and namespace in other branches
  1. 8.4 src/Element/InteractiveUpload.php \Drupal\lightning_media\Element\InteractiveUpload::upload()
  2. 8.2 src/Element/InteractiveUpload.php \Drupal\lightning_media\Element\InteractiveUpload::upload()
  3. 8.3 src/Element/InteractiveUpload.php \Drupal\lightning_media\Element\InteractiveUpload::upload()

Handles form submission when the Upload button is clicked.

Parameters

array $form: The complete form.

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

File

src/Element/InteractiveUpload.php, line 114

Class

InteractiveUpload
A form element for uploading or deleting files interactively.

Namespace

Drupal\lightning_media\Element

Code

public static function upload(array &$form, FormStateInterface $form_state) {
  $el = static::el($form, $form_state);
  $form_state
    ->setValueForElement($el['fid'], $el['file']['#value']);
  NestedArray::setValue($form_state
    ->getUserInput(), $el['fid']['#parents'], $el['file']['#value']);
  $form_state
    ->setRebuild();
}