0

I'm using the Feedback module on my Drupal 6 but I found out a strange behaviour about its block's visibility.

The module appeared even if the block was in the disabled region, not assigned to any site space, and moreover it still appears even if I set for example a PHP code which returns false, or if I set it to appear only on listed pages without giving it any valid page.

If I move the block to different regions it still appears on the bottom right corner, so I have no control on how it works.

Am I missing something or is it a wanted feature of the Feedback block to be always there?

1 Answer 1

1

Wow. It's pretty snarky, for no better word, and does the following...

/**
 * Implementation of hook_footer().
 */
function feedback_footer($main = 0) {
  if (user_access('access feedback form') && $_GET['q'] != 'admin/reports/feedback') {
    $block = (object)module_invoke('feedback', 'block', 'view', 'form');
    $block->module = 'feedback';
    $block->delta = 'form';
    $block->region = 'footer';
    return theme('block', $block);
  }
}

...which basically puts it on every page except admin/reports/feedback by stuffing the form into page.tpl's $closure variable.

So, yes, it does appear to ignore standard block visibility rules somewhat on purpose.

3
  • Thanks... so this is the point in the code where I have to insert my logic for excluding it from some pages, isn't it? :)
    – Frhay
    Commented Apr 16, 2013 at 15:02
  • either here, or do some fancy editing of $closure in your theme's preprocess_page() hook. both aren't pretty.
    – Jimajamma
    Commented Apr 16, 2013 at 15:26
  • ACTUALLY... probably the best thing to do so you aren't 'hacking core' is to copy block.tpl.php to your theme (if not there already) and then create a block-footer-feedback-form.tpl.php that does the logic there (or in a preprocess_block hook) and returns nothing on the pages you don't want to see it on. More info on template suggestions here: drupal.org/node/1089642
    – Jimajamma
    Commented Apr 16, 2013 at 15:31

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.