tmgmt_ui.rules.inc 971 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @file
  4. * Rules integration.
  5. */
  6. /**
  7. * {@inheritdoc}
  8. */
  9. function tmgmt_ui_rules_action_info() {
  10. $info['tmgmt_ui_rules_source_add_item_to_cart'] = array(
  11. 'label' => t('Add to cart'),
  12. 'group' => t('Translation Management'),
  13. 'parameter' => array(
  14. 'plugin' => array(
  15. 'type' => 'token',
  16. 'label' => t('Source plugin'),
  17. 'description' => t('The source plugin of this item'),
  18. ),
  19. 'item_type' => array(
  20. 'type' => 'token',
  21. 'label' => t('Item type'),
  22. 'description' => t('The item type'),
  23. ),
  24. 'item_id' => array(
  25. 'type' => 'text',
  26. 'label' => t('Item ID'),
  27. 'description' => t('ID of the referenced item'),
  28. ),
  29. ),
  30. );
  31. return $info;
  32. }
  33. /**
  34. * Rules callback to add a job item into the cart.
  35. */
  36. function tmgmt_ui_rules_source_add_item_to_cart($plugin, $item_type, $item_id) {
  37. tmgmt_ui_cart_get()->addJobItem($plugin, $item_type, $item_id);
  38. }