You are here

function civicrm_entity_contact_group_assign_field_form_field_ui_field_edit_form_alter in CiviCRM Entity 7.2

Implements hook_form_FORMID_alter().

form id : field_ui_field_edit_form

Alter Field Settings form to set cardinality to 1 and disable the select widget

_state

Parameters

$form:

File

modules/civicrm_entity_contact_group_assign_field/civicrm_entity_contact_group_assign_field.module, line 36
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_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
  if ($form['#field']['type'] == 'civicrm_entity_contact_group_assign_field') {

    // field settings mods
    $form['field']['cardinality']['#default_value'] = 1;
    $form['field']['cardinality']['#disabled'] = TRUE;
  }
}