Hi,
After seeing your post http://drupal.org/node/1079300 and testing your module, i have a first comment:
I realize that the title of the images doesn't show in the colorbox. Did I do something wrong? Or is the feature not implemented?
Thanks again anyway.

Comments

kmadel’s picture

Status: Active » Postponed
StatusFileSize
new26.56 KB

Currently the title that gets displayed is the based on what is set in the 'Advanced' tab of the CKEditor 'Image Properties' dialog (see screenshot). I know this is limiting right now, but the Media module doesn't seem to support capturing field values from the inline pop-up yet. Once that is possible, I would add a configuration point to the colorbox_file formatter to allow the admin to select what Media entity field to use as the Colorbox title or caption.

If you have any other ideas around this, then let me know, and I will happily un-postpone it...

And thanks for checking it out!

kmadel’s picture

By the way, curious if you are drupalcon, if so we should meetup to discuss. Also, I am doing a BOF - http://chicago2011.drupal.org/conference/bof/inline-media-d6-vs-d7

camdarley’s picture

Unfortunately, I'm not at Drupalcon: I live in France and it's a long travel to chicago ;) I would be happy to listen your BOF.
I think there is still a lot of work to make the media module fully operational. I chose to use D7 in a large part for the media module, but i think it's still not enough intuitive, especially by the integration with the Styles module which is not easy to understand.
I'm not actually a developer, but I try to do my best, but i didn't success to create custom preset as you've done.
The most i can do is testing modules and report issues or ideas.
I tested with a "multimedia asset" field, that's why i can't transmit title to colorbox. Maybe can you explore the media gallery module which can display medias in a colorbox with title and description (but it doesn't use the colorbox module, which is a pity).
Regards

nicolash’s picture

Ok, so this only applies to media inserted inline with CKEditor.

How about using the content of a field that has been associated with the image? In other words, if I add a field to the image file type, say "Image title", I can enter content in the media browser detail view.

If there would be a select list in the colorbox_file config form that lets you choose which field to use as the colorbox title, would that be an option?

camdarley’s picture

I made it working with this addition to code:

function theme_file_colorbox($variables) {
  //dd($variables, 'theme_file_colorbox $variables');
  $output = '';
  
  $file = $variables['file'];
  //dd($file, 'theme_file_colorbox $file');
  $icon_directory = $variables['icon_directory'];
  
  $attributes = array();
  if (isset($variables['styles_overrides']['style'])) {
    $attributes['style'] = $variables['styles_overrides']['style'];
  }
  $title = '';
  if (isset($variables['styles_overrides']['title'])) {
    $title = $variables['styles_overrides']['title'];
+ } else {
+   $media = media_load($file->fid);
+   $title = $media->media_title[LANGUAGE_NONE][0]['value'];
  }
  $alt = '';
  if (isset($variables['styles_overrides']['alt'])) {
    $alt = $variables['styles_overrides']['alt'];
  }

This work for me (i have media-7.x-1.0-beta4) but i think it's not working with beta5, which switch to file entity.
Also the dependency to media module should be added.

kmadel’s picture

Status: Postponed » Fixed

You can now specify a field on file entity by type (different field for image vs video for example) as the field to use as the caption for the Colorbox overlay. After some preliminary testing, the next step is to make this a full project and create a dev release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pdcarto’s picture

Version: » 7.x-1.0-rc1
Status: Closed (fixed) » Active

Re #6:

@kmadel, can you please provide more information how this works? Where do you specify this field to use as the media colorbox caption? I see the option in the views field configuration (attached screenshot), but if there is some place where the caption text field is supposed to be chosen, it is not obvious!

Thanks.

pdcarto’s picture

StatusFileSize
new19.89 KB

[screenshot that I failed to attach on the previous comment]

kmadel’s picture

For the each file type (file entity) that you want to display in a Media Colorbox you will need to create a simpel text field, when you create that text field there is a checkbox towards the bottom of the field edit page that will designate that text field as the one to be used as the caption.

kmadel’s picture

Status: Active » Closed (works as designed)