You are here

public function ResourceField::__construct in RESTful 7.2

Constructor.

Parameters

array $field: Contains the field values.

Throws

ServerConfigurationException

1 call to ResourceField::__construct()
ResourceFieldDbColumn::__construct in src/Plugin/resource/Field/ResourceFieldDbColumn.php
Constructor.
1 method overrides ResourceField::__construct()
ResourceFieldDbColumn::__construct in src/Plugin/resource/Field/ResourceFieldDbColumn.php
Constructor.

File

src/Plugin/resource/Field/ResourceField.php, line 25
Contains \Drupal\restful\Plugin\resource\ResourceField.

Class

ResourceField

Namespace

Drupal\restful\Plugin\resource\Field

Code

public function __construct(array $field, RequestInterface $request) {
  $this
    ->setRequest($request);
  if (empty($field['public_name'])) {
    throw new ServerConfigurationException('No public name provided in the field mappings.');
  }
  $this->publicName = $field['public_name'];
  $this->accessCallbacks = isset($field['access_callbacks']) ? $field['access_callbacks'] : $this->accessCallbacks;
  $this->property = isset($field['property']) ? $field['property'] : $this->property;

  // $this->column = isset($field['column']) ? $field['column'] : $this->column;
  $this->callback = isset($field['callback']) ? $field['callback'] : $this->callback;
  $this->processCallbacks = isset($field['process_callbacks']) ? $field['process_callbacks'] : $this->processCallbacks;
  $this->resource = isset($field['resource']) ? $field['resource'] : $this->resource;
  $this->methods = isset($field['methods']) ? $field['methods'] : $this->methods;

  // Store the definition, useful to access custom keys on custom resource
  // fields.
  $this->definition = $field;
}