1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Provide test blocks.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_system_theme_info().
|
10
|
*/
|
11
|
function block_test_system_theme_info() {
|
12
|
$themes['block_test_theme'] = drupal_get_path('module', 'block_test') . '/themes/block_test_theme/block_test_theme.info';
|
13
|
return $themes;
|
14
|
}
|
15
|
|
16
|
/**
|
17
|
* Implements hook_block_info().
|
18
|
*/
|
19
|
function block_test_block_info() {
|
20
|
$blocks['test_cache'] = array(
|
21
|
'info' => t('Test block caching'),
|
22
|
'cache' => variable_get('block_test_caching', DRUPAL_CACHE_PER_ROLE),
|
23
|
);
|
24
|
|
25
|
$blocks['test_underscore'] = array(
|
26
|
'info' => t('Test underscore'),
|
27
|
);
|
28
|
|
29
|
$blocks['test-hyphen'] = array(
|
30
|
'info' => t('Test hyphen'),
|
31
|
);
|
32
|
|
33
|
$blocks['test_html_id'] = array(
|
34
|
'info' => t('Test block html id'),
|
35
|
);
|
36
|
return $blocks;
|
37
|
}
|
38
|
|
39
|
/**
|
40
|
* Implements hook_block_view().
|
41
|
*/
|
42
|
function block_test_block_view($delta = 0) {
|
43
|
return array('content' => variable_get('block_test_content', ''));
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
* Implements hook_block_view_MODULE_DELTA_alter().
|
48
|
*/
|
49
|
function block_test_block_view_block_test_test_underscore_alter(&$data, $block) {
|
50
|
$data['content'] = 'hook_block_view_MODULE_DELTA_alter';
|
51
|
}
|
52
|
|
53
|
/**
|
54
|
* Implements hook_block_view_MODULE_DELTA_alter().
|
55
|
*/
|
56
|
function block_test_block_view_block_test_test_hyphen_alter(&$data, $block) {
|
57
|
$data['content'] = 'hook_block_view_MODULE_DELTA_alter';
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* Implements hook_block_info_alter().
|
62
|
*/
|
63
|
function block_test_block_info_alter(&$blocks) {
|
64
|
if (variable_get('block_test_info_alter')) {
|
65
|
$blocks['block_test']['test_html_id']['weight'] = 10000;
|
66
|
}
|
67
|
}
|