1

I'm trying to test Media 2.x and File Entity. I've edited the "Image" File Entity to add taxonomy terms and all and then I'm trying to leverage views to list all images in a grid in a page, and my end goal is to be able to click on a thumbnail and then get a larger image with more details.

I'm finding it complicated (impossible?) to link the images to another display (teaser to full content for instance). It works just fine with regular "Content" views but it seems that when you start with the "Files" view this is not an option.

enter image description here

Do you have any idea what I'm missing? Is there a way (relationship or anything) to be able to get the "Link this image to its content"-like option?

1

I'm not sure what you're asking. Normally you say "show title" and check "link this to content". Same thing here, Make your File view_mode whatever you want and link it to your content url. You may be asking for a Lightbox approach to showing a set of images.

If there's no option to "link to content" for this field, simply create a rewrite url in the Views Field settings to generate a link using tokens.

Now you may ask -- this isnt addressing the teaser -> full view_mode switch for the Entity (or Field?). Creating links in Views, or with the l() function has nothing todo with View Modes ... they're just links you're making.

I find it helpful to add additional view modes to entities, I have used Entity View Modes for that.

You either setup a custom URL to your content that forces the view mode, using for instance View Mode Page or you could try to set a context or something and hand code something that forces the view mode on your destination url yourself using a custom module, for a small example:

/**
 * Implementation of hook_entity_view_mode_alter().
 * Change the view mode of an entity that is being displayed.
 */
function MYMODULE_entity_view_mode_alter(&$view_mode, $context) {
  if ($context['entity_type'] == 'node' && $context['entity']->type == 'slang_word') {
    $view_mode = 'slang_dict_word';
  }
}

You could use a custom view mode to only show the Field in question -- with the custom view_mode set.

... maybe this rambling will help you or someone else :)

0

There is also the Image URL Formatter module that might help. Here is a quote about it (from the module's project page):

(1) After install this module, then you add an image field, then you can goto this bundle's manage display page, here at format column, you can choose "Image URL" instead of "Image".

(2) When you add an image field in your views, then you config the Formatter for this field, here you can choose "Image URL" instead of "Image".

Then you can output image's URL instead of Image itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.