You are here

function payment_webform_page_payment in Payment for Webform 7

Return a payment page for a field instance.

Parameters

stdClass $node:

integer $cid:

Return value

array A Drupal build array.

1 string reference to 'payment_webform_page_payment'
payment_webform_menu in ./payment_webform.module
Implements hook_menu().

File

./payment_webform.module, line 210
Hook implementations and shared functions.

Code

function payment_webform_page_payment($node, $cid) {
  $component = $node->webform['components'][$cid];
  $payment = new Payment(array(
    'context' => 'payment_webform_' . $node->nid . '_' . $cid,
    'context_data' => array(
      'cid' => $cid,
    ),
    'currency_code' => $component['extra']['payment_currency_code'],
    'description' => $component['extra']['payment_description'],
    'finish_callback' => 'payment_webform_payment_finish',
  ));
  foreach ($component['extra']['payment_line_items'] as $line_item) {
    $line_item->name = 'payment_webform_' . $line_item->name;
    $payment
      ->setLineItem($line_item);
  }
  return drupal_get_form('payment_form_standalone', $payment);
}