You are here

protected function RestfulEntityBase::formSchemaHasAllowedValues in RESTful 7

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 $instance: The instance info array.

Return value

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

1 call to RestfulEntityBase::formSchemaHasAllowedValues()
RestfulEntityBase::getFormSchemaAllowedValues in plugins/restful/RestfulEntityBase.php
Get allowed values for the form schema.

File

plugins/restful/RestfulEntityBase.php, line 1428
Contains RestfulEntityBase.

Class

RestfulEntityBase
An abstract implementation of RestfulEntityInterface.

Code

protected function formSchemaHasAllowedValues($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($instance['widget']['type'], $widget_types);
}