function hook_entityreference_autofill_target_id_alter in Entity reference autofill 7
Alter target id to fetch referenced values from.
Parameters
int &$target_id: Current target id as determined by entityreference_autofill_field_attach_form().
array &$form_state: The current $form_state array.
array $context: An associative array containing the following key-value pairs:
- field_name: The name of the reference field.
- field: Triggering field (The entity reference field) info array.
- field: Field info.
- instance: Instance info.
- form: Current form array.
- langcode: The current langcode.
1 function implements hook_entityreference_autofill_target_id_alter()
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_target_id_alter in entityreference_autofill_og/
entityreference_autofill_og.module - Implements hook_entityreference_autofill_target_id_alter().
1 invocation of hook_entityreference_autofill_target_id_alter()
File
- ./
entityreference_autofill.api.php, line 127 - Hook documentation for the Entity reference autofill module.
Code
function hook_entityreference_autofill_target_id_alter(&$target_id, &$form_state, $context) {
// Fetch value from form input array instead of values.
if (og_is_group_audience_field($context['field_name'])) {
$reference_field_parents = $form_state['triggering_element']['#parents'];
$referenced_target_id = drupal_array_get_nested_value($form_state['input'], $reference_field_parents);
}
}