How to display a block if a Boolean on/off checkbox is checked? I will eventually install Panels to accomplish this. But I can't at this time. I want to allow an editor to display a right sidebar menu on any page when they want by checking a Single on/off checkbox . I added a CCK field to the Page type - Boolean -Single on/off checkbox. I am using Drupal 7.43 on Centos 7 and php 5.4 

There is a php block invoke inside another php that checks if a cck field is not null. The first php is looking at the Boolean field  'field_hide_sidebar_menu' to see if it is null or not checked. If it is null it will display the block. This is not working. I have used 'if!empty' 
before to check if an image field is null and it works. Now I want it to check if the Boolean is checked or not checked so do I need to write this 
in a different way to check if the Boolean value is on or off - equal to 1 or equal to 0. Here is my code:

&lt;?php if (!empty($entity['field_hide_sidebar_menu'])): ?&gt; &lt;div id="myclass"&gt;
&lt;h2&gt;Menu&lt;/h2&gt; &lt;?php $block = module_invoke('views', 'block_view',
'menu_sidebar-block_1'); print render($block['content']);?&gt;&lt;/div&gt;&lt;?php
 endif; ?&gt;
Generally, if you're wanting to enable or disable a block based on some parameters (and assuming this block is defined within a module of your writing), you'd use hook_block_list_alter(), test for your condition, and then either display or hide your block.

You can see how this works by look at the block module's implementation of it's own hook, block_block_list_alter().

For instance, if you wanted to hide something based on the current node:

MYMODULE_block_list_alter(&amp;$blocks) {
    $node = menu_get_object();
    $my_hiding_condition = isset($node-&gt;somefield[LANGUAGE_NONE][0]['value']) 
      &amp;&amp; $node-&gt;somefield[LANGUAGE_NONE][0]['value'] == TRUE;
    if (isset($blocks['my_block_id']) &amp;&amp; $my_hiding_condition == TRUE) {
        // Hide the block.
        unset($blocks['my_block_id']);
    }
}