You are here

function civicrm_entity_profile_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_profile_admin_settings_form_validate'
civicrm_entity_profile_form_civicrm_entity_admin_settings_form_alter in modules/civicrm_entity_profile/civicrm_entity_profile.module
Implements hook_form_FORM_ID_alter().

File

modules/civicrm_entity_profile/civicrm_entity_profile.module, line 739

Code

function civicrm_entity_profile_admin_settings_form_validate($form, &$form_state) {
  $selected_entities = $form_state['values']['civicrm_entity_admin_enabled_entities'];
  $required_entities = array(
    'civicrm_event' => 'Event',
    'civicrm_uf_field' => 'UF Field',
    'civicrm_uf_group' => 'UF Group',
    'civicrm_uf_join' => 'UF Join',
  );
  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 Profile Field module');
    }
  }
}