You are here

public function MediaDeleteForm::submitModalAjax in Media Directories 3.x

Same name and namespace in other branches
  1. 8 modules/media_directories_ui/src/Form/MediaDeleteForm.php \Drupal\media_directories_ui\Form\MediaDeleteForm::submitModalAjax()
  2. 2.x modules/media_directories_ui/src/Form/MediaDeleteForm.php \Drupal\media_directories_ui\Form\MediaDeleteForm::submitModalAjax()

File

modules/media_directories_ui/src/Form/MediaDeleteForm.php, line 91

Class

MediaDeleteForm

Namespace

Drupal\media_directories_ui\Form

Code

public function submitModalAjax(array &$form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  foreach ($this->entities as $entity) {
    $entity
      ->delete();
  }
  $response
    ->addCommand(new CloseModalDialogCommand());
  $response
    ->addCommand(new LoadDirectoryContent());
  return $response;
}