Programatically handle blocks from with Context API

Public

Programatically handle blocks from with Context API

</> CopyGet raw version
php
  1. // Add block in site-wide context.
  2. $context = module_invoke('context', 'load', 'site_wide');
  3.  
  4. $block_your-block-name = array(
  5. 'module' => 'menu',
  6. 'delta' => 'your-block-name',
  7. 'region' => 'header_top',
  8. 'weight' => -9,
  9. );
  10. $context->reactions['block']['blocks']['your-block-name'] = $your-block-name;
  11.  
  12. module_invoke('context', 'save', $context);