You are here

function commerce_paypal_ec_page_alter in Commerce PayPal 7.2

Implements hook_page_alter().

File

modules/ec/commerce_paypal_ec.module, line 216
Implements PayPal Express Checkout in Drupal Commerce checkout.

Code

function commerce_paypal_ec_page_alter(&$page) {

  // Add a registration link to the PayPal Express Checkout payment method rules
  // on the payment methods admin page.
  if (!empty($page['content']['system_main']['#page_callback']) && $page['content']['system_main']['#page_callback'] == 'commerce_payment_ui_admin_page') {

    // Ensure we loop over both enabled and disabled rules.
    foreach (array(
      'enabled',
      'disabled',
    ) as $key) {
      foreach ($page['content']['system_main'][$key]['rules']['#rows'] as $row_key => &$row) {
        if (strpos($row[0]['data']['description']['settings']['machine_name']['#markup'], 'commerce_payment_paypal_ec') > 0) {
          $row[0]['data']['#suffix'] = '<div class="service-description">' . commerce_paypal_ec_service_description() . '</div></div>';
        }
      }
    }
  }
}