1

Can we programmatically set the value of a block in drupal?? We could do that via the admin section, but I am looking to see if there is a way, where we could programmatically say that

if($block=="sidebar") {
// do this
}

I could then put this in a preprocess node hook or in a block hook.

apaderno
  • 28,547
  • 16
  • 75
  • 90
macha
  • 7,337
  • 19
  • 62
  • 84

1 Answers1

2

Have you tried using hook_block() and setting ($op = "view") ?!

More info here: http://api.drupal.org/api/drupal/developer%21hooks%21core.php/function/hook_block/6

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
  • but when I have a function mymodule_block, it is not being fired? Can we echo a statement and add an exit, to verify it the hook is firing? – macha Mar 13 '12 at 14:56
  • Kindly copy and paste the whole code in your hook implementation. I need to have a closer look. – Muhammad Reda Mar 13 '12 at 15:01