I have been pulling my hair out over the last few days, trying to find a way to combine a custom link field with an image field, to no avail. I could accomplish this with one image field value and one link field value through Views, but I can't do it with more than one value for each. (I have a content type with 3 image field values per node) At any rate, relying on Views for such a basic function seems unwieldy. Using the field collection module I can almost get there, but I still need to create a custom template for my content type in order to go all the way. For a variety of reasons, this is not a great solution. This particular site requires numerous content types and the ability to add more without necessarily having access to a Drupal developer. Any time a developer is required for basic functionality like this, it represents an extra cost to an entity that chooses Drupal as its CMS. I could also completely give up on image fields and try to accomplish this with a WYSIWYG editor and many lines of CSS, but again that's a long painful row to hoe just to wrap a link around an image.
There was a Link Image Field module but it has not been released for Drupal 7, and it works with a "link image" field instead of the existing image field. (The D7 release of this module seems to mired in red tape at the moment, maybe someone can expedite it)
In my opinion, this should be part of core and it should work with image fields.
This seems like a fairly simple need: the ability to link an image to any URL we want. Presently, image field link options include "content" (the current node) the file itself, or "nothing." These are also managed through field display settings for all nodes of a content type (as opposed to being set with each image field value as it is uploaded on an individual node).
Comment | File | Size | Author |
---|---|---|---|
#6 | image-link-fields-1570072-6-do-not-test.patch | 2.75 KB | samalone |
#1 | wordpress_screenshot.gif | 41.09 KB | jenyum |
Comments
Comment #1
jenyum CreditAttribution: jenyum commentedBelow is a screenshot of the out of the box image upload interface in Wordpress. This has become what the average user expects from a CMS. I love Drupal but it is behind in this regard.
Comment #2
pfrenssenThere is Link Image Field.
Comment #3
jenyum CreditAttribution: jenyum commentedYes, I noted that in my post. It's not available for Drupal 7, does not have a current maintainer, and introduces another field type rather than working on the existing image field. At any rate, this really should be in core. Please do not mark this as fixed.
Comment #4
pfrenssenI don't think this is something that belongs in core. The philosophy of Drupal is quite different from Wordpress. If you need additional flexibility in Drupal, then this is usually provided by contributed modules. Having images link to external websites is not universally useful for all websites, so this is better off as a contributed module. This gives everyone the choice of using it or not. This is why the Link Image Field module exists.
Link Image Field has already been ported to D7 over a year ago. There is also an alternative version available which uses the core Image field, so your needs might already be covered. It might be hard to find these D7 versions because (as you know) the module is currently unmaintained and these downloads have not yet been made available on the project page. For the moment development is happening in a number of sandboxes until a new maintainer is appointed.
Here are some useful resources:
Comment #5
kingfisher64 CreditAttribution: kingfisher64 commentedI'm completely with you jenyum. I simply want to make an field image linkable so that it loads up an external site on click.
There can be such a thing as a too modular approach. This is basic functionality that is of common use. I think the drupal leaders need to consider what other users coming from other systems expect. A developer friend of mine was put off drupal by simply not understanding this approach. He thought it was too modular.
I realise there's a balance to be found here - that needs to be taken on a request by request basis so that core drupal doesn't become bloated. In this specific case I think a image should be linkable out of the box.
Comment #6
samalone CreditAttribution: samalone commentedI just patched my version of Drupal 7.15 to allow image fields to link to any link field created by the link module. The patch adds the names of any link fields to the popup that appears when you click the gear icon next to an image field in the "Manage display" tab of the content type editor. Only the first link in a multiple-value link field is used.
For now I'm submitting this as a "do not test" patch because it's based on 7.15 rather than the latest development branch of Drupal, but if there's interest I will submit a more formal patch.
Comment #7
jenyum CreditAttribution: jenyum commentedI'm definitely interested! Any other votes?
Comment #8
jwjoshuawalker CreditAttribution: jwjoshuawalker commented+1
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedI would love to see this as well.
Comment #10
DYdave CreditAttribution: DYdave commentedHi guys,
Thanks very much for your comments and feedback on this ticket, it was really a lot of help.
Following up with Add a link option to an image field, your comments and patch from #6, I went ahead and created a new formatter module with project at: #1837170: Image Link Formatter
I would greatly appreciate if I could have some of your feedback on this, since this module is mainly inspired from this particular discussion. It has already been tested, based on this use case:
This formatter is based on the Link and Image modules and simply implements a display formatter.
Project's page contains more explanations about how this module would be different from other solutions mentioned above, such as Link Image Field or Custom Formatters, or any other solutions.
Please let me know if you would have any questions on any points/code/aspects mentioned in the project, I would surely be glad to provide more information.
Tests, feedback or comments in general are highly appreciated.
Thanks in advance.
Comment #11
joelpittetUnlikely to make it into 7 or 8.0.x but maybe 8.1.x
Comment #14
andypostAlso https://www.drupal.org/project/linked_field helps for now