When inserting a view from code (views_embed_view) that contains a colorboxed field, the required javascript does not get loaded.

This happens because colorbox thinks the page doesn't contain any colorbox. In colorbox.module, function _colorbox_doheader():

  if (!_colorbox_active()) {
    return; // Don't add the JavaScript and CSS on specified paths.
  }

_colorbox_active() checks if the current path contains any colorbox fields. Since no field has been configured with colorbox on this page, it returns false and skips the colorbox javascript.

This makes any colorbox fields in an embedded view not work properly... Perhaps there could be a method call that would set some global variable for _colorbox_active() to return true regardless of the current url? Seems like an awful patch but unless the whole url checking method is revamped I do not see a better way...

Any thoughts?

Comments

bohemier’s picture

Issue summary: View changes
bohemier’s picture

Ooops!

I found out that my view was embedded on a node/edit page, which was stripped out by the default module configuration. Sorry, my mistake!

bohemier’s picture

Status: Active » Closed (works as designed)