Q:

Using nested node content type template files

Using Drupal 7 I have setup a structure in which a widget_set content type has a node reference field that allows the user to choose nodes of the content_widget content type.
The template files are node--widget_set.tpl.php and node--content_widget.tpl.php
Inside the node--widget_set.tpl.php template, I call print render($content); and was hoping to have the output be formatted as specified in node--content_widget.tpl.php, but I just get output that seems to ignore the content_widget template.
Is that the expected behavior?  I could just pull the code from the content_widget template into the widget_set template but I have a bunch of content_widget types and wanted to keep them all separate.
Thanks.

A:

Assuming you want the structure to be something like this:
<div class='node node-widget_set'>
  <!-- other fields -->

  <div class='node node-content_widget'>
  </div>
</div>

ie, render the template inside the the other template, and assuming you have named your templates properly, put them in your theme, and cleared the theme registry (or cleared all caches), you need to set the display settings appropriately.

In the Manage Display settings for Widget Set, find the Content Widget field, and adjust the settings:

Set the Label as you need
Set the Format to Rendered entity
The click the gear, and adjust the settings.  You can pick the view mode (full, teaser, etc), whether to show links or not, and potentially other settings that modules have defined.

Note that this does assume your node-to-node fields are using Entity References and not Node References.
Then you should get output to use nested templates.  Using Entity View Modes and Rabbit Hole also come in very handy when you do things like this on your site.

