You are here

function commerce_license_information_checkout_form in Commerce License 7

Checkout pane callback: License edit.

Outputs a pane for each found license.

File

includes/commerce_license.checkout_pane.inc, line 12
Checkout pane callbacks.

Code

function commerce_license_information_checkout_form($form, &$form_state, $checkout_pane, $order) {
  $pane_form = array(
    '#type' => 'container',
  );
  $licenses = commerce_license_get_order_licenses($order, TRUE);
  foreach ($licenses as $license) {
    $license_id = $license->license_id;
    $title_arguments = array(
      '@product_title' => $license->wrapper->product->title
        ->value(),
    );
    $pane_form[$license_id] = array(
      '#type' => $checkout_pane['fieldset'] ? 'fieldset' : 'container',
      '#title' => t('License information - @product_title', $title_arguments),
      '#collapsible' => $checkout_pane['collapsible'],
      '#collapsed' => $checkout_pane['collapsed'],
      '#parents' => array(
        $license_id,
      ),
      '#tree' => TRUE,
    );
    $license
      ->form($pane_form[$license_id], $form_state);
  }
  return $pane_form;
}