node_add.inc 803 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @file
  4. * Plugin to provide an argument handler for a Node add form.
  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 add form: node type"),
  12. // Keyword to use for %substitution.
  13. 'keyword' => 'node_type',
  14. 'description' => t('Creates a node add form context from a node type argument.'),
  15. 'context' => 'ctools_node_add_context',
  16. );
  17. /**
  18. * Discover if this argument gives us the node we crave.
  19. */
  20. function ctools_node_add_context($arg = NULL, $conf = NULL, $empty = FALSE) {
  21. // If unset it wants a generic, unfilled context.
  22. if (!isset($arg)) {
  23. return ctools_context_create_empty('node_add_form');
  24. }
  25. return ctools_context_create('node_add_form', $arg);
  26. }