My content type uses an unlimited number of images as "screenshot". I would like to be able to manage the FIRST screenshot of the set as the "cover" of the content type, so to define a "field_cover" and telling Drupal "The value for this field is the first value of field_screenshot". In this way I could reference field_cover in my views for some special cases (like showing the latest mynodes in home page, using the "cover" as the image).


I'm not aware of a "wrapper" field type, but you have a few options.

I've done the same myself in Views by filtering by the "delta" value, which is the individual values in a multivalue field. That way it's easy to require "delta = 0" and get the first value. This has a limitation of currently not working with arguments/contextual filters though.

A second option is the to ctools recently added support for delta values. You can render a field and set both offset, range and reversal of deltas.

Final option I can think of is Computed Field, which could be programmatically coded to act as field wrapper.

  • I didn't think of the "delta" options in filters... thank you. By now this works for me. – Claudio Feb 11 '12 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.