0

I have a custom template file for a boolean field with a checkbox within a content type. The checkbox values are ON for true and OFF for false. It works perfectly if the checkbox is checked. But if the checkbox is not checked the template will be ignored and the value OFF will be rendered plain into the node. How to get it to render the output with template or simply remove the output at all if checkbox is not checked?

4
  • Can you add the code which displays the field? You should be able to just check for a "0" value...
    – user5681
    Feb 18, 2013 at 23:45
  • its a boolean field with a checkbox without any additional code. the only thing i've changed are the values. the fields name is field_in_slideshow and the name of the file is field--field-in-slideshow--projects.tpl.php. the content of this file ist <?php foreach ($items as $delta => $item): ?><div class"in_slideshow"><?php print render($item); ?></div><?php endforeach; ?>.
    – rugar
    Feb 19, 2013 at 18:01
  • I use to add the same field when using a slideshow. I've since found its more useful to use the built-in flag "promote to front page". Would that get around your problem?
    – user5681
    Feb 19, 2013 at 21:49
  • Ya, i could use that. I've already decided to put it into a view block and load the images from there.
    – rugar
    Feb 20, 2013 at 20:42

0

Your Answer

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

Browse other questions tagged or ask your own question.