diff --git a/contextual_links_example/contextual_links_example.info.yml b/contextual_links_example/contextual_links_example.info.yml index 14304ed..dbd9ee6 100644 --- a/contextual_links_example/contextual_links_example.info.yml +++ b/contextual_links_example/contextual_links_example.info.yml @@ -7,3 +7,4 @@ dependencies: - drupal:examples - drupal:contextual - drupal:block + - drupal:node diff --git a/contextual_links_example/contextual_links_example.links.contextual.yml b/contextual_links_example/contextual_links_example.links.contextual.yml index 81b4041..a65ed48 100644 --- a/contextual_links_example/contextual_links_example.links.contextual.yml +++ b/contextual_links_example/contextual_links_example.links.contextual.yml @@ -1,9 +1,10 @@ contextual_links_example.configure: - route_name: contextual_links_example.contextual_links_object_edit + route_name: 'contextual_links_example.contextual_links_object_edit' title: 'Edit object' group: 'contextual_links_example' contextual_links_example.example_action: - route_name: contextual_links_example.contextual_node_action_form + route_name: 'contextual_links_example.contextual_node_action_form' title: 'Example Action' group: 'node' + weight: 20 diff --git a/contextual_links_example/contextual_links_example.routing.yml b/contextual_links_example/contextual_links_example.routing.yml index c2febee..e8cb5f4 100644 --- a/contextual_links_example/contextual_links_example.routing.yml +++ b/contextual_links_example/contextual_links_example.routing.yml @@ -6,7 +6,7 @@ contextual_links_example.contextual_node_action_form: requirements: node: \d+ _access: 'TRUE' - _entity_access: 'node.edit' +# _entity_access: 'node.edit' contextual_links_example.contextual_links_object_list: path: 'examples/contextual-links' diff --git a/contextual_links_example/tests/src/FunctionalJavascript/ContextualLinksExampleTest.php b/contextual_links_example/tests/src/FunctionalJavascript/ContextualLinksExampleTest.php index 1958850..e8da8f3 100644 --- a/contextual_links_example/tests/src/FunctionalJavascript/ContextualLinksExampleTest.php +++ b/contextual_links_example/tests/src/FunctionalJavascript/ContextualLinksExampleTest.php @@ -20,7 +20,6 @@ class ContextualLinksExampleTest extends JavascriptTestBase { * @var array */ public static $modules = [ - 'node', 'system', 'contextual_links_example', 'views', @@ -39,15 +38,27 @@ class ContextualLinksExampleTest extends JavascriptTestBase { 'access contextual links', ])); - // Place our custom block in sidebar first. - $this->placeBlock('cleblock'); // Create a content type. $this->drupalCreateContentType(['type' => 'page']); + // Create a node and promote it to the front page. $this->drupalCreateNode(['promote' => 1]); // Configure 'node' as front page. $this->config('system.site')->set('page.front', '/node')->save(); + + // Place our custom block in sidebar first. + $this->placeBlock('cleblock', + [ + 'visibility' => [ + 'request_path' => [ + 'id' => 'request_path', + 'pages' => '', + 'negate' => FALSE, + 'context_mapping' => [], + ], + ], + ]); } /** @@ -65,11 +76,11 @@ class ContextualLinksExampleTest extends JavascriptTestBase { $actionContextualLink = $assert->waitForElement('css', '.contextual-links-exampleexample-action'); $this->assertNotEmpty($actionContextualLink); - $this->drupalGet('examples/contextual-links'); $assert->statusCodeEquals(200); - // Visit our example overview page and check for presence of contextual links. + // Visit our example overview page and check for presence of + // "Edit Object" contextual links. $contextualLinks = $assert->waitForElement('css', '.contextual-links-exampleconfigure'); $this->assertNotEmpty($contextualLinks); }