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.
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
Comment | File | Size | Author |
---|---|---|---|
#33 | 1079804-media-support-to-colorbox-33.patch | 1.21 KB | heshanlk |
#32 | 1079804-media-support-to-colorbox-32.patch | 1.2 KB | heshanlk |
Comments
Comment #1
paloczp CreditAttribution: paloczp commentedComment #2
frjo CreditAttribution: frjo commentedThere 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.
Comment #3
kmadel CreditAttribution: kmadel commentedI 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.
Comment #4
paloczp CreditAttribution: paloczp commentedI tried it, it is working fine. Thx!
Comment #5
M.F. CreditAttribution: M.F. commentedI'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.
Comment #6
maebelater CreditAttribution: maebelater commentedWorked 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.
Comment #7
neurojavi CreditAttribution: neurojavi commentedHi:
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:
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.-
Comment #8
mansspams CreditAttribution: mansspams commentedneurojavi, see this issue #872518: Undefined index: #formatter in theme_styles_field_formatter()
Comment #9
kunago CreditAttribution: kunago commentedGreat job, kmadel. Have you though of integrating this module with Colorbox? It might be more useful than creating a separate project.
Comment #10
neurojavi CreditAttribution: neurojavi commentedHi, 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.-
Comment #11
kunago CreditAttribution: kunago commented@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.
Comment #12
neurojavi CreditAttribution: neurojavi commented@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!
Comment #13
neurojavi CreditAttribution: neurojavi commentedAs 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?
Comment #14
kunago CreditAttribution: kunago commented@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.
Comment #15
mschouten CreditAttribution: mschouten commentedi 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?
Comment #16
mschouten CreditAttribution: mschouten commentedOk 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".
Comment #17
midmood CreditAttribution: midmood commentedHi 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?
Comment #18
rodrigoaguilerasubscribe
Comment #19
Cyclodex CreditAttribution: Cyclodex commentedsubscribe
Comment #20
dwalker51 CreditAttribution: dwalker51 commentedsubscribe
Comment #21
kmadel CreditAttribution: kmadel commentedYes, it is not set up to support video yet - only images at this point.
Comment #22
Murzneurojavi, thanks for instruction, all works very good!
Does this feature planned to integrate into Colorbox head or will stay in separate module?
Comment #23
kmadel CreditAttribution: kmadel commentedAt one point, there were comments in the Colorbox issue queue that stated this wasn't something they were interested in adding.
Comment #24
Chipie CreditAttribution: Chipie commentedsubscribe
Comment #25
ao2 CreditAttribution: ao2 commentedFWIW 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.
Comment #26
dwalker51 CreditAttribution: dwalker51 commentedsubscribe
Comment #27
jide CreditAttribution: jide commentedTo 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.
Comment #28
jwilson3@#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.
Comment #29
jwilson3Also 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.
Comment #30
minneapolisdan CreditAttribution: minneapolisdan commentedThanks, this was helpful in the meantime. Combining #3 with #27, works great.
Comment #31
jide CreditAttribution: jide commentedHi, 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.
Comment #32
heshanlkI patched the module to work with basic image and it seems we are good to commit it to the head. Please review.
Comment #33
heshanlkThis is a clean one which is supporting to the media field.
Comment #34
jide CreditAttribution: jide commented#33 : FYI media field is deprecated in favor of the core file field now.
Comment #35
lsolesen CreditAttribution: lsolesen commentedSetting 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.
Comment #36
lsolesen CreditAttribution: lsolesen commentedHave you checked out: http://drupal.org/project/media_colorbox
Comment #37
lsolesen CreditAttribution: lsolesen commentedComment #38
NatiNog CreditAttribution: NatiNog commentedHi! 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??
Comment #39
NatiNog CreditAttribution: NatiNog commentedI could make the colorbox appear now, but it fails to load the video.
I get the message: This content failed to load.
Any clue?
Comment #40
dolly nyc CreditAttribution: dolly nyc commented@NatiNog See http://drupal.org/node/1658742 (duplicate)
or check out http://drupal.org/node/1368274
Comment #41
frjo CreditAttribution: frjo commented