Skip to content
Snippets Groups Projects
Commit 0707a705 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #2784567 by tedbow, 20th, dmsmidt, miteshmap, dbjpanda, bendev, crasx,...

Issue #2784567 by tedbow, 20th, dmsmidt, miteshmap, dbjpanda, bendev, crasx, tkoleary: List "Quick edit" before "Configure" in contextual links while in Edit mode
parent b712a2d9
No related branches found
No related tags found
No related merge requests found
......@@ -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',
......
......@@ -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',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment