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 navigation pager'),
|
15
|
'icon' => drupal_get_path('module', 'ctools') . '/plugins/content_types/block/icon_core_booknavigation.png',
|
16
|
'description' => t('The navigational pager and sub pages of the current book node.'),
|
17
|
'required context' => new ctools_context_required(t('Node'), 'node'),
|
18
|
'category' => t('Node'),
|
19
|
);
|
20
|
}
|
21
|
|
22
|
function ctools_node_book_nav_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_nav';
|
26
|
|
27
|
$block->title = t('Book navigation pager');
|
28
|
if ($node) {
|
29
|
$block->content = isset($node->book) ? theme('book_navigation', array('book_link' => $node->book)) : '';
|
30
|
$block->delta = $node->nid;
|
31
|
}
|
32
|
else {
|
33
|
$block->content = t('Book navigation pager goes here.');
|
34
|
$block->delta = 'unknown';
|
35
|
}
|
36
|
|
37
|
return $block;
|
38
|
}
|
39
|
|
40
|
function ctools_node_book_nav_content_type_admin_title($subtype, $conf, $context) {
|
41
|
return t('"@s" book navigation pager', array('@s' => $context->identifier));
|
42
|
}
|
43
|
|
44
|
function ctools_node_book_nav_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
|
}
|