groups/modules/commons/commons_utility_links/commons_utility_links.install
Marton Kiss 8b1ae58755 Fix missing utility links block in the header
The patch 0001-utility-links-block-install-theme.patch must be applied
to contrib commons_utility_links module to allow block placement
into different theme region.

Change-Id: I5b26a4ffc0a20b9408b93018ac8d3c91b6a775fd
2014-06-12 19:38:16 +02:00

57 lines
1.5 KiB
Plaintext

<?php
/**
* @file
* Commons Utility Links install script.
*/
/**
* Implements hook_install().
*/
function commons_utility_links_install() {
cache_clear_all('*', 'cache_block', TRUE);
// Place site blocks in the menu_bar and header regions.
$utility_block = array(
'module' => 'commons_utility_links',
'delta' => 'commons_utility_links',
'theme' => 'openstack',
'visibility' => 0,
'region' => 'header',
'status' => 1,
'pages' => '0',
'cache' => DRUPAL_NO_CACHE,
'title' => '<none>',
);
drupal_write_record('block', $utility_block);
db_update('block')
->fields(array('region' => 'header'))
->fields(array('cache' => DRUPAL_NO_CACHE))
->condition('delta', 'commons_utility_links')
->condition('module', 'commons_utility_links')
->condition('theme', 'openstack')
->execute();
}
/**
* Remove utility_links block, and enable commons_utility_links, that never caches.
*/
function commons_utility_links_update_7301() {
db_delete('block')
->condition('module', 'commons_utility_links')
->condition('delta', 'utility_links')
->execute();
db_update('block')
->fields(array(
'cache' => DRUPAL_NO_CACHE,
'region' => 'header',
'status' => 1,
'title' => '<none>',
))
->condition('delta', 'commons_utility_links')
->condition('module', 'commons_utility_links')
->condition('theme', 'openstack')
->execute();
cache_clear_all('*', 'cache_block', TRUE);
}