function rules_entity_condition_info in Rules 7.2
Implements hook_rules_condition_info() on behalf of the entity module.
See also
Related topics
File
- modules/
entity.rules.inc, line 332 - General entity related rules integration.
Code
function rules_entity_condition_info() {
return array(
'entity_is_new' => array(
'label' => t('Entity is new'),
'parameter' => array(
'entity' => array(
'type' => 'entity',
'label' => t('Entity'),
'description' => t('Specifies the entity for which to evaluate the condition.'),
'restriction' => 'selector',
),
),
'group' => t('Entities'),
'base' => 'rules_condition_entity_is_new',
),
'entity_has_field' => array(
'label' => t('Entity has field'),
'parameter' => array(
'entity' => array(
'type' => 'entity',
'label' => t('Entity'),
'description' => t('Specifies the entity for which to evaluate the condition.'),
'restriction' => 'selector',
),
'field' => array(
'type' => 'text',
'label' => t('Field'),
'description' => t('The name of the field to check for.'),
'options list' => 'rules_condition_entity_has_field_options',
'restriction' => 'input',
),
),
'group' => t('Entities'),
'base' => 'rules_condition_entity_has_field',
),
'entity_is_of_type' => array(
'label' => t('Entity is of type'),
'parameter' => array(
'entity' => array(
'type' => 'entity',
'label' => t('Entity'),
'description' => t('Specifies the entity for which to evaluate the condition.'),
),
'type' => array(
'type' => 'token',
'label' => t('Entity type'),
'description' => t('The entity type to check for.'),
'options list' => 'rules_entity_action_type_options',
'restriction' => 'input',
),
),
'group' => t('Entities'),
'base' => 'rules_condition_entity_is_of_type',
),
'entity_is_of_bundle' => array(
'label' => t('Entity is of bundle'),
'parameter' => array(
'entity' => array(
'type' => 'entity',
'label' => t('Entity'),
'description' => t('Specifies the entity for which to evaluate the condition.'),
),
'type' => array(
'type' => 'token',
'label' => t('Entity type'),
'description' => t('The type of the checked entity.'),
'options list' => 'rules_entity_action_type_options',
'restriction' => 'input',
),
'bundle' => array(
'type' => 'list<text>',
'label' => t('Entity bundle'),
'description' => t('The condition is met if the entity is of one of the selected bundles.'),
'options list' => 'rules_entity_bundle_options',
'restriction' => 'input',
),
),
'group' => t('Entities'),
'base' => 'rules_condition_entity_is_of_bundle',
),
'entity_field_access' => array(
'label' => t('User has field access'),
'parameter' => array(
'entity' => array(
'type' => 'entity',
'label' => t('Entity'),
'description' => t('Specifies the entity for which to evaluate the condition.'),
'restriction' => 'selector',
'wrapped' => TRUE,
),
'field' => array(
'type' => 'token',
'label' => t('Field name'),
'description' => t('The name of the field to check for.'),
'options list' => 'rules_condition_entity_has_field_options',
'restriction' => 'input',
),
'op' => array(
'type' => 'text',
'label' => t('Access operation'),
'options list' => 'rules_condition_entity_field_access_op_options',
'restriction' => 'input',
'optional' => TRUE,
'default value' => 'view',
),
'account' => array(
'type' => 'user',
'label' => t('User account'),
'description' => t('Specifies the user account for which to check access. If left empty, the currently logged in user will be used.'),
'restriction' => 'selector',
'optional' => TRUE,
'default value' => NULL,
),
),
'group' => t('Entities'),
'base' => 'rules_condition_entity_field_access',
),
);
}