You are here

function civicrm_entity_contact_assign_rel_type_list_field_form_civicrm_entity_admin_settings_form_alter in CiviCRM Entity 7.2

Implements hook_form_FORM_ID_alter().

Alter the CiviCRM Entity enabled entities settings form

Insure necessary entity types for this module remain enabled

_state

Parameters

$form:

File

modules/civicrm_entity_contact_assign_rel_type_list_field/civicrm_entity_contact_assign_rel_type_list_field.module, line 599
Provide CiviCRM Entity Contact Assign Relationship Type List Field Type. Provides a widget for adding/removing a contacts relationships to a configured global contact.

Code

function civicrm_entity_contact_assign_rel_type_list_field_form_civicrm_entity_admin_settings_form_alter(&$form, &$form_state) {
  $required_entities = array(
    'civicrm_contact' => 'Contact',
    'civicrm_relationship' => 'Relationship',
  );
  foreach ($required_entities as $drupal_entity_type => $entity_type_label) {
    if (empty($selected_entities[$drupal_entity_type])) {
      $form['civicrm_entity_admin_enabled_entities'][$drupal_entity_type]['#disabled'] = TRUE;
      $form['civicrm_entity_admin_enabled_entities'][$drupal_entity_type]['#default_value'] = 1;
    }
  }
  $form['#validate'][] = 'civicrm_entity_contact_assign_rel_type_list_field_admin_settings_form_validate';
}