You are here

function entityreference_autocomplete_access_callback in Entity reference 7

Same name and namespace in other branches
  1. 8 entityreference.module \entityreference_autocomplete_access_callback()

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.

1 string reference to 'entityreference_autocomplete_access_callback'
entityreference_menu in ./entityreference.module
Implements hook_menu().

File

./entityreference.module, line 1011
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;
}