node_book_nav.inc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * @file
  4. */
  5. if (module_exists('book')) {
  6. /**
  7. * Plugins are described by creating a $plugin array which will be used
  8. * by the system that includes this file.
  9. */
  10. $plugin = array(
  11. 'single' => TRUE,
  12. 'title' => t('Book navigation pager'),
  13. 'icon' => drupal_get_path('module', 'ctools') . '/plugins/content_types/block/icon_core_booknavigation.png',
  14. 'description' => t('The navigational pager and sub pages of the current book node.'),
  15. 'required context' => new ctools_context_required(t('Node'), 'node'),
  16. 'category' => t('Node'),
  17. );
  18. }
  19. function ctools_node_book_nav_content_type_render($subtype, $conf, $panel_args, $context) {
  20. $node = isset($context->data) ? clone $context->data : NULL;
  21. $block = new stdClass();
  22. $block->module = 'book_nav';
  23. $block->title = t('Book navigation pager');
  24. if ($node) {
  25. $block->content = isset($node->book) ? theme('book_navigation', array('book_link' => $node->book)) : '';
  26. $block->delta = $node->nid;
  27. }
  28. else {
  29. $block->content = t('Book navigation pager goes here.');
  30. $block->delta = 'unknown';
  31. }
  32. return $block;
  33. }
  34. function ctools_node_book_nav_content_type_admin_title($subtype, $conf, $context) {
  35. return t('"@s" book navigation pager', array('@s' => $context->identifier));
  36. }
  37. function ctools_node_book_nav_content_type_edit_form($form, &$form_state) {
  38. // Provide a blank form so we have a place to have context setting.
  39. return $form;
  40. }