Problem/Motivation
Alter contextual links based on roles per block type available in layout builder page.
Steps to reproduce
- Add a Block using the layout builder page
- Login as a contributor role (this role can access and edit the blocks on Layout page)
- The contributor should not be able to "Configure" a custom block of type "MyCustomBlock"
- The administrator (or any other role as desired) is/are the only role(s) that can see and click the "Configure" contextual link for a block of type "MyCustomBlock"
Proposed resolution
Have an additional information available in the $route_parameters for hook_contextual_links_alter(). Add bundle information to layout builder to identify the block type rendered
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | layout_builder_add_block_bundle-3305126-4.patch | 868 bytes | gauravjeet |
Comments
Comment #2
gauravjeet commentedComment #3
gauravjeet commentedThis bundle information is going to be used in hook_contextual_links_alter() as :
Comment #4
gauravjeet commentedCreated a patch for this.
Comment #5
gauravjeet commentedComment #9
danielvezaHello! Thanks for raising an issue. I believe this should be working already with the permissions that are already used within Drupal
Can we please get some more detailed steps to replicate in the issue summary starting with a fresh install of D11?
Comment #10
danielvezaThis has been inactive for 3 months since the last comment that asked for more replication steps. I'm marking this as closed. Thanks!