function rules_data_action_info
Implements hook_rules_action_info() on behalf of the pseudo data module.
See also
Related topics
File
-
modules/
data.rules.inc, line 39
Code
function rules_data_action_info() {
$return['data_set'] = array(
'label' => t('Set a data value'),
'parameter' => array(
'data' => array(
'type' => '*',
'label' => t('Data'),
'description' => t('Specifies the data to be modified using a data selector, e.g. "node:author:name".'),
'restriction' => 'selector',
'wrapped' => TRUE,
'allow null' => TRUE,
),
'value' => array(
'type' => '*',
'label' => t('Value'),
'description' => t('The new value to set for the specified data.'),
'allow null' => TRUE,
'optional' => TRUE,
),
),
'group' => t('Data'),
'base' => 'rules_action_data_set',
);
$return['data_calc'] = array(
'label' => t('Calculate a value'),
'parameter' => array(
'input_1' => array(
'type' => array(
'decimal',
'date',
),
'label' => t('Input value 1'),
'description' => t('The first input value for the calculation.'),
),
'op' => array(
'type' => 'text',
'label' => t('Operator'),
'description' => t('The calculation operator.'),
'options list' => 'rules_action_data_calc_operator_options',
'restriction' => 'input',
'default value' => '+',
),
'input_2' => array(
'type' => 'decimal',
'label' => t('Input value 2'),
'description' => t('The second input value.'),
),
),
'group' => t('Data'),
'base' => 'rules_action_data_calc',
'provides' => array(
'result' => array(
'type' => 'unknown',
'label' => t('Calculation result'),
),
),
);
$return['list_add'] = array(
'label' => t('Add an item to a list'),
'parameter' => array(
'list' => array(
'type' => 'list',
'label' => t('List', array(), array(
'context' => 'data_types',
)),
'description' => t('The data list, to which an item is to be added.'),
'restriction' => 'selector',
'allow null' => TRUE,
'save' => TRUE,
),
'item' => array(
'type' => 'unknown',
'label' => t('Item to add'),
),
'unique' => array(
'type' => 'boolean',
'label' => t('Enforce uniqueness'),
'description' => t('Only add the item to the list if it is not yet contained.'),
'optional' => TRUE,
'default value' => FALSE,
),
'pos' => array(
'type' => 'text',
'label' => t('Insert position'),
'optional' => TRUE,
'default value' => 'end',
'options list' => 'rules_action_data_list_add_positions',
),
),
'group' => t('Data'),
'base' => 'rules_action_data_list_add',
'callbacks' => array(
'info_alter' => 'rules_data_list_info_alter',
'form_alter' => 'rules_data_list_form_alter',
),
);
$return['list_remove'] = array(
'label' => t('Remove an item from a list'),
'parameter' => array(
'list' => array(
'type' => 'list',
'label' => t('List', array(), array(
'context' => 'data_types',
)),
'description' => t('The data list for which an item is to be removed.'),
'restriction' => 'selector',
'save' => TRUE,
),
'item' => array(
'type' => 'unknown',
'label' => t('Item to remove'),
),
),
'group' => t('Data'),
'base' => 'rules_action_data_list_remove',
'callbacks' => array(
'info_alter' => 'rules_data_list_info_alter',
'form_alter' => 'rules_data_list_form_alter',
),
);
$return['variable_add'] = array(
'label' => t('Add a variable'),
'named parameter' => TRUE,
'parameter' => array(
'type' => array(
'type' => 'text',
'label' => t('Type'),
'options list' => 'rules_data_action_variable_add_options',
'description' => t('Specifies the type of the variable that should be added.'),
'restriction' => 'input',
),
'value' => array(
'type' => 'unknown',
'label' => t('Value'),
'optional' => TRUE,
'description' => t('Optionally, specify the initial value of the variable.'),
),
),
'provides' => array(
'variable_added' => array(
'type' => 'unknown',
'label' => t('Added variable'),
),
),
'group' => t('Data'),
'base' => 'rules_action_variable_add',
'callbacks' => array(
'form_alter' => 'rules_action_type_form_alter',
'validate' => 'rules_action_create_type_validate',
),
);
if (rules_data_action_data_create_options()) {
$return['data_create'] = array(
'label' => t('Create a data structure'),
'named parameter' => TRUE,
'parameter' => array(
'type' => array(
'type' => 'text',
'label' => t('Type'),
'options list' => 'rules_data_action_data_create_options',
'description' => t('Specifies the type of the data structure that should be created.'),
'restriction' => 'input',
),
),
'provides' => array(
'data_created' => array(
'type' => 'unknown',
'label' => t('Created data'),
),
),
'group' => t('Data'),
'base' => 'rules_action_data_create',
'callbacks' => array(
'form_alter' => 'rules_action_type_form_alter',
'validate' => 'rules_action_create_type_validate',
),
);
}
$return['data_convert'] = array(
'label' => t('Convert data type'),
'parameter' => array(
'type' => array(
'type' => 'token',
'label' => t('Target type'),
'description' => t('The data type to convert a value to.'),
'options list' => 'rules_action_data_convert_types_options',
'restriction' => 'input',
),
'value' => array(
'type' => array(
'decimal',
'integer',
'text',
'token',
),
'label' => t('Value to convert'),
'default mode' => 'selector',
),
),
'provides' => array(
'conversion_result' => array(
'type' => 'unknown',
'label' => t('Conversion result'),
),
),
'group' => t('Data'),
'base' => 'rules_action_data_convert',
'named parameter' => TRUE,
'callbacks' => array(
'form_alter' => 'rules_action_type_form_alter',
),
);
return $return;
}