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.
Use case: you have an image field set to unlimited. But sometimes you only want to show the first (or first two etc).
Patch attached checks the field cardinality on Field API fields. A really handy feature if imo :)
Comment | File | Size | Author |
---|---|---|---|
#9 | 1234618.patch | 3.31 KB | John Morahan |
#8 | 1234618.patch | 3.36 KB | John Morahan |
#4 | 1234618.patch | 3.44 KB | swentel |
#3 | 1234618.patch | 3.39 KB | swentel |
#2 | 1234618.patch | 3.35 KB | swentel |
Comments
Comment #1
DamienMcKennaSubscribe.
Comment #2
swentel CreditAttribution: swentel commentedUpdated patch - form is like in views now, see http://imageshack.us/photo/my-images/850/screenshot20110907at193.png/
Need to test this patch a bit more though, so setting needs work.
Comment #3
swentel CreditAttribution: swentel commentedUpdated again - reverse doesn't work yet though - will figure it out tomorrow.
Comment #4
swentel CreditAttribution: swentel commentedOk, this patch should be good.
Comment #5
crymzyn CreditAttribution: crymzyn commentedThank you for your work on this, I am needing it desperately to avoid clogging up disk space with all of the extra images I am uploading currently. My current set up is to use a completely different image field for the teaser view of my products (at antiquejackpot.com), and this is hopefully going to allow me to get rid of that extra field.
However, I updated CTools this morning, and then applied your patch... For some reason, I am not seeing the extra field(s) to drop in the values of what is to be shown - this is the case for both Colorbox and regular Image fields. I've cleared my local cache, the site cache, and even ran the update.php script. Is there something I'm missing? I can give you anything you need to troubleshoot, just let me know.
Thanks again!
Edit: FYI, this is a Drupal Commerce site if that changes anything...
Comment #6
thePanz CreditAttribution: thePanz commentedCrymzyn: I've implemented what you're looking for, try my module: http://thepanz.netsons.org/post/drupal7-image-formatter
Small and clean!
Cheers
Comment #7
crymzyn CreditAttribution: crymzyn commentedthePanz................YOU DID IT!
I have tried Display Suite, Field Multiple Limit, and a number of different solutions, but none of them seemed to play well with Commerce. Now I have exactly what I need - teasers with 1 image!
Thanks so much!
Comment #8
John Morahan CreditAttribution: John Morahan commentedDidn't work if there's no settings form for the field to begin with - attached patch fixes. Otherwise working.
I think I see what you were aiming for with the translations and explode, so I continued down that path.
I'm not sure about the UI. Especially having to type in the word "all" seems a bit confusing, especially as there's no hint about how to get all items to display once you've changed the default to something else.
How about:
What do you think?
Comment #9
John Morahan CreditAttribution: John Morahan commentedSame patch as above, but with the alternative UI.
Comment #10
awebb CreditAttribution: awebb commentedThis should be ready.
Comment #11
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted and pushed!