You are here

protected function RestfulEntityBase::getFieldInfoAndFormSchema in RESTful 7

Get the field info, data and form element

Parameters

string $field: The field info.

Return value

array Array with the 'info', 'data' and 'form_element' keys.

1 call to RestfulEntityBase::getFieldInfoAndFormSchema()
RestfulEntityBase::addDefaultValuesToPublicFields in plugins/restful/RestfulEntityBase.php
Add default values to the public fields array.

File

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

Class

RestfulEntityBase
An abstract implementation of RestfulEntityInterface.

Code

protected function getFieldInfoAndFormSchema($field) {
  $discovery_info = array();
  $instance_info = field_info_instance($this
    ->getEntityType(), $field['field_name'], $this
    ->getBundle());
  $discovery_info['info']['label'] = $instance_info['label'];
  $discovery_info['info']['description'] = $instance_info['description'];
  $discovery_info['data']['type'] = $field['type'];
  $discovery_info['data']['required'] = $instance_info['required'];
  $discovery_info['form_element']['default_value'] = isset($instance_info['default_value']) ? $instance_info['default_value'] : NULL;
  $discovery_info['form_element']['allowed_values'] = $this
    ->getFormSchemaAllowedValues($field);
  return array(
    'discovery' => $discovery_info,
  );
}