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.
Love the module. My use case is to take programatically take the result of a view and load it into a colorbox. I can use views_get_view or views_embed_view to get a result array or a large html string. But how can I pass that to the colorbox?
Your help is greatly appreciated.
Comments
Comment #1
Sam152 CreditAttribution: Sam152 commentedPut your view into a div with a _wrapper_ that is hidden (ie, display:none;). Then you can use the following javascript:
You must replace the 'href' attribute with the appropriate jQuery collection representing your view. Other customisations to the way your colorbox appears can be found on the colorbox website.
If you need some advice on placing a view on your page, here is a clean implementation:
In this case your selector for colorbox would be `#my-view-container .view`.
Source.
Comment #2
drtrueblue CreditAttribution: drtrueblue commentedFantastic! Thank you so much. Prior to reading #1, I was able to use the inline approach successfully, however, I relied on a far uglier approach to getting the view on the page. The function was extremely valuable.
Comment #2.0
drtrueblue CreditAttribution: drtrueblue commentedadding views_embed_view as a possible function that can offer context to a possible solution