You are here

protected function ResourceFieldEntity::fieldValue in RESTful 7.2

Get value from a property.

Parameters

\EntityMetadataWrapper $property_wrapper: The property wrapper. Either \EntityDrupalWrapper or \EntityListWrapper.

Return value

mixed A single or multiple values.

2 calls to ResourceFieldEntity::fieldValue()
ResourceFieldEntity::propertyIdentifier in src/Plugin/resource/Field/ResourceFieldEntity.php
Helper function to get the identifier from a property wrapper.
ResourceFieldEntity::singleValue in src/Plugin/resource/Field/ResourceFieldEntity.php
Returns the value for the current single field.

File

src/Plugin/resource/Field/ResourceFieldEntity.php, line 478
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldEntity

Class

ResourceFieldEntity
Class ResourceFieldEntity.

Namespace

Drupal\restful\Plugin\resource\Field

Code

protected function fieldValue(\EntityMetadataWrapper $property_wrapper) {
  if ($this
    ->getSubProperty() && $property_wrapper
    ->value()) {
    $property_wrapper = $property_wrapper->{$this
      ->getSubProperty()};
  }

  // Wrapper method.
  return $property_wrapper
    ->{$this
    ->getWrapperMethod()}();
}