function rules_entity_action_info
Implements hook_rules_action_info() on behalf of the entity module.
See also
Related topics
File
-
modules/
entity.rules.inc, line 39
Code
function rules_entity_action_info() {
if (rules_entity_action_type_options('entity_fetch')) {
$return['entity_fetch'] = array(
'label' => t('Fetch entity by id'),
'parameter' => array(
'type' => array(
'type' => 'text',
'label' => t('Entity type'),
'options list' => 'rules_entity_action_type_options',
'description' => t('Specifies the type of entity that should be fetched.'),
'restriction' => 'input',
),
'id' => array(
'type' => 'unknown',
'label' => t('Identifier'),
),
),
'provides' => array(
'entity_fetched' => array(
'type' => 'unknown',
'label' => t('Fetched entity'),
),
),
'group' => t('Entities'),
'access callback' => 'rules_entity_action_access',
'base' => 'rules_action_entity_fetch',
'callbacks' => array(
'access' => 'rules_action_entity_createfetch_access',
'form_alter' => 'rules_action_type_form_alter',
),
);
$return['entity_query'] = array(
'label' => t('Fetch entity by property'),
'parameter' => array(
'type' => array(
'type' => 'text',
'label' => t('Entity type'),
'options list' => 'rules_entity_action_type_options',
'description' => t('Specifies the type of the 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',
),
),
'provides' => array(
'entity_fetched' => array(
'type' => 'list',
'label' => t('Fetched entity'),
),
),
'group' => t('Entities'),
'access callback' => 'rules_entity_action_access',
'base' => 'rules_action_entity_query',
'callbacks' => array(
'form_alter' => 'rules_action_type_form_alter',
),
);
}
if (rules_entity_action_type_options('entity_create')) {
$return['entity_create'] = array(
'label' => t('Create a new entity'),
'named parameter' => TRUE,
'parameter' => array(
'type' => array(
'type' => 'text',
'label' => t('Entity type'),
'options list' => 'rules_entity_action_type_options',
'description' => t('Specifies the type of the entity that should be created.'),
'restriction' => 'input',
),
),
'provides' => array(
'entity_created' => array(
'type' => 'unknown',
'label' => t('Created entity'),
'save' => TRUE,
),
),
'group' => t('Entities'),
'access callback' => 'rules_entity_action_access',
'base' => 'rules_action_entity_create',
'callbacks' => array(
'access' => 'rules_action_entity_createfetch_access',
'form_alter' => 'rules_action_type_form_alter',
'validate' => 'rules_action_create_type_validate',
),
);
}
$return['entity_save'] = array(
'label' => t('Save entity'),
'parameter' => array(
'data' => array(
'type' => 'entity',
'label' => t('Entity'),
'description' => t('Specifies the entity, which should be saved permanently.'),
'restriction' => 'selector',
'wrapped' => TRUE,
),
'immediate' => array(
'type' => 'boolean',
'label' => t('Force saving immediately'),
'description' => t('Usually saving is postponed till the end of the evaluation, so that multiple saves can be fold into one. If this set, saving is forced to happen immediately.'),
'default value' => FALSE,
'optional' => TRUE,
'restriction' => 'input',
),
),
'group' => t('Entities'),
'access callback' => 'rules_entity_action_access',
'base' => 'rules_action_entity_save',
'callbacks' => array(
'access' => 'rules_action_entity_savedelete_access',
),
);
$return['entity_delete'] = array(
'label' => t('Delete entity'),
'parameter' => array(
'data' => array(
'type' => 'entity',
'label' => t('Entity'),
'description' => t('Specifies the entity, which should be deleted permanently.'),
'restriction' => 'selector',
'wrapped' => TRUE,
),
),
'group' => t('Entities'),
'access callback' => 'rules_entity_action_access',
'base' => 'rules_action_entity_delete',
'callbacks' => array(
'access' => 'rules_action_entity_savedelete_access',
),
);
return $return;
}