node_form_comment.inc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. if (module_exists('comment')) {
  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 comment settings'),
  11. 'description' => t('Comment settings on the Node form.'),
  12. 'required context' => new ctools_context_required(t('Form'), 'node_form'),
  13. 'category' => t('Form'),
  14. );
  15. }
  16. function ctools_node_form_comment_content_type_render($subtype, $conf, $panel_args, &$context) {
  17. $block = new stdClass();
  18. $block->module = t('node_form');
  19. $block->title = t('Comment options');
  20. $block->delta = 'comment-options';
  21. if (isset($context->form)) {
  22. if (isset($context->form['comment_settings'])) {
  23. $block->content['comment_settings'] = $context->form['comment_settings'];
  24. unset($block->content['comment_settings']['#pre_render']);
  25. unset($block->content['comment_settings']['#theme_wrappers']);
  26. $block->content['comment_settings']['#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['comment_settings']['#access'] = FALSE;
  30. }
  31. }
  32. else {
  33. $block->content = t('Comment options.');
  34. }
  35. return $block;
  36. }
  37. function ctools_node_form_comment_content_type_admin_title($subtype, $conf, $context) {
  38. return t('"@s" node form comment settings', array('@s' => $context->identifier));
  39. }
  40. function ctools_node_form_comment_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. }