Maybe this qualifies as a feature request, but anyway...

When using Picture in combination with the Media module, I cannot link the image to the node it is attached to. When you choose the "link image to content" setting, Picture regards the file entity as the content and links to the file entity page. While this is understandable from a technical perspective, I think it is usually not what the user expects and needs.

Comments

marcvangend created an issue. See original summary.

marcvangend’s picture

Status: Active » Needs review
StatusFileSize
new719 bytes

A simple fix turns out to be pretty easy:

  if ($image_link == 'content') {
    if (isset($entity->referencing_entity) && isset($entity->referencing_entity_type)) {
      $uri = entity_uri($entity->referencing_entity_type, $entity->referencing_entity);
    }
    else {
      $uri = entity_uri($entity_type, $entity);
    }
  }

Of course you could also choose to make it an explicit choice to link to the referencing entity instead of the file entity itself.

attiks’s picture

Status: Needs review » Fixed

Thanks

  • attiks committed dbefadd on 7.x-2.x authored by marcvangend
    Issue #2555233 by marcvangend: Picture + Media: cannot link image to...

Status: Fixed » Closed (fixed)

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

rovo’s picture

It obvious to me now in retrospect, but just an FYI for anyone else, this Link update works with the Picture display only, not the 'Image with sizes' display.