I have a code field where I am doing something similar to the following:

<?php
return render(field_view_field('field_collection_item', $entity, 'field_cup'));
?>

It works as I would expect when DS Extras Field Templates is disabled, but if I enable Field Templates and select a different template this one code field continues to render from the core template despite the fact that all other fields render correctly. Am I doing something incorrectly or is this a bug?

Comments

nicholas.alipaz’s picture

Version:7.x-1.5» 7.x-2.x-dev

I have just tested against 7.x-2.x-dev since there did not seem to be any upgrades to run, only code changes, and the result is the same.

swentel’s picture

Status:Active» Fixed

Well, the template for that field you're calling in the code field should be configured on the field collection, not where this field is rendered (I'm guessing it's a node content type).

nicholas.alipaz’s picture

I found my issue, I had not set the "Full Content" view mode to use a layout yet, so display suite settings were not being used.

Thanks for answering.

nicholas.alipaz’s picture

Category:support» bug
Status:Fixed» Active

Okay, further investigation and I found it did not work as I thought it had. I then did some more testing and was able to determine that there is some cascading going on. If you have node that has a field_collection field in it then all the displays need to be set to use the Display suite for their default view mode as well.

What I had was
Node
-- field collection field 1
-- view mode: default - not using display suite and field collection field display set to full view mode
-- view mode: full - using display suite and field collection field display set to full view mode and the correct template

Field collection 1
-- field collection field 2
-- view mode: default - not using display suite and field collection field display set to full view mode
-- view mode: full - using display suite and field collection field display set to full view mode and the correct template

Field collection field 2
-- regular text field (field I was trying the render from code field)
-- view mode: default - using display suite but my code field is not set to be available in this display
-- view mode: full - my code field set to use the correct template

When I changed the Node view mode: default to use display suite (one column) the template for my field two field collections deeper started displaying with the correct template.

I am not sure if this is a bug or not, but perhaps it is just documentation? I am reopening for your review, but close if you feel it doesn't warrant any changes.

swentel’s picture

Status:Active» Closed (works as designed)

This is by design. It's indeed some kind inception going on here :)
Added it on http://drupal.org/node/644662

radio_babylon’s picture

i have a similar problem, where i have a field collection with a display suite layout assigned... and i cannot get it to use the DS layout no matter what i do, whether when viewing it directly by going to its /field-collection/foo/(num) alias, or when rendering it from inside a node the collection is in.

i have applied the DS layout to ALL the collection's view modes, and to ALL the containing node's modes, and it just flat will not use DS.

am i doing something wrong? any insight you could provide would be much appreciated...

radio_babylon’s picture

never mind. note to self: always, always clear drupal's cache before wasting time troubleshooting. d'oh!