You are here

public static function ResourceFieldKeyValue::create in RESTful 7.2

Factory.

Parameters

array $field: Contains the field values.

RequestInterface $request: The request.

Return value

ResourceFieldInterface The created field

Throws

ServerConfigurationException

Overrides ResourceField::create

File

src/Plugin/resource/Field/ResourceFieldKeyValue.php, line 18
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldKeyValue.

Class

ResourceFieldKeyValue

Namespace

Drupal\restful\Plugin\resource\Field

Code

public static function create(array $field, RequestInterface $request = NULL) {
  $request = $request ?: restful()
    ->getRequest();
  $resource_field = new static($field, $request);
  $resource_field
    ->addDefaults();
  return $resource_field;
}