You are here

function hook_entityreference_autofill_detach_ajax in Entity reference autofill 7

Remove ajax from entityreference autofill enabled field(s).

Parameters

string $field_name: The name of the field.

array $element: The field widget form element as constructed by hook_field_widget_form().

array $context: An associative array containing the following key-value pairs, matching the arguments received by hook_field_widget_form():

  • form: The form structure to which widgets are being attached. This may be a full form structure, or a sub-element of a larger form.
  • field: The field structure.
  • instance: The field instance structure.
  • langcode: The language associated with $items.
  • items: Array of default values for this field.
  • delta: The order of this item in the array of subelements (0, 1, 2, etc).

Return value

bool return FALSE for fields you do not want to be AJAX enabled.

1 function implements hook_entityreference_autofill_detach_ajax()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entityreference_autofill_og_entityreference_autofill_detach_ajax in entityreference_autofill_og/entityreference_autofill_og.module
Implements hook_entityreference_autofill_detach_ajax().
1 invocation of hook_entityreference_autofill_detach_ajax()
entityreference_autofill_field_widget_form_alter in ./entityreference_autofill.module
Implements hook_field_widget_form_alter().

File

./entityreference_autofill.api.php, line 101
Hook documentation for the Entity reference autofill module.

Code

function hook_entityreference_autofill_detach_ajax($field_name, $element, $context) {

  // Do not attach AJAX callback to OG admin fields.
  if (og_is_group_audience_field($field_name)) {
    if (isset($context['instance']['field_mode']) && $context['instance']['field_mode'] == 'admin') {
      return FALSE;
    }
  }
}