function commerce_stock_rules_action_info in Commerce Stock 7.2
Same name and namespace in other branches
- 7 commerce_stock.rules.inc \commerce_stock_rules_action_info()
Implements hook_rules_action_info().
File
- ./
commerce_stock.rules.inc, line 119 - Rules integration for Commerce Stock.
Code
function commerce_stock_rules_action_info() {
$actions = array();
// The Stock cart state action.
$actions['commerce_stock_add_to_cart_set_state'] = array(
'label' => t('Set the result of an add to cart stock check'),
'parameter' => array(
'stock_action' => array(
'type' => 'decimal',
'label' => t('Stock Action'),
'description' => t('the action to take .'),
'options list' => 'commerce_stock_check_state_options_list',
),
'message' => array(
'type' => 'text',
'label' => t('User message'),
),
'approved_quantity' => array(
'type' => 'decimal',
'label' => t('Approved Quantity'),
),
),
'group' => t('Commerce Stock'),
'callbacks' => array(
'execute' => 'commerce_stock_rules_add_to_cart_set_state',
),
);
// The stock disable cart action.
$actions['commerce_stock_set_add_to_cart_form_state'] = array(
'label' => t('Set the state of the add to cart form'),
'parameter' => array(
'disabled' => array(
'type' => 'boolean',
'label' => t('Disable the add to cart?'),
),
'text' => array(
'type' => 'text',
'label' => t('The text to set the action to'),
),
'class_name' => array(
'type' => 'text',
'label' => t('add a class to the add to cart form'),
),
),
'group' => t('Commerce Stock'),
'callbacks' => array(
'execute' => 'commerce_stock_rules_set_add_to_cart_form_state',
),
);
// The stock custom cart action.
$actions['commerce_stock_custom_cart_form_state'] = array(
'label' => t('Advanced configuration of the add to cart form'),
'parameter' => array(
'hide_qty' => array(
'type' => 'boolean',
'label' => t('Hide the Quantity field if it is visible'),
),
'text' => array(
'type' => 'text',
'label' => t('The text to set the action to'),
),
'class_name' => array(
'type' => 'text',
'label' => t('Add a class to the add to cart form'),
),
'action_prefix' => array(
'type' => 'text',
'label' => t('Prefix'),
'optional' => TRUE,
),
'action_suffix' => array(
'type' => 'text',
'label' => t('Suffix'),
'optional' => TRUE,
),
'stock_action' => array(
'type' => 'decimal',
'label' => t('Stock Action'),
'description' => t('The action to take.'),
'options list' => 'commerce_stock_custom_cart_form_state_action_options_list',
'default value' => 0,
),
'disabled_cart' => array(
'type' => 'boolean',
'label' => t('Disable the add to cart?'),
'description' => t('Only applicable if Normal Submit was chosen as the Stock Action'),
),
'custom_submit' => array(
'type' => 'text',
'label' => t('A new custom submit function'),
'optional' => TRUE,
'description' => t('Only applicable if Custom Submit was chosen as the Stock Action'),
),
'custom_submit_clear' => array(
'type' => 'boolean',
'label' => t('Clear the submit array first'),
'description' => t('Only applicable if Custom Submit was chosen as the Stock Action'),
),
'custom_validate' => array(
'type' => 'text',
'label' => t('a new of a custom validation function'),
'description' => t('Only applicable if Custom Submit was chosen as the Stock Action'),
'optional' => TRUE,
),
'custom_validate_clear' => array(
'type' => 'boolean',
'label' => t('Clear the validation array first'),
'description' => t('Only applicable if Custom Submit was chosen as the Stock Action'),
),
'custom_url' => array(
'type' => 'text',
'label' => t('Custom URL'),
'description' => t('Only applicable if URL Action was chosen as the Stock Action (all submit and validation will be ignored). You can use the [product_id] token and [url] for a return path'),
'optional' => TRUE,
),
'custom_html' => array(
'type' => 'text',
'label' => t('Custom HTML'),
'description' => t('Only applicable if Custom HTML was chosen as the Stock Action (all submit and validation will be ignored). You can use the [product_id] token and [url] for a return path'),
'optional' => TRUE,
),
),
'group' => t('Commerce Stock'),
'callbacks' => array(
'execute' => 'commerce_stock_custom_cart_form_state',
),
);
// The Stock checkout check action.
$actions['commerce_stock_checkout_state'] = array(
'label' => t('Set the state of the checkout process (called one per an item)'),
'parameter' => array(
'stock_action' => array(
'type' => 'decimal',
'label' => t('Stock Action'),
'description' => t('the action to take .'),
'options list' => 'commerce_stock_check_state_options_list',
),
'message' => array(
'type' => 'text',
'label' => t('User message'),
),
'approved_quantity' => array(
'type' => 'decimal',
'label' => t('Approved Quantity'),
),
),
'group' => t('Commerce Stock'),
'callbacks' => array(
'execute' => 'commerce_stock_rules_set_checkout_state',
),
);
return $actions;
}