Problem/Motivation
Contextual links are not displayed due to to #3035140: Blocks plugin calls $block->build() twice.
Calling build() twice was a good catch so we should add in preRender(), block is built once. Note that #contextual_links are added in `Drupal\block\BlockViewBuilder::preRender()` in similar way.
Steps to reproduce
Add a menu block using context, note that "edit menu" contextual links does not appear.
(link are added by `hook_block_view_BASE_BLOCK_ID_alter()` at `menu_ui_block_view_system_menu_block_alter()`)
Proposed resolution
Add links in prerender including #attributes.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | add-back-contextual-links-from-build-but-in-preRender-3175667-1.patch | 3.39 KB | silverham |
Comments
Comment #2
silverham commentedPatch to module.
Comment #4
paulocsComment #5
deaom commentedI could not reproduce the issue of contextual links not being present without the patch. But I do see the point @silverham is trying to make. Did test the patch and it seems to not break anything. I think this can be committed to dev branch, and therefore marking it as RTBC. I'm just not a fan of long comments and would shorten that to just what that part of code does not why it does that.
Comment #6
silverham commented@DeaOm - I just copy/paste the same code as Drupal core but happy for any adjustment or shortening. :-)
Comment #8
paulocsThanks @silverham and @DeaOm.
Fixed in dev branch!