user_edit.inc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * @file
  4. *
  5. * Plugin to provide an argument handler for a Taxonomy term
  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("User edit form: User ID"),
  13. // keyword to use for %substitution
  14. 'keyword' => 'user',
  15. 'description' => t('Creates a user edit form context from a user ID argument.'),
  16. 'context' => 'ctools_user_edit_context',
  17. 'placeholder form' => array(
  18. '#type' => 'textfield',
  19. '#description' => t('Enter the user ID for this argument.'),
  20. ),
  21. );
  22. /**
  23. * Discover if this argument gives us the term we crave.
  24. */
  25. function ctools_user_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) {
  26. // If unset it wants a generic, unfilled context.
  27. if ($empty) {
  28. return ctools_context_create_empty('user_edit_form');
  29. }
  30. if(is_object($arg)){
  31. return ctools_context_create('user_edit_form', $arg);
  32. }
  33. if (!is_numeric($arg)) {
  34. return FALSE;
  35. }
  36. $account= user_load($arg);
  37. if (!$account) {
  38. return NULL;
  39. }
  40. // This will perform a node_access check, so we don't have to.
  41. return ctools_context_create('user_edit_form', $account);
  42. }