You are here

function commerce_paypal_ec_order_form in Commerce PayPal 7.2

Displays an Express Checkout button as a form that redirects to PayPal.

1 string reference to 'commerce_paypal_ec_order_form'
commerce_paypal_ec_form_alter in modules/ec/commerce_paypal_ec.module
Implements hook_form_alter().

File

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

Code

function commerce_paypal_ec_order_form($form, &$form_state, $payment_method, $order) {
  $form_state['payment_method'] = $payment_method;
  $form_state['order'] = $order;
  $form['#attributes'] = array(
    'class' => array(
      'paypal-ec-order-form',
    ),
  );

  // @todo See if we can embed this using HTTP to avoid potential browser
  // warnings if HTTPS is not enabled on the site.
  $form['paypal_ec'] = array(
    '#type' => 'image_button',
    '#value' => t('Check out with PayPal'),
    '#src' => commerce_paypal_ec_button_url(),
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'commerce_paypal_ec') . '/theme/commerce_paypal_ec.theme.css',
      ),
    ),
  );
  return $form;
}