/**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $original_widget = $this->getCurrentWidget($form_state);
     if ($new_widget = $this->entity_browser->getWidgetSelector()->submit($form, $form_state)) {
         $this->setCurrentWidget($new_widget, $form_state);
     }
     // Only call widget submit if we didn't change the widget.
     if ($original_widget == $this->getCurrentWidget($form_state)) {
         $this->entity_browser->getWidgets()->get($this->getCurrentWidget($form_state))->submit($form[$form['#browser_parts']['widget']], $form, $form_state);
         $this->entity_browser->getSelectionDisplay()->submit($form, $form_state);
     }
     if (!$this->isSelectionCompleted($form_state)) {
         $form_state->setRebuild();
     } else {
         $this->entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getPlugin(EntityBrowserInterface $entity_browser)
 {
     return $entity_browser->getWidgetSelector();
 }