You are here

function civicrm_entity_price_set_field_admin_settings_form_validate in CiviCRM Entity 7.2

Validation callback for the CiviCRM Entity Enabled Entities form at 'admin/structure/civicrm-entity/settings'

_state

Parameters

$form:

1 string reference to 'civicrm_entity_price_set_field_admin_settings_form_validate'
civicrm_entity_price_set_field_form_civicrm_entity_admin_settings_form_alter in modules/civicrm_entity_price_set_field/civicrm_entity_price_set_field.module
Implements hook_form_FORM_ID_alter().

File

modules/civicrm_entity_price_set_field/civicrm_entity_price_set_field.module, line 1185

Code

function civicrm_entity_price_set_field_admin_settings_form_validate($form, &$form_state) {
  $selected_entities = $form_state['values']['civicrm_entity_admin_enabled_entities'];
  $required_entities = array(
    'civicrm_contact' => 'Contact',
    'civicrm_contribution' => 'Contribution',
    'civicrm_event' => 'Event',
    'civicrm_line_item' => 'Line Item',
    'civicrm_participant' => 'Participant',
    'civicrm_participant_payment' => 'Participant Payment',
    'civicrm_price_set' => 'Price Set',
    'civicrm_price_field' => 'Price Field',
    'civicrm_price_field_value' => 'Price Field Value',
    'civicrm_payment_processor' => 'Payment Processor',
    'civicrm_payment_processor_type' => 'Payment Processor Type',
  );
  foreach ($required_entities as $drupal_entity_type => $entity_type_label) {
    if (empty($selected_entities[$drupal_entity_type])) {
      form_set_error('civicrm_entity_admin_enabled_entities][' . $drupal_entity_type, $entity_type_label . ' required by CiviCRM Entity Price Set Field module');
    }
  }
}