You are here

function commerce_paypal_bml_order_form in Commerce PayPal 7.2

Displays a PayPal Credit button as a form that redirects to PayPal.

1 string reference to 'commerce_paypal_bml_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 545
Implements PayPal Express Checkout in Drupal Commerce checkout.

Code

function commerce_paypal_bml_order_form($form, &$form_state, $payment_method, $order, $separator = FALSE) {
  $form_state['payment_method'] = $payment_method;
  $form_state['order'] = $order;
  $form['#attributes'] = array(
    'class' => array(
      'paypal-bml-order-form',
    ),
  );

  // Display a separator at the top of this form if necessary; used when this
  // form is rendered beneath an Express Checkout button form.
  if ($separator) {
    $form['separator'] = array(
      '#markup' => '<div class="paypal-ec-bml-separator">' . t('--- OR ---') . '</div>',
    );
  }
  $form['paypal_bml'] = array(
    '#type' => 'image_button',
    '#value' => t('Check out with PayPal Credit'),
    '#src' => commerce_paypal_ec_bml_button_url(),
    '#validate' => array(
      'commerce_paypal_ec_order_form_validate',
    ),
    '#submit' => array(
      'commerce_paypal_ec_order_form_submit',
    ),
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'commerce_paypal_ec') . '/theme/commerce_paypal_ec.theme.css',
      ),
    ),
  );

  // @todo Allow for localization by changing en_US to a supported locale code.
  $form['paypal_bml_undertext'] = array(
    '#markup' => '<div><a target="_blank" class="paypal-bml-text" href="https://www.securecheckout.billmelater.com/paycapture-content/fetch?hash=AU826TU8&content=/bmlweb/ppwpsiw.html"><img src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_bml_text.png" /></a></div>',
  );
  return $form;
}