Commit 6c49d796 authored by webchick's avatar webchick
Browse files

Issue #3058037 by seanB, grndlvl, dibs, oknate, orlando.thoeny: Media Library...

Issue #3058037 by seanB, grndlvl, dibs, oknate, orlando.thoeny: Media Library can't attach media to media reference field in nodes due to AJAX problem when using table view
parent f7124b7d
......@@ -330,7 +330,7 @@ protected function buildMediaLibraryView(MediaLibraryState $state) {
// https://www.drupal.org/project/drupal/issues/2971209
$view = $this->entityTypeManager->getStorage('view')->load('media_library');
$view_executable = $this->viewsExecutableFactory->get($view);
$display_id = 'widget';
$display_id = $state->get('views_display_id', 'widget');
// Make sure the state parameters are set in the request so the view can
// pass the parameters along in the pager, filters etc.
......
......@@ -82,6 +82,7 @@ public function viewsForm(array &$form, FormStateInterface $form_state) {
// AJAX path like /views/ajax, which cannot process AJAX form submits.
$query = $this->view->getRequest()->query->all();
$query[FormBuilderInterface::AJAX_FORM_REQUEST] = TRUE;
$query['views_display_id'] = $this->view->getDisplay()->display['id'];
$form['actions']['submit']['#ajax'] = [
'url' => Url::fromRoute('media_library.ui'),
'options' => [
......
......@@ -937,7 +937,8 @@ public function testWidgetViews() {
$assert_session->pageTextNotContains('Bear');
$assert_session->pageTextNotContains('Turtle');
$assert_session->linkExists('Grid');
$assert_session->linkExists('Table');
$page->clickLink('Table');
$this->assertNotEmpty($assert_session->waitForElementVisible('css', '.media-library-view .media-library-item--table'));
// Select the item.
$assert_session->elementExists('css', '.ui-dialog-buttonpane')->pressButton('Insert selected');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment