From 0bb1f5cf3d2002f2ef83dbfc7412bb2768f2714e Mon Sep 17 00:00:00 2001 From: Michael Anello <michael@anelloconsulting.com> Date: Tue, 15 Apr 2025 12:12:08 +0000 Subject: [PATCH 1/6] Convert patch to issue fork. --- .../src/FunctionalJavascript/MediaViewsWizardTest.php | 4 ++++ .../views/src/Plugin/Derivative/ViewsEntityRow.php | 2 +- .../views/src/Plugin/views/display/DisplayPluginBase.php | 2 +- .../views/src/Plugin/views/wizard/WizardPluginBase.php | 2 +- .../tests/src/FunctionalJavascript/ViewsWizardTest.php | 9 ++++----- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php index 1654f5879b2d..3ececfc5fcd8 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php @@ -40,6 +40,10 @@ public function testMediaWizard(): void { $this->assertNotEmpty($result); $page->checkField('page[create]'); $page->fillField('page[path]', $this->randomMachineName(16)); + $page->selectFieldOption('page[style][row_plugin]', 'fields'); + // There are no changes on the page to be detected after this change, so we + // can only wait for the AJAX request to finish. + $this->assertSession()->assertWaitOnAjaxRequest(); $page->pressButton('Save and edit'); $this->assertSame($session->getCurrentUrl(), $this->baseUrl . '/admin/structure/views/view/' . $view_id); diff --git a/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php b/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php index 757b574189b4..d7b5756232ef 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php @@ -95,7 +95,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives[$entity_type_id] = [ 'id' => 'entity:' . $entity_type_id, 'provider' => 'views', - 'title' => $entity_type->getLabel(), + 'title' => $this->t('@label view mode', ['@label' => $entity_type->getLabel()]), 'help' => $this->t('Display the @label', ['@label' => $entity_type->getLabel()]), 'base' => [$entity_type->getDataTable() ?: $entity_type->getBaseTable()], 'entity_type' => $entity_type_id, diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 237cdd9dcfce..fc4a983f9299 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -1700,7 +1700,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { break; case 'row': - $form['#title'] .= $this->t('How should each row in this view be styled'); + $form['#title'] .= $this->t('How should each row in this view be output'); $row_plugin_instance = $this->getPlugin('row'); $form['row'] = [ '#prefix' => '<div class="clearfix">', diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php index f3e529e09570..ef8568203cd4 100644 --- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php @@ -583,7 +583,7 @@ protected function buildFormStyle(array &$form, FormStateInterface $form_state, $options = $this->rowStyleOptions(); $style_form['row_plugin'] = [ '#type' => 'select', - '#title' => $this->t('of'), + '#title' => $this->t('output as'), '#options' => $options, '#access' => count($options) > 1, ]; diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php index b1026d785841..7d33a17fcc96 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php @@ -83,15 +83,14 @@ public function testCreateViewWizard(): void { $page->selectFieldOption('show[wizard_key]', 'users'); $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertNull($page->findField('show[type]'), 'The "of type" filter is not added for users.'); - $this->assertEquals('fields', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was updated to a valid value.'); - $this->assertEquals('fields', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was updated to a valid value.'); + $this->assertEquals('entity:user', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was updated to a valid value.'); + $this->assertEquals('entity:user', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was updated to a valid value.'); $this->drupalCreateContentType(['type' => 'page']); $page->selectFieldOption('show[wizard_key]', 'node'); $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertNotNull($page->findField('show[type]'), 'The "of type" filter is added for nodes when there is at least one node type.'); - $this->assertEquals('fields', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was not changed from a valid value.'); - $this->assertEquals('fields', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was not changed from a valid value.'); + $this->assertEquals('teasers', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was not changed from a valid value.'); + $this->assertEquals('teasers', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was not changed from a valid value.'); } } - } -- GitLab From bae742c3b2d13c78b9c6bec982b98fa4e8ff2393 Mon Sep 17 00:00:00 2001 From: Michael Anello <michael@anelloconsulting.com> Date: Tue, 15 Apr 2025 17:11:58 +0200 Subject: [PATCH 2/6] Updated Plugin sorting. --- core/modules/views/src/Views.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php index 8465e7c1cbf0..87a2bc2f5d81 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -159,8 +159,9 @@ public static function fetchPluginNames($type, $key = NULL, array $base = []) { } if (!empty($plugins)) { - asort($plugins); - return $plugins; + uasort($plugins, static function ($a, $b) { + return strcmp((string) $a, (string) $b); + }); } return $plugins; -- GitLab From 2b9ce8d80d74628b138fd1193fe86f17b5a12984 Mon Sep 17 00:00:00 2001 From: Michael Anello <michael@anelloconsulting.com> Date: Tue, 15 Apr 2025 17:24:57 +0200 Subject: [PATCH 3/6] Typo fix - doh! --- .../tests/src/FunctionalJavascript/ViewsWizardTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php index 7d33a17fcc96..51ff86f65a87 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php @@ -91,6 +91,7 @@ public function testCreateViewWizard(): void { $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertNotNull($page->findField('show[type]'), 'The "of type" filter is added for nodes when there is at least one node type.'); $this->assertEquals('teasers', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was not changed from a valid value.'); - $this->assertEquals('teasers', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was not changed from a valid value.'); } + $this->assertEquals('teasers', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was not changed from a valid value.'); } + } -- GitLab From 9773babc8c1f26bf4f0f398342aefc970893addf Mon Sep 17 00:00:00 2001 From: Michael Anello <michael@anelloconsulting.com> Date: Tue, 15 Apr 2025 17:42:16 +0200 Subject: [PATCH 4/6] Updated test to reflect new sort order. --- .../tests/src/FunctionalJavascript/ViewsWizardTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php index 51ff86f65a87..dd2c2892a67d 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php @@ -83,8 +83,8 @@ public function testCreateViewWizard(): void { $page->selectFieldOption('show[wizard_key]', 'users'); $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertNull($page->findField('show[type]'), 'The "of type" filter is not added for users.'); - $this->assertEquals('entity:user', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was updated to a valid value.'); - $this->assertEquals('entity:user', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was updated to a valid value.'); + $this->assertEquals('fields', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was updated to a valid value.'); + $this->assertEquals('fields', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was updated to a valid value.'); $this->drupalCreateContentType(['type' => 'page']); $page->selectFieldOption('show[wizard_key]', 'node'); -- GitLab From 82c7b8d2d10cc38deb392ed6c8cd2326e08a6fe1 Mon Sep 17 00:00:00 2001 From: Michael Anello <michael@anelloconsulting.com> Date: Wed, 16 Apr 2025 11:11:43 +0200 Subject: [PATCH 5/6] Reverted test to original state. --- .../tests/src/FunctionalJavascript/ViewsWizardTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php index dd2c2892a67d..b1026d785841 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsWizardTest.php @@ -90,8 +90,8 @@ public function testCreateViewWizard(): void { $page->selectFieldOption('show[wizard_key]', 'node'); $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertNotNull($page->findField('show[type]'), 'The "of type" filter is added for nodes when there is at least one node type.'); - $this->assertEquals('teasers', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was not changed from a valid value.'); - $this->assertEquals('teasers', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was not changed from a valid value.'); + $this->assertEquals('fields', $page->findField('page[style][row_plugin]')->getValue(), 'The page display format was not changed from a valid value.'); + $this->assertEquals('fields', $page->findField('block[style][row_plugin]')->getValue(), 'The block display format was not changed from a valid value.'); } } -- GitLab From b4b3cb4e98bbce55236f23e296cf96bcedf5b807 Mon Sep 17 00:00:00 2001 From: Michael Anello <michael@anelloconsulting.com> Date: Wed, 16 Apr 2025 14:15:41 +0200 Subject: [PATCH 6/6] Manually reverted test change because we think it is not necessary. --- .../tests/src/FunctionalJavascript/MediaViewsWizardTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php index 3ececfc5fcd8..1654f5879b2d 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php @@ -40,10 +40,6 @@ public function testMediaWizard(): void { $this->assertNotEmpty($result); $page->checkField('page[create]'); $page->fillField('page[path]', $this->randomMachineName(16)); - $page->selectFieldOption('page[style][row_plugin]', 'fields'); - // There are no changes on the page to be detected after this change, so we - // can only wait for the AJAX request to finish. - $this->assertSession()->assertWaitOnAjaxRequest(); $page->pressButton('Save and edit'); $this->assertSame($session->getCurrentUrl(), $this->baseUrl . '/admin/structure/views/view/' . $view_id); -- GitLab