--- blockterm_original.module 2011-06-24 01:31:54.000000000 -0700 +++ blockterm.module 2011-06-24 01:32:26.000000000 -0700 @@ -50,9 +50,15 @@ function _blockterm_form_alter(&$form, & '#collapsible' => TRUE, '#tree' => TRUE, ); - $blockterm = blockterm_get(); - + $form['block_settings']['blockterm']['enable_block_term'] = array( + '#type' => 'checkbox', + '#title' => t('Enable block taxonomy'), + '#description' => t('Check to activate this feature'), + '#default_value' => (isset($blockterm[$var_name]['enable_block_term']))?$blockterm[$var_name]['enable_block_term']:FALSE, + '#weight' => -10, + ); + foreach (taxonomy_get_vocabularies() as $vid => $vocab) { $vocab_select = taxonomy_form($vid); $vocab_select['#multiple'] = TRUE; @@ -62,6 +68,7 @@ function _blockterm_form_alter(&$form, & } $vocab_select['#default_value'] = $default_value; + $vocab_select['#weight'] = 0; $form['block_settings']['blockterm'][$vid] = $vocab_select; } $form['#submit'][] = 'blockterm_save'; @@ -107,23 +114,25 @@ function blockterm_save($form, &$form_st function blockterm_preprocess_block(&$variables) { $var_name = $variables['block']->module .'-'. $variables['block']->delta; $blockterm = blockterm_get(); - if (!isset($blockterm[$var_name])) { - //Nothing to do: This block has no blockterm variables set - return; - } - $hide = TRUE; - if ( arg(0) == 'node' && is_numeric(arg(1)) ) { - // Yes, we're viewing a node. - - $node = node_load(arg(1)); - foreach ($node->taxonomy as &$tax) { - if (_block_has_term($blockterm[$var_name], $tax)) { - $hide = FALSE; + if(isset($blockterm[$var_name]['enable_block_term']) && $blockterm[$var_name]['enable_block_term'] == 1) { + if (!isset($blockterm[$var_name])) { + //Nothing to do: This block has no blockterm variables set + return; + } + $hide = TRUE; + if ( arg(0) == 'node' && is_numeric(arg(1)) ) { + // Yes, we're viewing a node. + $node = node_load(arg(1)); + foreach ($node->taxonomy as &$tax) { + if (_block_has_term($blockterm[$var_name], $tax)) { + $hide = FALSE; + } } } - } - if ($hide) { - $variables['template_file'] = 'block-ignore'; + if($hide) { + //$variables['template_files'][] = 'block-ignore'; // Use template block-ignore.tpl.php to hide blocks + unset($variables['block']); // Unset block variable to hide block + } } }