Something recently broke the Contextual Links example. If you enable the block, the contextual link does *not* include the proper "Edit object" element in the contextual menu.

Comments

rfay’s picture

Priority: Normal » Critical
David_Rothstein’s picture

Yup, this is due to a bug which recently appeared in Drupal 8 core. See #1304470: Add tests for module-provided contextual links on blocks

Once that is fixed, presumably the example code here will go back to working (unless the fix involves an API change, of course).... So I guess this issue should be left open until the core issue is fixed?

rfay’s picture

Perhaps we should get some of the tests from here into core? Sounds like core doesn't have adequate tests for contextual links.

micahw156’s picture

Version: » 7.x-1.x-dev

Are you guys sure this is limited to Drupal 8? I've just spent three hours trying to add contextual links to a module-provided block in Drupal 7 to no avail. I finally found the contextual links example block and verified that my code follows the example. The next Google search brought me here. I don't want to pull this issue off-topic, but I'm commenting here because it's the closest thing I've found to an explanation for my problem.

Also, I did not change the version on this issue intentionally. For some reason, only 6.x and 7.x branches are available to me, and it was set to "none" when I got here.

rfay’s picture

8.x-1.x release has been removed, partially because of never-can-catch-up issues like this one.

The way to see if the Contextual Links example works is to try it out; just enable it and see if it works. It is currently passing tests: http://qa.drupal.org/pifr/test/136969

rfay’s picture

Priority: Critical » Normal
Status: Active » Fixed

#4, @micahw156: I enabled it and it worked fine. Don't forget to make sure you have contextual enabled and that you may need to rebuild your caches (menu cache).

To test the OP on this for 7.x-1.x, enable the "Contextual Links Example" block, and you'll see that the dropdown does now include an "Edit object" menu link. The node/%/example-action is also working, as is the /examples/contextual-links

Marking fixed as the 8.x issue will have to be sorted out later. We've emptied the 8.x branch in part because of critical issues like this that aren't worth fixing at this point.

rfay’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.