Search code examples
drupal-7drupal-theming

Invoke a block from a template file with arguments


I have written a custom module which creates a block. I invoke the block from a template file using the following code.

$block = module_invoke('my_mod', 'block_view', 'block_1a', $an_argument);
print $block['content'];  

I need to access $an_argument in the module when the block is created.

How can I access the argument I pass to the block when it's invoked?


Solution

  • I believe you would have to implement the hook_block_view to handle your argument.

    The api docs for hook_block_view