Apercus des blocks selon les thèmes

block corpoc 7

 

bartik

adaptive

hook_block_info_alter() permet de configurer la visibilité par défaut "disable/move/change" des blocs :
function mymodule_block_info_alter(&$blocks, $theme, $code_blocks) {
  // move navigation to footer
  $blocks['system']['navigation']['region'] = 'footer';
  // disable the powered by drupal block and login block
  $blocks['system']['powered-by']['status'] = 0;
  $blocks['user']['login']['status'] = 0;
  // change the visibility to front page only
  $blocks['search']['form']['visibility'] = BLOCK_VISIBILITY_LISTED;
  $blocks['search']['form']['pages'] = '';
}

et pour modifier ses propres blocs:
/**
 * Implements hook_block_info().
 */
function mymodule_block_info() {
  $blocks = array();
  $blocks['mymodule_block_example'] = array(
    'info' => t('MyModule: Block example'),
    'status' => 1,
    'region' => 'header',
    'visibility' => BLOCK_VISIBILITY_LISTED,
    'pages' => '',
  );
  return $blocks;
}