node_add.inc 805 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @file
  4. *
  5. * Plugin to provide an argument handler for a Node add form
  6. */
  7. /**
  8. * Plugins are described by creating a $plugin array which will be used
  9. * by the system that includes this file.
  10. */
  11. $plugin = array(
  12. 'title' => t("Node add form: node type"),
  13. // keyword to use for %substitution
  14. 'keyword' => 'node_type',
  15. 'description' => t('Creates a node add form context from a node type argument.'),
  16. 'context' => 'ctools_node_add_context',
  17. );
  18. /**
  19. * Discover if this argument gives us the node we crave.
  20. */
  21. function ctools_node_add_context($arg = NULL, $conf = NULL, $empty = FALSE) {
  22. // If unset it wants a generic, unfilled context.
  23. if (!isset($arg)) {
  24. return ctools_context_create_empty('node_add_form');
  25. }
  26. return ctools_context_create('node_add_form', $arg);
  27. }