I am overriding a Display Suite view mode of a node using the template suggestion myLayout-node-myNode-full.tpl.php.

I am getting the $node->content using the node_build_content function. Then I have access and I am rendering all the node display fields using:


But I cannot render fieldgroups using the drupal_render function, as it requires array parameter, but my fieldgroups are stdClass objects that can be accessed as:


Printing the $node variable, I do not get any other reference to fieldgroups, eg. $node->content['group_myGroup'] does not exist.

Any suggestions on how I could render fieldgroups in my template file in Drupal 7?

1 Answer 1


node_build_content is probably not suitable for your use case. However you should use node_view instead which calls node_build_content anyway but returns you the actual renderable array after it processes it and sends it through an alter as well.

For example:

function mytheme_preprocess_node(&$vars) {
  if (!empty($vars['node'])) {
    $node = $vars['node'];

    if ($node->type == 'my_content_type') {
      $vars['content'] = node_view($node); //optionally supply view_mode as a second argument

Now you can just drupal_render($content) from your node template.

  • This worked perfectly, now I have the $content variable with the actual renderable array which contains fieldgroup arrays too. Thank you.
    – user20765
    Commented May 27, 2015 at 11:44
  • UPDATE: Actually I already had the $content variable provided in my DS template file, without the need to use the node_view function.
    – user20765
    Commented May 28, 2015 at 8:16
  • I thought so, I was wondering why you were rendering the content manually. Thought you were doing something with DS arrays.
    – Beebee
    Commented May 28, 2015 at 9:36

Your Answer

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