-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlwcustom.module
More file actions
48 lines (37 loc) · 977 Bytes
/
lwcustom.module
File metadata and controls
48 lines (37 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
function lwcustom_block_info() {
$blocks = [];
$blocks['lw_translations_toc'] = [
'info' => t('LW translations TOC'),
];
return $blocks;
}
function lwcustom_block_view($delta='') {
$block = [];
$books = [
285,
371,
382,
];
switch ($delta) {
case 'lw_translations_toc':
$block['content'] = [];
foreach ($books as $book_id) {
$book_node = node_load($book_id);
$tree = menu_tree_output(menu_tree_all_data(book_menu_name($book_id)));
if ($book_node->body) {
$description = [
'#type' => 'markup',
'#markup' => check_markup($book_node->body['und'][0]['value'], 'wikitypetext'),
];
reset($tree);
$tree_id = key($tree);
$inner_tree = &$tree[$tree_id];
$inner_tree['#below'] = [0 => $description] + $inner_tree['#below'];
}
$block['content'][] = $tree;
}
break;
}
return $block;
}