You are here

function commerce_recurring_rules_event_info in Commerce Recurring Framework 7

Same name and namespace in other branches
  1. 7.2 commerce_recurring.rules.inc \commerce_recurring_rules_event_info()

Implements hook_rules_event_info().

File

./commerce_recurring.rules.inc, line 42

Code

function commerce_recurring_rules_event_info() {
  $events = array();

  // So that we can use the entity_rules_events_variables() helper function.
  module_load_include('inc', 'entity', 'entity.rules');
  $events['commerce_recurring_rules_event_new_order'] = array(
    'label' => t('A new recurring order is created'),
    'variables' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Created order', array(), array(
          'context' => 'a drupal commerce order',
        )),
      ),
    ),
    'group' => t('Commerce Recurring'),
    'access' => 'commerce_order_rules_access',
  );
  $events['commerce_recurring_rules_event_failed_payment'] = array(
    'label' => t('A payment fails for a recurring order'),
    'variables' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Processed order', array(), array(
          'context' => 'a drupal commerce order',
        )),
      ),
    ),
    'group' => t('Commerce Recurring'),
    'access' => 'commerce_order_rules_access',
  );
  $variables = array_merge(entity_rules_events_variables('commerce_order', t('Order', array(), array(
    'context' => 'a drupal commerce order',
  )), TRUE, TRUE), entity_rules_events_variables('commerce_payment_transaction', t('Last completed transaction'), TRUE));
  $events['commerce_recurring_rules_event_new_payment'] = array(
    'label' => t('A new recurring order payment created'),
    'variables' => $variables,
    'group' => t('Commerce Recurring'),
    'access' => 'commerce_payment_rules_access',
  );
  $events['commerce_recurring_rules_event_initialise_order'] = array(
    'label' => t('An order is initialised as a recurring set master'),
    'variables' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Created order', array(), array(
          'context' => 'a drupal commerce order',
        )),
      ),
    ),
    'group' => t('Commerce Recurring'),
    'access' => 'commerce_order_rules_access',
  );
  return $events;
}