You are here

function commerce_pado_field_settings_validate in Commerce Product Add-on 7

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

File

./commerce_pado.module, line 59
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_validate($form, &$form_state) {
  if ($form_state['values']['commerce_pado_on'] == 1 && $form['#field']['type'] == 'entityreference' && $form_state['values']['field']['settings']['target_type'] != 'commerce_product') {
    form_set_error('commerce_pado_settings', 'Since you have enabled <em>Product Add On Settings</em>, the target entity type must be <em>Commerce Product</em>.');
  }
}