function civicrm_entity_rules_condition_info in CiviCRM Entity 7.2
Same name and namespace in other branches
- 7 civicrm_entity.rules.inc \civicrm_entity_rules_condition_info()
Implements hook_rules_condition_info().
@TODO I don't think the provides array is supported for conditions? Remove.
File
- ./
civicrm_entity.rules.inc, line 129 - Implement Drupal Rules integration for CiviCRM
Code
function civicrm_entity_rules_condition_info() {
$conditions = array(
'civicrm_entity_user_exists' => array(
'label' => t('Drupal User Account exists for Contact'),
'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('Drupal User'),
'type' => 'user',
),
),
'group' => t('CiviCRM'),
),
'civicrm_entity_user_creatable' => array(
'label' => t('Drupal User Account can be created for user (this condition creates the user)'),
'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.'),
),
),
'provides' => array(
'civicrm_user' => array(
'label' => t('Drupal User'),
'type' => 'user',
),
),
'group' => t('CiviCRM'),
),
'civicrm_entity_user_exists_or_creatable' => array(
'label' => t('Drupal User Account exists or can be created for user'),
'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('Drupal User'),
'type' => 'user',
),
),
'group' => t('CiviCRM'),
),
'civicrm_entity_query' => array(
'label' => t('Can 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 (being ignored?)'),
),
),
'base' => 'civicrm_entity_query',
),
);
//@todo add phone as an entity & add it here, also - I had to remove address as II was less sure about the right approach as I went along
foreach (array(
'email',
) as $address_entity) {
$conditions['civicrm_entity_contact_has' . $address_entity] = array(
'group' => t('CiviCRM'),
'label' => t('CiviCRM Contact has ' . ucfirst($address_entity)),
'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(
'created_' . $address_entity => array(
'type' => 'civicrm_' . $address_entity,
'label' => t('CiviCRM ' . ucfirst($address_entity)),
),
),
'base' => 'civicrm_entity_contact_has_location_element_' . $address_entity,
);
}
// Is contact in group condition
$conditions['civicrm_entity_contact_is_in_group'] = array(
'label' => t('CiviCRM Contact is in Group'),
'access_callback' => '_civicrm_entity_rules_access',
'parameter' => array(
'civicrm_contact' => array(
'label' => t('CiviCRM Contact'),
'type' => 'civicrm_contact',
),
'group_id' => array(
'type' => 'text',
'label' => t('Group'),
'options list' => 'civicrm_entity_rules_assign_contact_group_options_list',
'description' => t('Select the CiviCRM group'),
'restriction' => 'input',
),
),
'provides' => array(
'civicrm_group' => array(
'label' => t('CiviCRM Group'),
'type' => 'civicrm_group',
),
),
'group' => t('CiviCRM'),
);
$conditions['civicrm_entity_contact_is_subtype'] = array(
'label' => t('CiviCRM Contact is of subtype'),
'access_callback' => '_civicrm_entity_rules_access',
'parameter' => array(
'civicrm_contact' => array(
'label' => t('CiviCRM Contact'),
'type' => 'civicrm_contact',
),
'contact_subtype' => array(
'type' => 'text',
'label' => t('Contact Sub Type'),
'options list' => 'civicrm_entity_rules_contact_subtype_options_list',
'description' => t('Select the Contact Sub Type'),
'restriction' => 'input',
),
),
'group' => t('CiviCRM'),
);
return $conditions;
}