node_form_book.inc 1.5 KB

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