You are here

protected function Upload::clearFormValues in Entity Browser 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/EntityBrowser/Widget/Upload.php \Drupal\entity_browser\Plugin\EntityBrowser\Widget\Upload::clearFormValues()

Clear values from upload form element.

Parameters

array $element: Upload form element.

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

2 calls to Upload::clearFormValues()
MediaImageUpload::submit in src/Plugin/EntityBrowser/Widget/MediaImageUpload.php
Submits form.
Upload::submit in src/Plugin/EntityBrowser/Widget/Upload.php
Submits form.

File

src/Plugin/EntityBrowser/Widget/Upload.php, line 156

Class

Upload
Adds an upload field browser's widget.

Namespace

Drupal\entity_browser\Plugin\EntityBrowser\Widget

Code

protected function clearFormValues(array &$element, FormStateInterface $form_state) {

  // We propagated entities to the other parts of the system. We can now remove
  // them from our values.
  $form_state
    ->setValueForElement($element['upload']['fids'], '');
  NestedArray::setValue($form_state
    ->getUserInput(), $element['upload']['fids']['#parents'], '');
}