2 * Implements hook_block_list_alter().
4 function {{ machine_name }}_block_list_alter(&$blocks) {
5 global $language, $theme_key;
7 // This example shows how to achieve language specific visibility setting for
10 $result = db_query('SELECT module, delta, language FROM {my_table}');
11 $block_languages = array();
12 foreach ($result as $record) {
13 $block_languages[$record->module][$record->delta][$record->language] = TRUE;
16 foreach ($blocks as $key => $block) {
17 // Any module using this alter should inspect the data before changing it,
18 // to ensure it is what they expect.
19 if (!isset($block->theme) || !isset($block->status) || $block->theme != $theme_key || $block->status != 1) {
20 // This block was added by a contrib module, leave it in the list.
24 if (!isset($block_languages[$block->module][$block->delta])) {
25 // No language setting for this block, leave it in the list.
29 if (!isset($block_languages[$block->module][$block->delta][$language->language])) {
30 // This block should not be displayed with the active language, remove