You are here

public function ResourceFieldKeyValue::value in RESTful 7.2

Gets the value for the field given a data source.

Parameters

DataInterpreterInterface $interpreter: The data source object. Interacts with the data storage.

Return value

mixed The value for the public field.

Throws

IncompatibleFieldDefinitionException

Overrides ResourceField::value

File

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

Class

ResourceFieldKeyValue

Namespace

Drupal\restful\Plugin\resource\Field

Code

public function value(DataInterpreterInterface $interpreter) {
  if ($value = parent::value($interpreter)) {
    return $value;
  }
  return $interpreter
    ->getWrapper()
    ->get($this
    ->getProperty());
}