Does the Colorbox support the Media/Style modules?

I tried the Colorbox modul with standard Drupal 7 Fields -> working fine. But when I tried to setup display format in Media field, couldn't find Colorbox setting.

but... Is it a Colorbox or Media/Style support question? :)

Thx, Paul

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

paloczp’s picture

Component: Code » Miscellaneous
frjo’s picture

There is no built in support for the Media/Style modules. They are quite new and I have not used them yet.

It may well be easier for them to add support for Colorbox than the other way around.

kmadel’s picture

I have created a very small module and sandboxed it at: http://drupal.org/sandbox/kmadel/1084984

Basically, it is just a new D7 custom file formatter. All file formatters are exposed to Media entity file fields. So, for example, if you go to the 'Image media type settings' page (/config/media/types/manage/image/display/media_preview) and then select the 'Preview' display, you will now have a 'Colorbox file' formatter that you can select for the file field. It works pretty much the same way as the Colorbox image formatter does on node entities.

Let me know if you check it out, and I will be happy to add enhancements. By the way, currently it is only set up to work with the Image entity, and will only generate a standard file link for other entity types. I plan on adding support for video next.

paloczp’s picture

I tried it, it is working fine. Thx!

M.F.’s picture

I'm somewhat new to drupal, and not sure how to access "sandbox projects" such as the one listed above.

What kmadel's module/patch does completely makes sense to me, and I'm trying to use colorbox to display videos on my Drupal 7 site. It sounds like it works, but I'm unclear as to how to install it.

maebelater’s picture

Worked for me!

@M.F. There's 'Repository viewer' link in the "Development" block on the sandbox page. Download a snapshot and install like any other module.

neurojavi’s picture

Hi:

Thanks Kmadel for sharing this with us!
I've tried your module with last dev version of media module (april 25th) and I get the following error when viewing the page that contains the media field:

Notice: Undefined index: #formatter in theme_styles_field_formatter() (line 11 of /var/aegir/platforms/bwaslala/build-7.x-x-dev/sites/all/modules/styles/themes/styles.theme.inc).

I've follow this steps:
- Configure small display mode of image media type to use color box
- Add a media asset field to a test content type
- Configure this media field to use the small format
- Create a node and add a media item to it
- View the node

Then I get the former error and no image is shownn.

Perhaps there is a change in the media module or have I done something wrong?

Another question: Have you and frjo considered adding this as to colorbox module as a patch? I think colorbox is going to need media integration in the near future so...

Thanks.-

mansspams’s picture

kunago’s picture

Great job, kmadel. Have you though of integrating this module with Colorbox? It might be more useful than creating a separate project.

neurojavi’s picture

Hi, I have it working with the last dev version of media module. This version includes commit for issue #1086958: Switch from Media Entity to File Entity.
Now media entity is file entity. It appears in the new "manage file dysplay" tab in file type edit page nad works as expected. I don't knwo if you have to do any internal adjustment now that media entity doen't exist anymore.

Thanks.-

kunago’s picture

@neurojavi: Could you please let me know how you made this work? Because once I upgrade the Media module, do the database update, I see the "manage file display" just like you do. However, there is no "colorbox" option in the list.

I am using Colorbox-7.x-beta4.

neurojavi’s picture

Title: Media/Style mdules support? » Media/Style modules support?

@kunago: I've follow this steps:
- Update to last dev version of media, media browser plus (optional), ds (optional, but I use it, I've not tested this without ds... I think this has to work with or without it). Enable them
- Install and enable colorbox (I'm using 7.x-1.0-beta4)
- Download and enbale kmadel module (see #3). Since styles is not a dpendecy now for media I've removed it from the info file and completely disabled styles (this works with styles enabled too but I don't need it by now)
- Go to /admin/config/media/file-types/manage/image/display -> small (or other view mode) -> set file field to visible
- Go to /admin/config/media/file-types/manage/image/file-display -> small -> check color box file and configure it below
- Create a test content type and add a "Media" media asset field to it
- Configure this Media field to use the small format (or whichever you use)
- Create a node and add a media item to it
- View the node

I think that's all. I have colobox working with media!

neurojavi’s picture

As I've stated in the previous comments this is working fine.

@kmadel: Styles is not a dependenciy for media module anymore and your module seems to work without it too so I think styles dependency can be removes from colorbox_file. Am I right?

@frjo: Do you think this module can be merged to or includen in colorbox?

kunago’s picture

Title: Media/Style modules support? » Media/Styles modules support?

@neurojavi: Thanks. I had it all working and based on #10 I removed Styles and also the kmadel's module. That was the issue, the kmadel's patch. Oh well.

Anyways, +1 for merging this patch with Colorbox.

mschouten’s picture

i have done everything what is describes in #12, but when i submit the video, I'm getting the following error:
Undefined index: #object in media_browser_plus_preprocess_media_thumbnail()

Anyone has the same error or fix?

mschouten’s picture

Ok i have installed all dev modules, seems to work. But when i view the node, i only get the link view (so small thumbnail with text link to file), even if i set up the file types in the "manage file display".

midmood’s picture

Hi all
the module at #3 combined with the procedure at #12 works. But the prev/next function in colorbox doesn't work (anymore).
Any hint?

rodrigoaguilera’s picture

subscribe

Cyclodex’s picture

subscribe

dwalker51’s picture

subscribe

kmadel’s picture

Yes, it is not set up to support video yet - only images at this point.

Murz’s picture

neurojavi, thanks for instruction, all works very good!
Does this feature planned to integrate into Colorbox head or will stay in separate module?

kmadel’s picture

At one point, there were comments in the Colorbox issue queue that stated this wasn't something they were interested in adding.

Chipie’s picture

subscribe

ao2’s picture

FWIW I too think that having colorbox working on other File types and not only Image fields would be a good thing, this way modules like media_gallery could rely on the great colorbox module itself without duplicating stuff.

Maybe some coordination with "media" developers is needed to figure out what the best way to implement this is.

dwalker51’s picture

subscribe

jide’s picture

To make #3 work, you need to make a change : in colorbox_file_theme(), replace 'file' with 'image', in colorbox_file_field_formatter_view() replace ''#file' => (object) $item,' with ''#image' => (object) $item,' and in theme_file_colorbox(), replace '$file = $variables['file'];' with '$file = $variables['image'];'. It seems that 'file' is now a reserved variable.

jwilson3’s picture

@#27:

Please see #1254290-2: $variables file key empty, no image shown.. I've added a patch for this, and if we can get an RTBC, the module maintainer might be more convinced to add this in.

jwilson3’s picture

Also see #1283174: Official release of Colorbox_File, or integration into Colorbox. I hope there might be some communication with the two maintainers here to see if there may be a way to either roll the sandbox module into the Colorbox module, once the kinks have been worked out.

minneapolisdan’s picture

Thanks, this was helpful in the meantime. Combining #3 with #27, works great.

jide’s picture

Hi, I just posted #1296186: Complete rewrite of the module, a complete rewrite of the colorbox_file module which integrates well with Media, you might want to have a look at it.

heshanlk’s picture

Status: Active » Needs review
FileSize
1.2 KB

I patched the module to work with basic image and it seems we are good to commit it to the head. Please review.

heshanlk’s picture

This is a clean one which is supporting to the media field.

jide’s picture

#33 : FYI media field is deprecated in favor of the core file field now.

lsolesen’s picture

Category: support » bug
Status: Needs review » Active

Setting this back to active for the time being.

@heshan.lk and @jide Could any of you do a recap on this issue, so it is obvious what needs to be done about it?

Colorbox should not have support for the deprecated media field, but if any of you have a patch that supports core file field, that could be included.

lsolesen’s picture

lsolesen’s picture

Status: Active » Postponed (maintainer needs more info)
NatiNog’s picture

Hi! thankyou for this module.
I installed it and the colorbox option appears but when I click on my media file it plays normally without the colorbox. What am I doing wrong??

NatiNog’s picture

I could make the colorbox appear now, but it fails to load the video.
I get the message: This content failed to load.
Any clue?

dolly nyc’s picture

frjo’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Closed (fixed)