You are here

function organigrams_rules_event_info in Organigrams 7

Implements hook_rules_event_info().

File

./organigrams.rules.inc, line 23
Rules integration for the organigrams module.

Code

function organigrams_rules_event_info() {
  $defaults_organigrams_item = array(
    'group' => t('Organigrams'),
    'access callback' => 'rules_organigrams_item_integration_access',
    'module' => 'organigrams',
    'class' => 'RulesOrganigramsEventHandler',
  );
  $defaults_organigrams = array(
    'group' => t('Organigrams'),
    'access callback' => 'rules_organigrams_integration_access',
    'module' => 'organigrams',
  );
  return array(
    'organigrams_item_insert' => $defaults_organigrams_item + array(
      'label' => t('After saving a new organigrams item'),
      'variables' => array(
        'item' => array(
          'type' => 'organigrams_item',
          'label' => t('created organigrams item'),
        ),
      ),
    ),
    'organigrams_item_update' => $defaults_organigrams_item + array(
      'label' => t('After updating an existing organigrams item'),
      'variables' => array(
        'item' => array(
          'type' => 'organigrams_item',
          'label' => t('updated organigrams item'),
        ),
        'item_unchanged' => array(
          'type' => 'organigrams_item',
          'label' => t('unchanged organigrams item'),
          'handler' => 'rules_events_entity_unchanged',
        ),
      ),
    ),
    'organigrams_item_presave' => $defaults_organigrams_item + array(
      'label' => t('Before saving an organigrams item'),
      'variables' => array(
        'item' => array(
          'type' => 'organigrams_item',
          'label' => t('saved organigrams item'),
          'skip save' => TRUE,
        ),
        'item_unchanged' => array(
          'type' => 'organigrams_item',
          'label' => t('unchanged organigrams item'),
          'handler' => 'rules_events_entity_unchanged',
        ),
      ),
    ),
    'organigrams_item_delete' => $defaults_organigrams_item + array(
      'label' => t('After deleting an organigrams item'),
      'variables' => array(
        'item' => array(
          'type' => 'organigrams_item',
          'label' => t('deleted organigrams item'),
        ),
      ),
    ),
    'organigrams_insert' => $defaults_organigrams + array(
      'label' => t('After saving a new organigram'),
      'variables' => array(
        'organigrams' => array(
          'type' => 'organigrams',
          'label' => t('created organigram'),
        ),
      ),
    ),
    'organigrams_update' => $defaults_organigrams + array(
      'label' => t('After updating an existing organigram'),
      'variables' => array(
        'organigrams' => array(
          'type' => 'organigrams',
          'label' => t('updated organigram'),
        ),
        'organigrams_unchanged' => array(
          'type' => 'organigrams',
          'label' => t('unchanged organigram'),
          'handler' => 'rules_events_entity_unchanged',
        ),
      ),
    ),
    'organigrams_presave' => $defaults_organigrams + array(
      'label' => t('Before saving an organigram'),
      'variables' => array(
        'organigrams' => array(
          'type' => 'organigrams',
          'label' => t('saved organigram'),
          'skip save' => TRUE,
        ),
        'organigrams_unchanged' => array(
          'type' => 'organigrams',
          'label' => t('unchanged organigram'),
          'handler' => 'rules_events_entity_unchanged',
        ),
      ),
    ),
    'organigrams_delete' => $defaults_organigrams + array(
      'label' => t('After deleting an organigram'),
      'variables' => array(
        'organigrams' => array(
          'type' => 'organigrams',
          'label' => t('deleted organigram'),
        ),
      ),
    ),
  );
}