Can I add my own if statement to node.tpl to test if field groups are null? I have a content type with 4 different field-groups utilizing the Field Group module. I want to test to see if those groups are empty and render them and some additional HTML if they are NOT empty, and not render them, and additional HTML, if all the fields in the group are empty.

I'm not sure of the syntax to test if field groups contents are NULL, any pointers there?

So far this still isn't working for me. I have a field group that I know is empty group_factory_images

When trying to use the code from the answer:

&lt;?php if(!isset($node-&gt;group_factory_images))
print 'Yep, Empty';
?&gt;


It just prints the "Yep, Empty" string.
For example:


I created content type
In display settings for Full content display created group group_mygroup


If group elements are empty then group wil not be displaying. In this case you should check it:

//if node's group_mygroup does not exist
//in our case it means that all elements in group are empty
if(!isset($node-&gt;group_mygroup))
        print 'Group elements are empty';
print render($content);


As you can read in node template help part - block of comments:

 * Other variables:
 * - $node: Full node object. Contains data that may not be safe.


Now, what you can do to understand solution more clearly:


Install Devel module



  Helper functions for Drupal developers and inquisitive admins. This
  module can print a summary of all database queries for each page
  request at the bottom of each page. The summary includes how many
  times each query was executed on a page (shouldn't run same query
  multiple times), and how long each query took (short is good - use
  cache for complex queries).



Somwhere in your template's code use
dpm($node);
Create content of your type and see how it is displaying. You should see same picture

Click on header of appeared block and you can see structure of node object



If you want to check if some field doesnt exist - use same construction:

if(!isset($node-&gt;field_name))
print 'Field is empty';