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 :)

Comments

DamienMcKenna’s picture

Subscribe.

swentel’s picture

Status: Needs review » Needs work
FileSize
3.35 KB

Updated 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.

swentel’s picture

FileSize
3.39 KB

Updated again - reverse doesn't work yet though - will figure it out tomorrow.

swentel’s picture

Status: Needs work » Needs review
FileSize
3.44 KB

Ok, this patch should be good.

crymzyn’s picture

Thank 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...

thePanz’s picture

Crymzyn: I've implemented what you're looking for, try my module: http://thepanz.netsons.org/post/drupal7-image-formatter

Small and clean!

Cheers

crymzyn’s picture

thePanz................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!

John Morahan’s picture

FileSize
3.36 KB

Didn'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:

Skip the first @count items.
Then display at most @count items (enter 0 to display all items).

What do you think?

John Morahan’s picture

FileSize
3.31 KB

Same patch as above, but with the alternative UI.

awebb’s picture

Status: Needs review » Reviewed & tested by the community

This should be ready.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed!

Status: Fixed » Closed (fixed)

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