You are here

function commerce_payment_post_redirect_form in Commerce Core 7

Utility function: return a payment redirect page for POST.

Parameters

$action: The destination URL the values should be posted to.

$values: An associative array of values that will be posted to the destination URL.

Return value

A renderable array.

File

modules/payment/includes/commerce_payment.checkout_pane.inc, line 416
Callback functions for the Payment module's checkout panes.

Code

function commerce_payment_post_redirect_form($action, array $values = array()) {
  $form = array(
    '#type' => 'form',
    '#action' => $action,
    '#method' => 'POST',
    '#id' => '',
    '#attributes' => array(),
  );
  foreach ($values as $key => $value) {
    $form[$value] = array(
      '#type' => 'hidden',
      '#name' => $key,
      '#value' => $value,
      '#id' => '',
      '#attributes' => array(),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#id' => '',
    '#value' => t('Proceed to payment'),
  );
  return array(
    'form' => array(
      '#type' => 'markup',
      '#markup' => drupal_render($form),
    ),
  );
}