Posted by paloczp on March 3, 2011 at 10:46am
26 followers
| Project: | Colorbox |
| Version: | 7.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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
Comments
#1
#2
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.
#3
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.
#4
I tried it, it is working fine. Thx!
#5
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.
#6
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.
#7
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.-
#8
neurojavi, see this issue #872518: Undefined index: #formatter in theme_styles_field_formatter()
#9
Great job, kmadel. Have you though of integrating this module with Colorbox? It might be more useful than creating a separate project.
#10
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.-
#11
@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.
#12
@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!
#13
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?
#14
@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.
#15
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?
#16
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".
#17
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?
#18
subscribe
#19
subscribe
#20
subscribe
#21
Yes, it is not set up to support video yet - only images at this point.
#22
neurojavi, thanks for instruction, all works very good!
Does this feature planned to integrate into Colorbox head or will stay in separate module?
#23
At one point, there were comments in the Colorbox issue queue that stated this wasn't something they were interested in adding.
#24
subscribe
#25
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.
#26
subscribe
#27
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.
#28
@#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.
#29
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.
#30
Thanks, this was helpful in the meantime. Combining #3 with #27, works great.
#31
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.
#32
I patched the module to work with basic image and it seems we are good to commit it to the head. Please review.
#33
This is a clean one which is supporting to the media field.
#34
#33 : FYI media field is deprecated in favor of the core file field now.
#35
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.
#36
Have you checked out: http://drupal.org/project/media_colorbox
#37
#38
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??
#39
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?
#40
@NatiNog See http://drupal.org/node/1658742 (duplicate)
or check out http://drupal.org/node/1368274
#41