I had a unique requirement to show a block on the page only if the page url has arguments, after much of research I found out the following method to customize the block.
- In admin->structure blocks restrict your block for the required page
- In your custom module implement hook_block_list_alter()
- Unset the block content if argument does not match
/** * Implements hook_block_list_alter(). */ function mymodule_list_alter(&$blocks) { foreach($blocks as $key => $block) { if ($block->module == 'custom_block'){ if (!isset($_GET['parmeter'])) { unset($blocks[$key]); } } } }
Hope this helps.