1

Is there any simple way to print a certain number of elements from a field collection?

Say I have an array of 8 elements and want to just print 4 at the top of a page; then, print the other 4 at the bottom.
Right now I'm attempting it in the node.tpl I am theming.

print render($content['field_my_elements_of_whatever']);

1 Answer 1

1

You can use Entity View Modes to solve the first part.

Install/enable the module, then configure some new view modes for field collections.

Then, goto the Field Collections config, and do the Manage Display for your collections. Configure the new view mode(s).

Now, goto the Manage Display for your nodes. Click the settings gear for the field collection field, and choose your view mode.

That should set you up for your second part, which is rendering out a field twice. There are several ways to do this, like this and this. You would just need to make sure your duplicated field uses your other view mode.

1
  • Amazingly helpful info. Got a working test using all this. Thanks a ton!
    – tdm
    Commented Apr 4, 2014 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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