You are here

public function PublicFieldInfoEntity::getFormSchemaAllowedType in RESTful 7.2

Get the form type for the form schema.

Using Field API's "Options" module to get the allowed values.

Return value

mixed The form element type.

Overrides PublicFieldInfoEntityInterface::getFormSchemaAllowedType

File

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

Class

PublicFieldInfoEntity

Namespace

Drupal\restful\Plugin\resource\Field\PublicFieldInfo

Code

public function getFormSchemaAllowedType() {
  if (!module_exists('options')) {
    return NULL;
  }
  $field_name = $this->property;
  if (!($field_info = field_info_field($field_name))) {
    return NULL;
  }
  if (!($field_instance = field_info_instance($this->entityType, $field_name, $this->bundle))) {
    return NULL;
  }
  return $field_instance['widget']['type'];
}