function commerce_file_rules_action_info in Commerce File 7
Implements hook_rules_action_info().
File
- ./
commerce_file.rules.inc, line 122 - Provides Rules integration for entities provided via the CRUD API.
Code
function commerce_file_rules_action_info() {
$actions = array();
$group = _commerce_file_translatables('license_label');
$license_label = $group;
$actions['commerce_file_license_update_state'] = array(
'label' => t('Update the license state'),
'parameter' => array(
'license' => array(
'type' => COMMERCE_FILE_LICENSE_ENTITY_NAME,
'label' => $license_label,
'restriction' => 'selector',
),
'license_state' => array(
'type' => 'text',
'label' => t('License state'),
'options list' => 'commerce_file_license_state_options_list',
),
),
'group' => $group,
'callbacks' => array(
'execute' => 'commerce_file_license_rules_action_update_state',
),
);
$actions['commerce_file_license_update_status'] = array(
'label' => t('Update the license status'),
'parameter' => array(
'license' => array(
'type' => COMMERCE_FILE_LICENSE_ENTITY_NAME,
'label' => $license_label,
'restriction' => 'selector',
),
'license_status' => array(
'type' => 'text',
'label' => t('License status'),
'options list' => 'commerce_file_license_status_options_list',
),
),
'group' => $group,
'callbacks' => array(
'execute' => 'commerce_file_license_rules_action_update_status',
),
);
$actions['commerce_file_license_issue_order'] = array(
'label' => t('Issue licenses for files in the order'),
'parameter' => array(
'order' => array(
'type' => 'commerce_order',
'label' => t('Commerce order'),
'restriction' => 'selector',
),
'license_status' => array(
'type' => 'text',
'label' => t('Issued license status'),
'options list' => 'commerce_file_license_status_options_list',
'default value' => 'pending',
),
'product_refresh' => array(
'type' => 'boolean',
'label' => t('Refresh line item files based on the product files'),
'description' => t('Enabling this refresh will update the as-purchased snapshot of the files on the line items with the current product files and access limits.'),
'default value' => FALSE,
),
),
'group' => $group,
'callbacks' => array(
'execute' => 'commerce_file_rules_action_issue_order_licenses',
),
);
$actions['commerce_file_license_revoke_order'] = array(
'label' => t('Revoke licenses for files in the order'),
'parameter' => array(
'order' => array(
'type' => 'commerce_order',
'label' => t('Commerce order'),
'restriction' => 'selector',
),
),
'group' => $group,
'callbacks' => array(
'execute' => 'commerce_file_rules_action_revoke_order_licenses',
),
);
$actions['commerce_file_license_order_update_state'] = array(
'label' => t('Update the state of all licenses associated with the order'),
'parameter' => array(
'order' => array(
'type' => 'commerce_order',
'label' => t('Commerce order'),
'restriction' => 'selector',
),
'license_state' => array(
'type' => 'text',
'label' => t('License state'),
'options list' => 'commerce_file_license_state_options_list',
'default value' => 'denied',
),
),
'group' => $group,
'callbacks' => array(
'execute' => 'commerce_file_rules_action_order_update_state',
),
);
$actions['commerce_file_license_order_update_status'] = array(
'label' => t('Update the status of all licenses associated with the order'),
'parameter' => array(
'order' => array(
'type' => 'commerce_order',
'label' => t('Commerce order'),
'restriction' => 'selector',
),
'license_status' => array(
'type' => 'text',
'label' => t('License status'),
'options list' => 'commerce_file_license_status_options_list',
'default value' => 'pending',
),
),
'group' => $group,
'callbacks' => array(
'execute' => 'commerce_file_rules_action_order_update_status',
),
);
$actions['commerce_file_license_allow_download'] = array(
'label' => t('ALLOW download of a licensed file'),
'parameter' => array(
'license' => array(
'type' => COMMERCE_FILE_LICENSE_ENTITY_NAME,
'label' => $license_label,
'restriction' => 'selector',
),
),
'group' => $group,
'callbacks' => array(
'execute' => 'commerce_file_license_rules_action_allow_download',
),
);
$actions['commerce_file_license_log_download'] = array(
'label' => t('Log download of a licensed file'),
'parameter' => array(
'license' => array(
'type' => COMMERCE_FILE_LICENSE_ENTITY_NAME,
'label' => $license_label,
'restriction' => 'selector',
),
),
'group' => $group,
'callbacks' => array(
'execute' => 'commerce_file_license_rules_action_log_download',
),
);
return $actions;
}