1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
*/
|
6
|
|
7
|
if (module_exists('book')) {
|
8
|
/**
|
9
|
* Plugins are described by creating a $plugin array which will be used
|
10
|
* by the system that includes this file.
|
11
|
*/
|
12
|
$plugin = array(
|
13
|
'single' => TRUE,
|
14
|
'title' => t('Book children'),
|
15
|
'icon' => 'icon_node.png',
|
16
|
'description' => t('The children menu the book the node belongs to.'),
|
17
|
'required context' => new ctools_context_required(t('Node'), 'node'),
|
18
|
'category' => t('Node'),
|
19
|
);
|
20
|
}
|
21
|
|
22
|
function ctools_node_book_children_content_type_render($subtype, $conf, $panel_args, $context) {
|
23
|
$node = isset($context->data) ? clone $context->data : NULL;
|
24
|
$block = new stdClass();
|
25
|
$block->module = 'book_children';
|
26
|
|
27
|
$block->title = t('Book children');
|
28
|
if ($node) {
|
29
|
$block->content = isset($node->book) ? book_children($node->book) : '';
|
30
|
$block->delta = $node->nid;
|
31
|
}
|
32
|
else {
|
33
|
$block->content = t('Book children menu goes here.');
|
34
|
$block->delta = 'unknown';
|
35
|
}
|
36
|
|
37
|
return $block;
|
38
|
}
|
39
|
|
40
|
function ctools_node_book_children_content_type_admin_title($subtype, $conf, $context) {
|
41
|
return t('"@s" book children', array('@s' => $context->identifier));
|
42
|
}
|
43
|
|
44
|
function ctools_node_book_children_content_type_edit_form($form, &$form_state) {
|
45
|
// Provide a blank form so we have a place to have context setting.
|
46
|
return $form;
|
47
|
}
|