node_book_nav.inc 1.3 KB

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