node_form_author.inc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Plugins are described by creating a $plugin array which will be used
  4. * by the system that includes this file.
  5. */
  6. $plugin = array(
  7. 'single' => TRUE,
  8. 'icon' => 'icon_node_form.png',
  9. 'title' => t('Node form author information'),
  10. 'description' => t('Author information on the Node form.'),
  11. 'required context' => new ctools_context_required(t('Form'), 'node_form'),
  12. 'category' => t('Form'),
  13. );
  14. function ctools_node_form_author_content_type_render($subtype, $conf, $panel_args, &$context) {
  15. $block = new stdClass();
  16. $block->module = t('node_form');
  17. $block->title = t('Authoring information');
  18. $block->delta = 'author-options';
  19. if (isset($context->form)) {
  20. if (!empty($context->form['author'])) {
  21. $block->content['author'] = $context->form['author'];
  22. if (isset($block->content['author']['#group'])) {
  23. unset($block->content['author']['#pre_render']);
  24. unset($block->content['author']['#theme_wrappers']);
  25. $block->content['author']['#type'] = '';
  26. $block->content['author']['name']['#size'] /= 2;
  27. $block->content['author']['date']['#size'] /= 2;
  28. }
  29. // Set access to false on the original rather than removing so that
  30. // vertical tabs doesn't clone it. I think this is due to references.
  31. $context->form['author']['#access'] = FALSE;
  32. }
  33. }
  34. else {
  35. $block->content = t('Authoring information.');
  36. }
  37. return $block;
  38. }
  39. function ctools_node_form_author_content_type_admin_title($subtype, $conf, $context) {
  40. return t('"@s" node form author information', array('@s' => $context->identifier));
  41. }
  42. function ctools_node_form_author_content_type_edit_form($form, &$form_state) {
  43. // provide a blank form so we have a place to have context setting.
  44. return $form;
  45. }