node_form_book.inc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. 'icon' => 'icon_node_form.png',
  13. 'title' => t('Node form book options'),
  14. 'description' => t('Book options for the node.'),
  15. 'required context' => new ctools_context_required(t('Form'), 'node_form'),
  16. 'category' => t('Form'),
  17. );
  18. }
  19. function ctools_node_form_book_content_type_render($subtype, $conf, $panel_args, &$context) {
  20. $block = new stdClass();
  21. $block->module = 'node_form';
  22. $block->title = t('Book outline');
  23. $block->delta = 'book-outline';
  24. if (isset($context->form)) {
  25. if (isset($context->form['book'])) {
  26. $block->content['book'] = $context->form['book'];
  27. unset($block->content['book']['#pre_render']);
  28. unset($block->content['book']['#theme_wrappers']);
  29. $block->content['book']['#type'] = '';
  30. // Set access to false on the original rather than removing so that
  31. // vertical tabs doesn't clone it. I think this is due to references.
  32. $context->form['book']['#access'] = FALSE;
  33. }
  34. }
  35. else {
  36. $block->content = t('Book options.');
  37. }
  38. return $block;
  39. }
  40. function ctools_node_form_book_content_type_admin_title($subtype, $conf, $context) {
  41. return t('"@s" node form book options', array('@s' => $context->identifier));
  42. }
  43. function ctools_node_form_book_content_type_edit_form($form, &$form_state) {
  44. // Provide a blank form so we have a place to have context setting.
  45. return $form;
  46. }