Add class to template based on boolean field I want to add a class to my custom Display Suite template if a boolean field is checked on the form. I have the following code:

if (isset($node-&gt;field_boolean_field[LANGUAGE_NONE][0]['value']) == 1 ) :
    $class = 'this-is-the-class';
endif;


And then in the appropriate place:

&lt;a href="#" class="&lt;?php print $class ?&gt;"&gt;link&lt;/a&gt;


This always returns the class regardless of whether the boolean field is checked or not though.

&lt;a href="#" class="this-is-the-class"&gt;link&lt;/a&gt;


Any thoughts on what I could be doing wrong here?

Many thanks
You have written wrong logic in if statement. Correct way is following:

 $class = NULL;
 if (isset($node-&gt;field_boolean_field[LANGUAGE_NONE][0]['value']) &amp;&amp; $node-&gt;field_boolean_field[LANGUAGE_NONE][0]['value'] == 1 ) :
        $class = 'this-is-the-class';
 endif;