You are here

function commerce_pado_field_settings_submit in Commerce Product Add-on 7

1 string reference to 'commerce_pado_field_settings_submit'
commerce_pado_form_alter in ./commerce_pado.module

File

./commerce_pado.module, line 70
Commerce Product Add On adds an option to entityreference fields that allows selected products to act as "add-ons" for the parent product.

Code

function commerce_pado_field_settings_submit($form, &$form_state) {
  $commerce_pado_settings = variable_get('commerce_pado_settings', array());
  $commerce_pado_on = $form_state['values']['commerce_pado_on'];
  $instance = isset($form_state['entityreference']['instance']) ? $form_state['entityreference']['instance'] : $form['#instance'];

  // We save the settings keyed by field instance id.
  $commerce_pado_settings[$instance['id']] = $commerce_pado_on;
  variable_set('commerce_pado_settings', $commerce_pado_settings);
}