You are here

function civicrm_entity_rules_action_info in CiviCRM Entity 7.2

Same name and namespace in other branches
  1. 7 civicrm_entity.rules.inc \civicrm_entity_rules_action_info()

Implements hook_rules_action_info().

See also

http://drupalcontrib.org/api/drupal/contributions!rules!rules.api.php/fu...

File

./civicrm_entity.rules.inc, line 329
Implement Drupal Rules integration for CiviCRM

Code

function civicrm_entity_rules_action_info() {
  $actions = array(
    'civicrm_entity_action_load_user' => array(
      'label' => t('Load Drupal User Account'),
      'module' => 'civicrm',
      'access_callback' => '_civicrm_entity_rules_access',
      'parameter' => array(
        'civicrm_contact' => array(
          'label' => t('CiviCRM Contact'),
          'type' => 'civicrm_contact',
        ),
      ),
      'provides' => array(
        'civicrm_user' => array(
          'label' => t('Loaded Drupal User'),
          'type' => 'user',
        ),
      ),
      'group' => t('CiviCRM'),
      'access callback' => '_civicrm_entity_rules_access',
      'base' => 'civicrm_entity_action_load_user',
    ),
    'civicrm_entity_action_create_user' => array(
      'label' => t('Create Linked Drupal User Account'),
      'module' => 'civicrm',
      'access_callback' => '_civicrm_entity_rules_access',
      'parameter' => array(
        'civicrm_contact' => array(
          'label' => t('CiviCRM Contact'),
          'type' => 'civicrm_contact',
        ),
        'is_active' => array(
          'label' => t('Activate Account'),
          'type' => 'boolean',
          'default' => 1,
        ),
        'notify' => array(
          'label' => t('Send account notification email'),
          'type' => 'boolean',
          'default' => 1,
        ),
        'signin' => array(
          'label' => t('Instant signin'),
          'type' => 'boolean',
          'default' => FALSE,
          'description' => t('Automatically log in as the created user.'),
        ),
        'username_format' => array(
          'label' => t('Username Format'),
          'type' => 'text',
          'default' => 'first last',
          'options list' => '_civicrm_entity_options_username_format',
          'description' => t('Preferred username format'),
        ),
      ),
      'provides' => array(
        'civicrm_user' => array(
          'label' => t('Created Drupal User'),
          'type' => 'user',
        ),
      ),
      'group' => t('CiviCRM'),
      'base' => 'civicrm_entity_action_create_user',
    ),
    'civicrm_entity_action_load_create_user' => array(
      'label' => t('Create or Load Linked Drupal User Account'),
      'module' => 'civicrm',
      'access_callback' => '_civicrm_entity_rules_access',
      'parameter' => array(
        'civicrm_contact' => array(
          'label' => t('CiviCRM Contact'),
          'type' => 'civicrm_contact',
        ),
        'is_active' => array(
          'label' => t('Activate Account'),
          'type' => 'boolean',
          'default' => 1,
        ),
        'notify' => array(
          'label' => t('Send account notification email'),
          'type' => 'boolean',
          'default' => 1,
        ),
      ),
      'provides' => array(
        'civicrm_user' => array(
          'label' => t('Created or Loaded Drupal User'),
          'type' => 'user',
        ),
      ),
      'group' => t('CiviCRM'),
      'base' => 'civicrm_entity_action_load_create_user',
    ),
    'civicrm_entity_query' => array(
      'label' => t('Fetch CiviCRM entity by property'),
      'module' => 'civicrm',
      'access_callback' => '_civicrm_entity_rules_access',
      'parameter' => array(
        'type' => array(
          'type' => 'text',
          'label' => t('CiviCRM Entity type'),
          'options list' => '_civicrm_entity_enabled_entities',
          'description' => t('Specifies the type of CiviCRM entity that should be fetched.'),
          'restriction' => 'input',
        ),
        'property' => array(
          'type' => 'text',
          'label' => t('Property'),
          'description' => t('The property by which the entity is to be selected.'),
          'restriction' => 'input',
        ),
        'value' => array(
          'type' => 'unknown',
          'label' => t('Value'),
          'description' => t('The property value of the entity to be fetched.'),
        ),
        'limit' => array(
          'type' => 'integer',
          'label' => t('Limit result count'),
          'description' => t('Limit the maximum number of fetched entities.'),
          'optional' => TRUE,
          'default value' => '10',
        ),
      ),
      'group' => t('CiviCRM'),
      'callbacks' => array(
        'form_alter' => 'rules_action_type_form_alter',
      ),
      'provides' => array(
        'entity_fetched' => array(
          'type' => 'list',
          'label' => t('Fetched CiviCRM entity list'),
        ),
      ),
      'base' => 'civicrm_entity_query',
    ),
    'civicrm_entity_action_load_create_contact' => array(
      'label' => t('Create or Load Linked CiviCRM Contact'),
      'module' => 'civicrm',
      'access_callback' => '_civicrm_entity_rules_access',
      'parameter' => array(
        'user' => array(
          'label' => t('Drupal User'),
          'type' => 'user',
        ),
        'email' => array(
          'label' => t('email'),
          'type' => 'email',
          'optional' => TRUE,
        ),
      ),
      'provides' => array(
        'civicrm_contact' => array(
          'label' => t('Created or Loaded CiviCRM Contact'),
          'type' => 'civicrm_contact',
        ),
      ),
      'group' => t('CiviCRM'),
      'base' => 'civicrm_entity_action_load_create_contact',
    ),
  );
  $actions['civicrm_entity_contact_get_email'] = array(
    'group' => t('CiviCRM'),
    'label' => t('CiviCRM Contact get Email'),
    'module' => 'civicrm',
    'access_callback' => '_civicrm_entity_rules_access',
    'parameter' => array(
      'contact' => array(
        'type' => 'civicrm_contact',
        'label' => t('CiviCRM Contact'),
        'description' => t('The CiviCRM Contact to fetch for'),
      ),
      'location' => array(
        'type' => 'integer',
        'label' => t('Location'),
        'description' => t('The property by which the entity is to be selected.'),
        'options list' => 'civicrm_entity_get_locations',
      ),
    ),
    'provides' => array(
      'fetched_email' => array(
        'type' => 'text',
        'label' => t('Email'),
      ),
    ),
    'base' => 'civicrm_entity_contact_get_email',
  );
  $actions['civicrm_entity_contact_send_email'] = array(
    'group' => t('CiviCRM'),
    'label' => t('CiviCRM Contact Send Email'),
    'module' => 'civicrm',
    'access_callback' => '_civicrm_entity_rules_access',
    'parameter' => array(
      'contact' => array(
        'type' => 'civicrm_contact',
        'label' => t('CiviCRM Contact'),
        'description' => t('The CiviCRM Contact to email'),
      ),
      'subject' => array(
        'type' => 'text',
        'label' => t('Subject'),
        'description' => t("The mail\\'s subject."),
      ),
      'message_text' => array(
        'type' => 'text',
        'label' => t('Message'),
        'description' => t("The mail\\'s message body - text version."),
        'optional' => TRUE,
      ),
      'message_html' => array(
        'type' => 'text',
        'label' => t('Message'),
        'description' => t("The mail\\'s message body - html version."),
        'optional' => TRUE,
      ),
      'from' => array(
        'type' => 'text',
        'label' => t('From'),
        'description' => t("The mail's from address. Leave it empty to use the site-wide configured address."),
        'optional' => TRUE,
      ),
    ),
    'base' => 'civicrm_entity_contact_send_email',
  );
  $actions['civicrm_entity_rules_action_assign_contact_to_group'] = array(
    'label' => t('Assign CiviCRM Contact to Group'),
    'group' => t('CiviCRM Contact'),
    'parameter' => array(
      'contact' => array(
        'type' => 'civicrm_contact',
        'label' => t('CiviCRM Contact'),
        'description' => t('CiviCRM Contact entity'),
        'wrapped' => TRUE,
      ),
      'group_id' => array(
        'type' => 'list<text>',
        'label' => t('CiviCRM Group'),
        'description' => t('Choose a group(s) to assign the contact to.'),
        'options list' => 'civicrm_entity_rules_assign_contact_group_options_list',
      ),
    ),
  );
  $actions['civicrm_entity_rules_action_unassign_contact_to_group'] = array(
    'label' => t('Unassign CiviCRM Contact from Group'),
    'group' => t('CiviCRM Contact'),
    'parameter' => array(
      'contact' => array(
        'type' => 'civicrm_contact',
        'label' => t('CiviCRM Contact'),
        'description' => t('CiviCRM Contact entity'),
        'wrapped' => TRUE,
      ),
      'group_id' => array(
        'type' => 'list<text>',
        'label' => t('CiviCRM Group'),
        'description' => t('Choose a group(s) to unassign the contact from.'),
        'options list' => 'civicrm_entity_rules_assign_contact_group_options_list',
      ),
    ),
  );
  return $actions;
}