user_category_edit_form_from_user.inc 948 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('User category edit form from user'),
  12. 'keyword' => 'user_category_form',
  13. 'description' => t('Adds user category edit form from a user context.'),
  14. 'required context' => new ctools_context_required(t('User'), 'user'),
  15. 'context' => 'ctools_user_category_edit_form_from_user_context',
  16. );
  17. /**
  18. * Return a new context based on an existing context.
  19. */
  20. function ctools_user_category_edit_form_from_user_context($context, $conf) {
  21. if (empty($context->data)) {
  22. return ctools_context_create_empty('user_edit_form', NULL);
  23. }
  24. if (isset($context->data->user_category)) {
  25. return ctools_context_create('user_edit_form', $context->data, array('category' => $context->data->user_category));
  26. }
  27. }