You are here

function commerce_price_components_settings_form in Commerce price by components 7

Reusable form to include in the different prices settings, formatter & views.

3 calls to commerce_price_components_settings_form()
commerce_price_components_field_formatter_settings_form in ./commerce_price_components.module
Implements hook_field_formatter_settings_form().
commerce_price_components_handler_area_line_item_summary::options_form in includes/views/handlers/commerce_price_components_handler_area_line_item_summary.inc
Default options form that provides the label widget that all fields should have.
commerce_price_components_handler_area_order_total::options_form in includes/views/handlers/commerce_price_components_handler_area_order_total.inc
Default options form that provides the label widget that all fields should have.

File

./commerce_price_components.module, line 126
Module file for Price by components.

Code

function commerce_price_components_settings_form($settings) {
  $form = array();
  $components = commerce_price_component_titles();
  $form['commerce_price_components'] = array(
    '#title' => t('Components to include in the final price.'),
    '#description' => t('When no component is selected, price displays 0.'),
    '#type' => 'fieldset',
  );
  foreach ($components as $key => $component) {
    $form['commerce_price_components'][$key] = array(
      '#type' => 'checkbox',
      '#title' => $component,
      '#default_value' => isset($settings['commerce_price_components'][$key]) ? $settings['commerce_price_components'][$key] : FALSE,
    );
  }
  return $form;
}