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.
It seems that the optional title- and alt-fields of a image field can not be shown in views because the needed formatter is missing.
If you have multiple images per node, these title- and alt-fields are a good way to insert information per image (like name of the photograpger or agency).
At the moment, you can insert these information in the image fields, but you can not show them with views...
Comments
Comment #1
bfroehle CreditAttribution: bfroehle commentedI'm moving this over to Views, as Views provides the proper integration for core provided fields... I think.
Comment #2
dawehnerAs you said there is no formatter for this. What would views do here, write a formatter?
Personally some kind of contrib module could provide this formatter, so i started some time ago http://drupal.org/sandbox/dereine/1073916
As far as i remember the module didn't worked yet, but you can help to get it done :)
Comment #3
James-5642 CreditAttribution: James-5642 commentedInteresting situation:
The drupal core – people and the maintainer of imagefield (predecessor of the image field) say that views is responsible for the integration of core fields. And the views maintainers say that they are not responsible. ;)
All I can say is that the views integration of the alt- and title-fields worked fine with imagefield (predecessor of image field with drupal 6). And after the integration to core in drupal 7, it doesn’t work anymore. And that this function is very important.
As I am no programmer, there is absolutely nothing I can do about it – sorry for that.
I can only wait and hope that someone reintegrates that function. Until then, I have to go back to drupal 6, as I do no want to be sued because the photographer or agency is not named under the pictures.
Comment #4
bojanz CreditAttribution: bojanz commentedThe solution to your problems is http://drupal.org/project/custom_formatters.
It will allow you to create a formatter showing just the alt and/or title, and then you can select that formatter from Views.
It is not the job of Views to provide custom formatters. Formatters are a Drupal core thing. That's a fact, not an opinion.
This means that waiting for this to show up in Views is futile.
Comment #5
bfroehle CreditAttribution: bfroehle commentedI think I spoke too soon by saying this was a Views thing. I'm moving this back to core for now.
Comment #6
banani CreditAttribution: banani commentedAre there any news regarding this issue?
I also need to be able to show the title and alt text of a image in views. I can not update to drupal 7 without that function.
What ways are there to get that function back, that was available with drupal 6.
Comment #7
david3000 CreditAttribution: david3000 commentedsubscribe!
Comment #8
djh007 CreditAttribution: djh007 commentedsubscribin'
Comment #9
quantix2 CreditAttribution: quantix2 commentedsubs
Comment #10
Rechi CreditAttribution: Rechi commentedOk, for everybody who has no clue how to solve alt with custom_formaters,
use this for a custom php formater.
Don't forget that you have to uncheck:
'Display all values in the same row'
It would be great if anybody could put alt and title into a clean module.
Comment #11
Ross-Hunter CreditAttribution: Ross-Hunter commentedAn easier, although probably a little hackier option is to add another copy of the image to the views fields and select "rewrite output of this field". The replacement patterns contain a token for both alt and title.
Comment #12
mediameriquat CreditAttribution: mediameriquat commentedsubscribin'
Comment #13
TuWebO CreditAttribution: TuWebO commentedHi,
Ross-Hunter good trick, thanks!
But notice, it is not mandatory to add same image field twice, just one should be enough.
And then, we can "Rewrite Results" for that field adding this code (with your html stuff) in the "Rewrite the output of this field":
Comment #14
rbrownell+1
Comment #15
afeijo#13 worked for me :)
Thanks, TuWebO!
Comment #16
stoltoguzzi CreditAttribution: stoltoguzzi commented#13 alt and title are hidden per default in d7 field-types.. just if somebody has to search for like me:-)
Comment #17
stoltoguzzi CreditAttribution: stoltoguzzi commented#13 alt and title are hidden per default in d7 field-types.. just if somebody has to search for like me:-)
What if I use the media-selector from media-modul, seems that the alt/title from there are not the same?
Comment #18
Homotechsual CreditAttribution: Homotechsual commentedI'm looking at a method to accomplish this also - I'd appreciate any help, I've tried with the 'custom formatters' module but the provided code does nothing, I've considered theme overrides which also don't seem to work. If anyone's cracked this I'd appreciate knowing how.
Comment #19
cgmonroe CreditAttribution: cgmonroe commentedOld topic but I'd like to point out to the the people saying this is not a core thing.... this is a key accessibility item. Drupal's accessibility statement ( https://www.drupal.org/about/accessibility ) says that Drupal is committed to having core as accessible as possible.
IMHO, views not producing valid Accessible HTML IS a bug that needs to be fixed.
Comment #20
Homotechsual CreditAttribution: Homotechsual at MJCO commentedThere's also the point that in the UK and soon across the EU there is now the issue of legal liability on inaccessible websites. It has been confirmed in the UK that website operators/designers are potentially liable for producing inaccessible websites under discrimination legislation, a relatively recent EU directive will extend this EU wide.
Accessibility is becoming a legal/compliance issue for
mosta large portion of the world, it's no longer just a nicety.Comment #21
rami.sedhom CreditAttribution: rami.sedhom commentedIs #13 still working with drupal 7 + views 3, as I've tried and it's not or may be I'm missing something.
Comment #22
bisonbleu CreditAttribution: bisonbleu commentedIf you have checked Enable Alt field in your field_image settings AND the Alt field is not empty in the node edit form, then you are good to go i.e. you don't need to do anything.
This with Drupal 7.39 and Views 3.11.
Comment #23
albertski CreditAttribution: albertski commentedI tried to Rewrite the output of this field with:
But only the image prints out. The image title is blank but the image has a title. Do you guys know if this is still working?
Comment #24
albertski CreditAttribution: albertski commentedI was able to get it to work by also unchecking Use field template under Style settings.
Comment #25
evemas CreditAttribution: evemas commentedThanks... it's working perfectly using the simple patterns available for the field ! [field_image-title] for example.
Comment #26
bdparker CreditAttribution: bdparker as a volunteer commentedOk, neither of these are working for me.
If I export
[caption-1] - [field_image-alt] - [field_image-title]
then this is my output:
<p>I am a caption.</p> - [field_image-alt] - [field_image-title]
Is there something I need to do to activate the use of these fields?
Comment #27
amit0212 CreditAttribution: amit0212 as a volunteer and commentedWhen you add the Content: Image Field to your Views display, you can choose to rewrite the output of the field using 'Rewrite Results'. The tokens exposed are:
[field_image] == Content: Image
[field_image-fid] == Raw fid
[field_image-alt] == Raw alt
[field_image-title] == Raw title.
If you want to display the image, use [field_image]. If you want to show a caption from the title field underneath the image, use [field_image]
[field_image-title]