diff --git a/core/modules/outside_in/outside_in.module b/core/modules/outside_in/outside_in.module index a7fab7bd2cb935d9fc2a4681e552b8172fd876e1..315e97b95e4f862d5501d9605633b59a9aa0a6fc 100644 --- a/core/modules/outside_in/outside_in.module +++ b/core/modules/outside_in/outside_in.module @@ -34,6 +34,11 @@ function outside_in_help($route_name, RouteMatchInterface $route_match) { */ function outside_in_contextual_links_view_alter(&$element, $items) { if (isset($element['#links']['outside-inblock-configure'])) { + // Place outside_in link first. + $outside_in_link = $element['#links']['outside-inblock-configure']; + unset($element['#links']['outside-inblock-configure']); + $element['#links'] = ['outside-inblock-configure' => $outside_in_link] + $element['#links']; + $element['#links']['outside-inblock-configure']['attributes'] = [ 'class' => ['use-ajax'], 'data-dialog-type' => 'dialog', diff --git a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php index c62436ca165c3ebb80e0f6e4161d330e265a9504..cd82026e52d459163b62fd2e2fcc63c67317dea0 100644 --- a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php @@ -62,8 +62,13 @@ protected function setUp() { public function testBlocks($block_id, $new_page_text, $element_selector, $label_selector, $button_text, $toolbar_item) { $web_assert = $this->assertSession(); $page = $this->getSession()->getPage(); - $block_selector = '#' . $block_id; + $block_selector = '#block-' . $block_id; $this->drupalGet('user'); + + $link = $page->find('css', "$block_selector .contextual-links li a"); + $this->assertEquals('Quick edit', $link->getText(), "'Quick edit' is the first contextual link for the block."); + $this->assertContains("/admin/structure/block/manage/$block_id/offcanvas?destination=user/2", $link->getAttribute('href')); + if (isset($toolbar_item)) { // Check that you can open a toolbar tray and it will be closed after // entering edit mode. @@ -83,13 +88,13 @@ public function testBlocks($block_id, $new_page_text, $element_selector, $label_ $this->openBlockForm($block_selector); switch ($block_id) { - case 'block-powered': + case 'powered': // Fill out form, save the form. $page->fillField('settings[label]', $new_page_text); $page->checkField('settings[label_display]'); break; - case 'block-branding': + case 'branding': // Fill out form, save the form. $page->fillField('settings[site_information][site_name]', $new_page_text); break; @@ -137,7 +142,7 @@ public function testBlocks($block_id, $new_page_text, $element_selector, $label_ public function providerTestBlocks() { $blocks = [ 'block-powered' => [ - 'id' => 'block-powered', + 'id' => 'powered', 'new_page_text' => 'Can you imagine anyone showing the label on this block?', 'element_selector' => '.content a', 'label_selector' => 'h2', @@ -145,7 +150,7 @@ public function providerTestBlocks() { 'toolbar_item' => '#toolbar-item-user', ], 'block-branding' => [ - 'id' => 'block-branding', + 'id' => 'branding', 'new_page_text' => 'The site that will live a very short life.', 'element_selector' => 'a[rel="home"]:nth-child(2)', 'label_selector' => '.site-branding__name a', @@ -153,7 +158,7 @@ public function providerTestBlocks() { 'toolbar_item' => '#toolbar-item-administration', ], 'block-search' => [ - 'id' => 'block-search', + 'id' => 'search', 'new_page_text' => NULL, 'element_selector' => '#edit-submit', 'label_selector' => 'h2',