Programmatically displaying a view into a colorbox 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?

Any help is greatly appreciated.

https://drupal.org/node/1991948
Put your view into a div with a wrapper that is hidden (ie, display:none;). Then you can use the following javascript:

$.colorbox({
    'inline' : true,
    'href' : $('.views-view-my-view'),
});


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

If you need some advice on placing a view on your page, here is a clean implementation:

function MODULE_preprocess_page(&amp;$vars) {
  $vars['page']['bottom']['my_view'] = array(
    '#type' =&gt; 'container',
    '#attributes' =&gt; array(
      'id' =&gt; 'my-view-container',
    ),
    'children' =&gt; array(
      '#markup' =&gt; views_embed_view(...),
    ),
  );
}


In this case your selector for colorbox would be #my-view-container .view