You are here

protected static function PublicFieldInfoEntity::formSchemaHasAllowedValues in RESTful 7.2

Determines if a field has allowed values.

If Field is reference, and widget is autocomplete, so for performance reasons we do not try to grab all the referenced entities.

Parameters

array $field: The field info array.

array $field_instance: The instance info array.

Return value

bool TRUE if a field should be populated with the allowed values.

File

src/Plugin/resource/Field/PublicFieldInfo/PublicFieldInfoEntity.php, line 137
Contains \Drupal\restful\Plugin\resource\Field\PublicFieldInfo\PublicFieldInfoEntity.

Class

PublicFieldInfoEntity

Namespace

Drupal\restful\Plugin\resource\Field\PublicFieldInfo

Code

protected static function formSchemaHasAllowedValues($field, $field_instance) {
  $field_types = array(
    'entityreference',
    'taxonomy_term_reference',
    'field_collection',
    'commerce_product_reference',
  );
  $widget_types = array(
    'taxonomy_autocomplete',
    'entityreference_autocomplete',
    'entityreference_autocomplete_tags',
    'commerce_product_reference_autocomplete',
  );
  return !in_array($field['type'], $field_types) || !in_array($field_instance['widget']['type'], $widget_types);
}