You are here

public function AddMediaFormBase::backToLibraryCallback in Media Directories 3.x

Go back to the library view.

Parameters

$form:

\Drupal\Core\Form\FormStateInterface $form_state:

Return value

\Drupal\Core\Ajax\AjaxResponse

File

modules/media_directories_ui/src/Form/AddMediaFormBase.php, line 159

Class

AddMediaFormBase
Class AddMediaFormBase

Namespace

Drupal\media_directories_ui\Form

Code

public function backToLibraryCallback(&$form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $response
    ->addCommand(new ReplaceCommand('#media-library-wrapper', $this
    ->buildMediaLibraryUi($form_state)));
  $response
    ->addCommand(new InvokeCommand('#media-library-wrapper :tabbable', 'focus'));
  $form_state
    ->setRebuild();
  return $response;
}