I use the default Drupal core 8.2.4

When I rendered blocks on a page with context, all contextual links on blocks are missing (the cog icon on the top right of the block where you can choose to Configure Block, Quick Edit and Edit).

Does anyone here have the same issue?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tuthanh created an issue. See original summary.

pascavi’s picture

Same here

s1work’s picture

I'm having the same issue.

Anonymous’s picture

icurk’s picture

Status: Active » Needs review
FileSize
694 bytes

This patch adds contextual links to blocks.

icurk’s picture

The previous patch was missing the contextual link for configuring block on context.

Grimreaper’s picture

Status: Needs review » Needs work

Hello,

I have just tested the last patch on the last dev version of context.

There are warnings that are no more here the blocks in contexts are resaved.

There is now an edit link on content block but no quick edit link and there is no contextual link on blocks provided by plugin.

EDIT: I need to continue testing without the patch. I have a JS error on my pages (not due to context) and so no more contextual links.

icurk’s picture

Hi Grimreaper,

I read your comment multiple times, but still not sure what you wanted to say. The only thing I understand is that quick edit link is missing from in contextual links.
Could you please explain what you meant with

There are warnings that are no more here the blocks in contexts are resaved.

and

there is no contextual links on blocks provided by plugin

.

Grimreaper’s picture

Hello,

@icurk: sorry for the delay.

I have redone test using a standard Drupal install and using the Bartik theme to be sure to not have other modules interfering.

About the warnings

Here is a screenshot of the warnings I have once the patch is applied:

It is because for existing context placing blocks, the context is not defined. After resaving the blocks in the contexts it is ok.

I don't know if you want to put a check in the code or an upgrade path for existing contexts or say to update the contexts manually.

About the contextual links (once the contexts have been saved and there is no more warnings):

Contextuals links are ok except for the quick edit contextual link. I attached two screenshots.

The blocks on the left sidebar are placed using "block layout" and the block "mon block custom" is a content block and it has the "quick edit" link that is working.

The blocks on the right sidebar are placed using context and the block "mon block custom context" is the same content block and it does not have the "quick edit" link.

Maybe quick edit integration can be done in another issue.

Grimreaper’s picture

icurk’s picture

Status: Needs work » Needs review
FileSize
1.84 KB

I wrote an update hook, which will set context_id on all blocks inside block reactions in all contexts.

boshtian’s picture

I tested patch in #11.

For all the blocks that only have "Configure block" contextual link, we have a contextual links cog in the corner, but there is no links when you click on it.

I agree that we don't need to render the "Configure block" link if we put the block on page through Context, since it would take you to the block edit page of the default block layout and those settings would not affect the block displayed through Context.

But for closing this issue, I think it would be good if we can just remove the cog icon if there is no links.

We can also add a fix which would add a "Configure block" link, but instead taking you to default block layout settings, it would take you to the block settings inside of the Context that is providing this block.

If this is too big of an effort, we can open separate issue for this.

Grimreaper’s picture

@boshtian there is no contextual link because the patch from #11 is missing parts of the code...

Test the patch from comment #6

boshtian’s picture

Thanks Grimreaper.

I just realized that and came back to this issue, to correct myself, but I see you were faster. :)

OK, then I think we need a patch that will include everything from #6 and update hook from #11.

boshtian’s picture

I combined the two patches from #6 and #11 into one patch.

If anyone else can test it, then we can add it to release.

Grimreaper’s picture

Status: Needs review » Reviewed & tested by the community

Patch from comment #15 ok for me.

No more warnings after the hook_update_n execution.

Thanks all.

  • boshtian committed 24f12bd on 8.x-1.x authored by icurk
    Issue #2853565 by icurk, boshtian, Grimreaper: Contextual links missing...
boshtian’s picture

Status: Reviewed & tested by the community » Fixed
tuthanh’s picture

Thanks boshtian.

The patch #15 works for me. It is great.

Status: Fixed » Closed (fixed)

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

weynhamz’s picture

FileSize
1.78 KB

The committed patch introduced an unnecessary `$block->build()` call to get the contextual links, and later in `preRenderBlock()` the `$block->build()` is invoked again, for some blocks, especially menu block, the build operation is heavy. Instead, the code should be in later `preRenderBlock()`.