You are here

function commerce_checkout_pane_settings_form_reset_submit in Commerce Core 7

Submit handler for the checkout pane settings form's reset button.

1 string reference to 'commerce_checkout_pane_settings_form_reset_submit'
commerce_checkout_pane_settings_form in modules/checkout/includes/commerce_checkout.admin.inc
Build the configuration form for a checkout pane.

File

modules/checkout/includes/commerce_checkout.admin.inc, line 354
Administrative callbacks for the Checkout module.

Code

function commerce_checkout_pane_settings_form_reset_submit($form, &$form_state) {

  // Reset the display settings for the checkout pane.
  commerce_checkout_pane_reset($form_state['values']['checkout_pane']['pane_id']);

  // Reset this checkout pane's settings as if this was a system settings form.
  if (!empty($form['settings'])) {
    foreach (element_children($form['settings']) as $field) {

      // Provide support for containers one level deep.
      if (in_array($form['settings'][$field]['#type'], array(
        'container',
        'fieldset',
      ))) {
        foreach (element_children($form['settings'][$field]) as $nested_field) {
          variable_del($nested_field);
        }
      }
      else {
        variable_del($field);
      }
    }
  }
  drupal_set_message(t('Checkout pane reset.'));
}