function hook_commerce_registration_order_ops in Commerce Registration 7.2
Allow modules to alter the operation links on the order registration tables.
This is used, for example, in commerce_registration_defer to add a defer link for each registration on the order edit page.
Parameters
array $actions: An array of links to perform actions on the registration. By default there is the view and edit links if the current user has permission to use them.
array $context: array( 'registration' => The registration to provide action links for, 'order' => The order that is being edited, 'prodkey' => The line item product key combo, within $order->data['register_entities'] for this registration, );
File
- ./
commerce_registration.api.php, line 26 - API documentation for Commerce Registration module.
Code
function hook_commerce_registration_order_ops(&$actions, $context) {
// Don't provide a deferral link if the registration is already deferred.
if ($context['registration']->state === 'deferred') {
return;
}
// Check that the user has access to defer a registration.
if (entity_access('defer', 'registration', $context['registration'])) {
$actions['defer'] = l(t('Defer'), 'admin/commerce/orders/' . $context['order']->order_id . '/defer/' . $context['registration']->registration_id, array(
'query' => drupal_get_destination(),
));
}
}