On a d7 vanilla with just display suite.
Trying to render a node programmatically, it doesnt pick up the display suite suggested template from the theme but instead the base template from the ds module.

$node = node_load(1);
  $build = node_view($node, 'full');
  $html = drupal_render($build);
  dsm($html);

returns

<!-- THEME DEBUG -->
<!-- CALL: theme('node') -->
<!-- FILE NAME SUGGESTIONS:
   * ds-reset--node--1.tpl.php
   * ds-reset--node-article-full.tpl.php
   * ds-reset--node-article.tpl.php
   * ds-reset--node-full.tpl.php
   * ds-reset--node.tpl.php
   x ds-reset.tpl.php
   * node--1.tpl.php
   * node--article.tpl.php
   * node.tpl.php
-->
<!-- BEGIN OUTPUT from 'sites/all/modules/ds/layouts/ds_reset/ds-reset.tpl.php' -->
<div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>hello</p>
</div></div></div>
<!-- END OUTPUT from 'sites/all/modules/ds/layouts/ds_reset/ds-reset.tpl.php' -->

But If I run the same code to render the node with drush eval it picks up the correct template from the theme.

➜  drupal-7.58 drush php-eval "print drupal_render(node_view(node_load(1), 'full'));"      


<!-- THEME DEBUG -->
<!-- CALL: theme('node') -->
<!-- FILE NAME SUGGESTIONS:
   * ds-reset--node--1.tpl.php
   * ds-reset--node-article-full.tpl.php
   x ds-reset--node-article.tpl.php
   * ds-reset--node-full.tpl.php
   * ds-reset--node.tpl.php
   * ds-reset.tpl.php
   * node--1.tpl.php
   * node--article.tpl.php
   * node.tpl.php
-->
<!-- BEGIN OUTPUT from 'themes/bartik/templates/ds-reset--node-article.tpl.php' -->
TEST
<!-- END OUTPUT from 'themes/bartik/templates/ds-reset--node-article.tpl.php' -->

Any idea what I could be doing wrong? I need to render the node in code and for it to pick up the correct template from the theme.

Comments

nidaismailshah created an issue.