You are here

function commerce_webform_form_webform_configure_form_alter in Commerce Webform 8

Same name and namespace in other branches
  1. 7.2 commerce_webform.module \commerce_webform_form_webform_configure_form_alter()
  2. 7 commerce_webform.module \commerce_webform_form_webform_configure_form_alter()

Implements hook_form_FORM_ID_alter(). Add commerce webform items to Form Settings page.

File

./commerce_webform.module, line 542
Commerce Webform module file

Code

function commerce_webform_form_webform_configure_form_alter(&$form, &$form_state, $form_id) {
  $node = $form_state['build_info']['args'][0];
  $form['commerce_webform'] = array(
    '#type' => 'fieldset',
    '#title' => t('Commerce webform settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 1,
    '#description' => t('These settings are for when the submission of this webform will create a commerce order. The webform must have at least one productfield element on it to be a commerce webform.'),
  );
  $form['commerce_webform']['commerce_webform_new_order'] = array(
    '#type' => 'checkbox',
    '#title' => t('Create a separate order'),
    '#description' => t('When the webform is submitted the default action is to add all selected products into the users current basket. If you want instead to create a special order just for this submission, check this box.'),
    '#default_value' => isset($node->webform['commerce_webform_new_order']) ? $node->webform['commerce_webform_new_order'] : 0,
  );
  array_unshift($form['#submit'], 'commerce_webform_configure_submit');
}