feedback.rules.inc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @file
  4. * Rules integration for feedback.
  5. *
  6. * @addtogroup rules
  7. * @{
  8. */
  9. /**
  10. * Implements hook_rules_event_info().
  11. */
  12. function feedback_rules_event_info() {
  13. $defaults = array(
  14. 'group' => t('Feedback'),
  15. 'module' => 'feedback',
  16. 'access callback' => 'feedback_rules_integration_access',
  17. );
  18. return array(
  19. 'feedback_insert' => $defaults + array(
  20. 'label' => t('After saving new feedback'),
  21. 'variables' => array(
  22. 'feedback' => array('type' => 'feedback', 'label' => t('Feedback message')),
  23. ),
  24. ),
  25. 'feedback_update' => $defaults + array(
  26. 'label' => t('After saving existing feedback'),
  27. 'variables' => array(
  28. 'feedback' => array(
  29. 'type' => 'feedback',
  30. 'label' => t('Feedback message'),
  31. ),
  32. 'feedback_unchanged' => array(
  33. 'type' => 'feedback',
  34. 'label' => t('unchanged feedback entity'),
  35. 'handler' => 'rules_events_entity_unchanged',
  36. ),
  37. ),
  38. ),
  39. );
  40. }
  41. /**
  42. * Rules integration access callback.
  43. */
  44. function feedback_rules_integration_access($type, $name) {
  45. if ($type == 'event' || $type == 'condition') {
  46. return entity_access('view', 'feedback');
  47. }
  48. }
  49. /**
  50. * @}
  51. */