You are here

function civicrm_entity_contact_group_assign_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_contact_group_assign_field_admin_settings_form_validate'
civicrm_entity_contact_group_assign_field_form_civicrm_entity_admin_settings_form_alter in modules/civicrm_entity_contact_group_assign_field/civicrm_entity_contact_group_assign_field.module
Implements hook_form_FORM_ID_alter().

File

modules/civicrm_entity_contact_group_assign_field/civicrm_entity_contact_group_assign_field.module, line 566
Provide CiviCRM Entity Contact Group Assign Field Type. Provides a widget for adding/removing a contact to a selected list of groups.

Code

function civicrm_entity_contact_group_assign_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_group' => 'Group',
  );
  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 Contact Group Assign Field module');
    }
  }
}