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

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.

  • Amazingly helpful info. Got a working test using all this. Thanks a ton! – tdm Apr 4 '14 at 20:44

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.