function commerce_shipping_rules_action_info in Commerce Shipping 7
Same name and namespace in other branches
- 7.2 commerce_shipping.rules.inc \commerce_shipping_rules_action_info()
Implements hook_rules_action_info().
File
- ./
commerce_shipping.rules.inc, line 38 - Rules integration for shipping.
Code
function commerce_shipping_rules_action_info() {
$actions = array();
// Add an action for each plugin that want's it.
foreach (commerce_shipping_plugin_get_plugins('quotes') as $key => $plugin) {
if (!isset($plugin['create_rule']) || $plugin['create_rule'] !== FALSE) {
$actions['commerce_shipping_enable_' . $key] = array(
'label' => t('Enable shipping method: @method', array(
'@method' => $plugin['title'],
)),
'parameter' => array(
'commerce_order' => array(
'type' => 'commerce_order',
'label' => t('Order'),
),
'shipping_method' => array(
'type' => 'commerce_shipping_settings',
'restriction' => 'input',
'label' => t('Shipping settings'),
'shipping_method' => $key,
),
),
'group' => t('Commerce Shipping'),
'base' => $plugin['plugin module'] . '_' . $key,
'callbacks' => array(
'execute' => 'commerce_shipping_enable_method',
),
);
}
}
$actions['commerce_shipping_remove_all'] = array(
'label' => t('Remove all shipping items from an order'),
'parameter' => array(
'commerce_order' => array(
'type' => 'commerce_order',
'label' => t('Order to remove shipping items from'),
),
),
'group' => t('Commerce Shipping'),
'callbacks' => array(
'execute' => 'commerce_shipping_rules_remove_all',
),
);
return $actions;
}