node_form_buttons.inc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * @file
  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 submit buttons'),
  11. 'description' => t('Submit buttons for the node form.'),
  12. 'required context' => new ctools_context_required(t('Form'), 'node_form'),
  13. 'category' => t('Form'),
  14. );
  15. function ctools_node_form_buttons_content_type_render($subtype, $conf, $panel_args, &$context) {
  16. $block = new stdClass();
  17. $block->module = 'node_form';
  18. $block->title = '';
  19. $block->delta = 'buttons';
  20. if (isset($context->form)) {
  21. $block->content = array();
  22. foreach (array('actions', 'form_token', 'form_build_id', 'form_id') as $element) {
  23. $block->content[$element] = isset($context->form[$element]) ? $context->form[$element] : NULL;
  24. unset($context->form[$element]);
  25. }
  26. }
  27. else {
  28. $block->content = t('Node form buttons.');
  29. }
  30. return $block;
  31. }
  32. function ctools_node_form_buttons_content_type_admin_title($subtype, $conf, $context) {
  33. return t('"@s" node form submit buttons', array('@s' => $context->identifier));
  34. }
  35. function ctools_node_form_buttons_content_type_edit_form($form, &$form_state) {
  36. // Provide a blank form so we have a place to have context setting.
  37. return $form;
  38. }