Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When a bean is rendered in a region (using context in my case), the contextual links that allow you to quickly edit the bean are now missing. These were working in the past.
Comment | File | Size | Author |
---|---|---|---|
#12 | 1691482-12-bean_contextual_links.patch | 406 bytes | SebCorbin |
#4 | 1691482-contextual-links-revamp-4.patch | 1017 bytes | Brandonian |
Comments
Comment #1
kingandy CreditAttribution: kingandy commentedThere seems to be a reliance on access to the "Bean Page". On my install at least, a user with just the "Edit Bean" permission(s) did not see the contextual link; adding the "View Bean page" permission prompted the link to appear.
IMO this is a bug, people with permission to edit beans should be able to do so via the contextual link.
Comment #2
kingandy CreditAttribution: kingandy commented... regardless of whether they can see the bean in question via its own path.
Comment #3
kingandy CreditAttribution: kingandy commentedHaving looked into this a little - the "Contextual Links" element is driven by the menu system, and the Bean is basically giving the link to the view page and expecting it to find the submenu tabs (edit, etc) itself. This is the intended behaviour for Contextual Links; it's not expected that anyone would have access to a tab but not the parent menu item.
I'm not sure if it's appropriate to subvert this behaviour - it would be possible to pass in the full path ('block/[bean-delta]/edit'), or something, but the Contextual module is fairly emphatic about not including dynamic elements (such as the bean-delta) in the first path. I'm assuming this would be for efficiency, not wanting to recalculate the tabs over and over. Maybe it would be preferable to make a new access callback for block/%bean, which would make that path automatically visible to anyone with permission to edit the bean?
Comment #4
Brandonian CreditAttribution: Brandonian commentedIf a custom bean does not return a render array for it's content, bean will currently error out because of how it currently sets contextual links. Attached is a patch which implements hook_contextual_links_view_alter for the bean module, which will replace the current block contextual link with a link to the bean block edit page.
Comment #5
fmitchell CreditAttribution: fmitchell commentedCommitted. http://drupalcode.org/project/bean.git/commit/985017a
Comment #7
Paul Lomax CreditAttribution: Paul Lomax commentedThis seems to have broken contextual links when using Panels to embed Beans. Reverting back the code from bean_block_view seems to fix this. Unless i'm missing something.
Comment #8
chriscohen CreditAttribution: chriscohen commentedConfirmed. If a bean appears within a panel, the patch above breaks the contextual links. Panels does not respect hook_contextual_links_view_alter() so it never gets called and hence the patch above doesn't have any effect on beans that are within panels.
The original method, using bean_block_view() to insert contextual links, is more robust and works a lot better. A new angle is going to be needed to make this work, unless anybody feels like trying to patch the way panels invokes contextual links.
Comment #9
indytechcook CreditAttribution: indytechcook commentedHere you go. http://drupal.org/commitlog/commit/22232/5b5772bcf56fc9299cb041417b8a022...
I checked to make sure a render array was returned by the plugins.
Comment #10
fmitchell CreditAttribution: fmitchell commentedReally....a not empty in an array? Shoot me in the face now. :-p
Comment #12
SebCorbin CreditAttribution: SebCorbin commentedWe have lost the point made in comment #1
We need to add the 'edit' arg to the contextual link
Patch attached
Comment #13
indytechcook CreditAttribution: indytechcook commentedThanks. https://drupal.org/commitlog/commit/22232/bcf45b1420197ffe44dfb9148b3320...
Comment #15
eric.chenchao CreditAttribution: eric.chenchao commentedI believe this is duplicate to #1949058: No edit option.
Apply the patch and clear cache should fix this.
Comment #16
eric.chenchao CreditAttribution: eric.chenchao commentedIgnore the above comment. Update in the wrong place. Sorry.
Comment #17
eric.chenchao CreditAttribution: eric.chenchao commented