node_edit_form_from_node.inc 841 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @file
  4. * Plugin to provide an relationship handler for term from node.
  5. */
  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. 'title' => t('Node edit form from node'),
  12. 'keyword' => 'node_form',
  13. 'description' => t('Adds node edit form from a node context.'),
  14. 'required context' => new ctools_context_required(t('Node'), 'node'),
  15. 'context' => 'ctools_node_edit_form_from_node_context',
  16. );
  17. /**
  18. * Return a new context based on an existing context.
  19. */
  20. function ctools_node_edit_form_from_node_context($context, $conf) {
  21. if (empty($context->data)) {
  22. return ctools_context_create_empty('node_edit_form', NULL);
  23. }
  24. if (isset($context->data->nid)) {
  25. return ctools_context_create('node_edit_form', $context->data);
  26. }
  27. }