You are here

function commerce_payment_ui_payment_transaction_uri in Commerce Core 7

Entity uri callback: points to the admin view page of the given payment transaction.

1 string reference to 'commerce_payment_ui_payment_transaction_uri'
commerce_payment_ui_entity_info_alter in modules/payment/commerce_payment_ui.module
Implements hook_entity_info_alter().

File

modules/payment/commerce_payment_ui.module, line 136
Default Payment UI for Drupal Commerce.

Code

function commerce_payment_ui_payment_transaction_uri($transaction) {

  // First look for a return value in the default entity uri callback.
  $uri = commerce_payment_transaction_uri($transaction);

  // If a value was found, return it now.
  if (!empty($uri)) {
    return $uri;
  }

  // Only return a value if the transaction references an order and the user has
  // permission to view the payment transaction.
  if ($order = commerce_order_load($transaction->order_id)) {
    if (commerce_payment_transaction_access('view', $transaction)) {
      return array(
        'path' => 'admin/commerce/orders/' . $order->order_id . '/payment/' . $transaction->transaction_id . '/view',
      );
    }
  }
  return NULL;
}