(How) can I define a block with arguments in Drupal?
I want to develop a module that defines a block which can be invoked with arguments —
for example, a block is an ad zone template and th开发者_运维问答e argument is which zone I would like to invoke.
I want to use a block because I am using the Panels module for my site and I am trying to avoid using the PHP filter in a custom panel.
I know I can do this with a theme function, but that doesn't solve my problem of avoiding the PHP filter in a custom panel. Can I do this with a block?
Most of the research I have done on this topic has led me to passing an argument to a views block, which I am not looking for.
The short answer is, no you can't (without php filter). You have to do a block for each zone and set up some selection (visibility) rules for your panels to chose a variant based on context.
Another way is to code your ad block (in php) and get the argument from the url (ie. arg(1) and so on). There are some issue with this approach anyway:
Passing Arguments to Mini-Panels
精彩评论