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.

Files: 
CommentFileSizeAuthor
#12 1691482-12-bean_contextual_links.patch406 bytesSebCorbin
PASSED: [[SimpleTest]]: [MySQL] 98 pass(es).
[ View ]
#4 1691482-contextual-links-revamp-4.patch1017 bytesBrandonian
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1691482-contextual-links-revamp-4.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

There 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.

... regardless of whether they can see the bean in question via its own path.

Having 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?

Status:Active» Needs review
StatusFileSize
new1017 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1691482-contextual-links-revamp-4.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

If 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.

function bean_contextual_links_view_alter(&$element, $items) {
  if (isset($element['#element']['#block']->module) && $element['#element']['#block']->module == 'bean') {
    $element['#links']['bean-configure'] = array(
      'title' => t('Edit block'),
      'href' => 'block/' . $element['#element']['#block']->delta . '/edit',
    );
    unset($element['#links']['block-configure']);
  }
}

Status:Needs review» Fixed

Status:Fixed» Closed (fixed)

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

Title:contextual links not workingContextual links not working
Status:Closed (fixed)» Needs review

This 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.

Confirmed. 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.

Status:Needs review» Fixed

Here you go. http://drupal.org/commitlog/commit/22232/5b5772bcf56fc9299cb041417b8a022...

I checked to make sure a render array was returned by the plugins.

Really....a not empty in an array? Shoot me in the face now. :-p

Status:Fixed» Closed (fixed)

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

Issue summary:View changes
Status:Closed (fixed)» Needs review
StatusFileSize
new406 bytes
PASSED: [[SimpleTest]]: [MySQL] 98 pass(es).
[ View ]

We have lost the point made in comment #1

There 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.

We need to add the 'edit' arg to the contextual link

Patch attached

Status:Fixed» Closed (fixed)

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

Version:7.x-1.x-dev» 7.x-1.7
Status:Closed (fixed)» Closed (duplicate)

I believe this is duplicate to #1949058: No edit option.

Apply the patch and clear cache should fix this.

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

Ignore the above comment. Update in the wrong place. Sorry.

Status:Closed (duplicate)» Closed (fixed)