1 entityreference.module entityreference_autocomplete_access_callback($type, $field_name, $entity_type, $bundle_name)

Menu Access callback for the autocomplete widget.

Parameters

$type: The widget type (i.e. 'single' or 'tags').

$field_name: The name of the entity-reference field.

$entity_type: The entity type.

$bundle_name: The bundle name.

Return value

bool: True if user can access this menu item.

File

core/modules/entityreference/entityreference.module, line 978
Entityreference primary module file.

Code

function entityreference_autocomplete_access_callback($type, $field_name, $entity_type, $bundle_name) {
  $field = field_info_field($field_name);
  $instance = field_info_instance($entity_type, $field_name, $bundle_name);

  if (!$field || !$instance || $field['type'] != 'entityreference' || !field_access('edit', $field, $entity_type)) {
    return FALSE;
  }
  return TRUE;
}