flexiform.checkout.inc in Flexiform 7
Flexiform Checkout integration.
File
flexiform.checkout.incView source
<?php
/**
* @file
* Flexiform Checkout integration.
*/
/**
* Flexiform Checkout Pane Callback.
*/
function flexiform_checkout_pane_checkout_form($form, &$form_state, $checkout_pane, $order) {
$pane_form = array();
$pane_form['#flexiform'] = $flexiform = flexiform_load($checkout_pane['flexiform']);
$pane_form['#flexiform_builder'] = $builder = $flexiform
->getBuilder($order);
$pane_form['#parents'] = array(
$checkout_pane['pane_id'],
);
$pane_form += $builder
->form($pane_form, $form_state, $order);
return $pane_form;
}
/**
* Flexiform Checkout Pane Validate Callback.
*/
function flexiform_checkout_pane_checkout_form_validate(&$form, &$form_state, $checkout_pane, &$order) {
$builder = $form[$checkout_pane['pane_id']]['#flexiform_builder'];
$builder
->formValidate($form[$checkout_pane['pane_id']], $form_state);
// @todo: See if we can set the base entity on the builder rather than pulling
// it off afterwards.
$order = $builder
->getFormEntity('base_entity');
if (form_get_errors()) {
return FALSE;
}
return TRUE;
}
/**
* Flexiform Checkout Pane Submit Callback.
*/
function flexiform_checkout_pane_checkout_form_submit(&$form, &$form_state, $checkout_pane, &$order) {
$builder = $form[$checkout_pane['pane_id']]['#flexiform_builder'];
$builder
->formSubmit($form[$checkout_pane['pane_id']], $form_state);
// @todo: See if we can set the base entity on the builder rather than pulling
// it off afterwards.
$order = $builder
->getFormEntity('base_entity');
}
Functions
Name | Description |
---|---|
flexiform_checkout_pane_checkout_form | Flexiform Checkout Pane Callback. |
flexiform_checkout_pane_checkout_form_submit | Flexiform Checkout Pane Submit Callback. |
flexiform_checkout_pane_checkout_form_validate | Flexiform Checkout Pane Validate Callback. |