workflow_rules.field.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * @file
  4. * Rules integration for the Workflow module with Entity API.
  5. */
  6. if (module_exists('rules')) {
  7. require_once dirname(__FILE__) . '/workflow_rules.rules-callback.inc';
  8. }
  9. /**
  10. * Implements subfunction of hook_rules_condition_info().
  11. *
  12. * When using "node:" and "node:unchanged", there is no need to create more
  13. * conditions to check transitions.
  14. */
  15. // function workflowfield_rules_condition_info() {
  16. // }
  17. /**
  18. * Implements subfunction of hook_rules_action_info().
  19. */
  20. function _workflowfield_rules_action_info() {
  21. $actions = array();
  22. // Warning: keep this action in line between Workflow Field and Workflow Node.
  23. $actions['workflowfield_field_set_state'] = array(
  24. 'group' => t('Workflow'),
  25. 'label' => t('Set a Workflow state (with a comment)'),
  26. 'parameter' => array(
  27. // "parameter['node']" is for backwards compatibility: can be any entity_type.
  28. 'node' => array(
  29. 'type' => 'entity',
  30. 'label' => t('Entity'),
  31. 'description' => t('The entity to set the current workflow state of.'),
  32. // 'save' => TRUE,
  33. ),
  34. 'field' => array(
  35. 'type' => WORKFLOWFIELD_PROPERTY_TYPE,
  36. 'label' => t('Workflow field to set'),
  37. 'description' => t('The workflow field to set.'),
  38. 'restriction' => 'selector',
  39. // 'allow null' => TRUE,
  40. ),
  41. 'workflow_state' => array(
  42. 'type' => 'list<integer>',
  43. 'label' => t('New workflow state'),
  44. 'options list' => '_workflow_rules_workflow_get_options',
  45. 'description' => t('The workflow state to set (select only one).'),
  46. ),
  47. 'workflow_comment' => array(
  48. 'type' => 'text',
  49. 'label' => t('Workflow Comment'),
  50. 'description' => t('The workflow comment to set.'),
  51. 'optional' => TRUE,
  52. ),
  53. ),
  54. 'named parameter' => TRUE,
  55. 'base' => '_workflow_rules_set_state',
  56. 'callbacks' => array(
  57. 'execute' => '_workflow_rules_set_state',
  58. ),
  59. );
  60. return $actions;
  61. }