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.
Would you find it possible to extend the views_embed_view()
function by a parameter to include the contextual links? I'm not an expert to tell, but if it's only possible, please do. Thanks
Comments
Comment #1
dawehnerWhich display do you use form views_embed_view? If you use the embed display it should afaik actually work.
Comment #2
moniuch CreditAttribution: moniuch commentedThanks for getting back on this. I'm not sure though I'm getting the point of your question. I have created a display of type "Page" (out of: Attachment, Block, Page, Feed, System). Then I simply use
<?php print views_embed_view('view_machine_name', 'display_machine_name') ?>
. The contextual links do not appear. Is that correct way of embedding? Does this answer your question?Comment #3
dawehnerYou should use the "embed" or the default display if you embed a view somewhere else, but the page display type is not meant to be embedded and both contextual links work as expected.
Comment #4
moniuch CreditAttribution: moniuch commentedSorry if I sound ignorant, but this seems to be the crucial piece of info - what do you mean by "embed display"? Is there an option in the UI that fixes page display type as "embed"?
Comment #5
dawehnerThere is an "embed" display, see "Show the embed display in the ui." under admin/structure/views/settings.
Comment #6
moniuch CreditAttribution: moniuch commentedYep, it definitely works! I remember seeing that option but skipping it as unexplainable ;-) This might be an answer to this issue of mine: http://drupal.org/node/1839442
Now, if there was only a way to convert existing displays into embed style... I have a few displays in one View, all of them are meant to be embedded. They differ quite a bit, so Master will not be an option for that.
Two options come to mind:
- something like display conversion (clone display + change its type)
- a checkbox for each display
[x] Allow embedding
Which one would make sense to you most?