You are here

function commerce_registration_defer_commerce_registration_order_ops_alter in Commerce Registration 7.2

Implements hook_commerce_registration_order_ops_alter().

Adds a defer operation in the registration tables on an order edit page.

File

modules/commerce_registration_defer/commerce_registration_defer.module, line 328
Module file for commerce_registration_defer.

Code

function commerce_registration_defer_commerce_registration_order_ops_alter(&$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 (commerce_registration_defer_defer_registration_access('defer', $context['registration'])) {
    $actions['defer'] = l(t('Defer'), 'admin/commerce/orders/' . $context['order']->order_id . '/defer/' . $context['registration']->registration_id, array(
      'query' => drupal_get_destination(),
    ));
  }
}