The Media Gallery block currently gets two sets of contextual links attached to it. This is described in the following bug report against Drupal core: #870434: Contextual links can be displayed more than once for the same element.
However, it turns out that trying to fix it in core has other side effects, so we should fix it here instead. That is done in the attached patch.
Basically, by allowing the media gallery node to live in a subelement of the $block['content'] array, rather than at the top level, we allow the node and block to be rendered separately without them being passed through the contextual links system twice. And to get the contextual links to render where we want them to, all we have to do is move the node's #contextual_links property itself up to the top level of $block['content'], and leave the rest alone.
Comment | File | Size | Author |
---|---|---|---|
#7 | Screenshot at 2011-12-08 10:45:58.png | 72.46 KB | pjcdawkins |
media-gallery-contextual-links.patch | 1.28 KB | David_Rothstein |
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted in preparation for the upcoming beta release of the module.
http://drupalcode.org/project/media_gallery.git/commit/a7d8a1a
Comment #2
Sylvain Lecoy CreditAttribution: Sylvain Lecoy commentedThat's exactly what i am looking for. Thanks.
Comment #3
Sylvain Lecoy CreditAttribution: Sylvain Lecoy commentedI'm having a problem with this patch, the 'more_link' is then part of the block and not part of the gallery like it was.
You should change $block['content']['more_link'] to $block['content']['gallery']['more_link'] in your patch to respect the tree form.
Comment #4
David_Rothstein CreditAttribution: David_Rothstein commentedIn what way is that causing a problem?
Generally Drupal puts "More" links at the bottom of the block itself (not appended inside some part of the block's content). So this change made it more consistent with other blocks, which seems better to me.
For example, if I enable the core Blog module and and put its "Recent blog posts" block on my site, then with this patch, the "More" links on that block and the "More" links on the gallery blocks are styled consistently. But before this patch, they had different styling.
Comment #5
Sylvain Lecoy CreditAttribution: Sylvain Lecoy commentedOh I see, I wasn't aware of other default bloc, then this is a good thing :)
Thanks for the reply.
Comment #7
pjcdawkins CreditAttribution: pjcdawkins commentedWith
media_gallery-7.x-1.0-beta7
I get contextual links twice in gallery nodes (not blocks), is this related, or fixed, or should I open a new bug report/support request?Each photo appears to inherit links from both File API and Media:
Edit: /file/36536/edit?destination=node/67621
Delete: /file/36536/delete?destination=node/67621
Edit: /media-gallery/detail/67621/36536/edit?destination=node/67621
Remove: /media-gallery/detail/67621/36536/remove?destination=node/67621
(screenshot attached)
Comment #8
jazzitup CreditAttribution: jazzitup as a volunteer commentedEven with the latest dev, this issue is still present (7.x-1.x-dev 2015-Oct-17).
(*)
Edit
Delete
Edit
Delete
Comment #9
jazzitup CreditAttribution: jazzitup as a volunteer commentedComment #10
ivnish CreditAttribution: ivnish commented