You are here

public function ResourceFieldBase::getMetadata in RESTful 7.2

Add metadata to the field.

This is a general purpose metadata storage for the field to store other things that are not specifically the field value.

Parameters

string $key: The metadata item identifier.

Return value

mixed The metadata value.

Overrides ResourceFieldInterface::getMetadata

File

src/Plugin/resource/Field/ResourceFieldBase.php, line 323
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldBase.

Class

ResourceFieldBase

Namespace

Drupal\restful\Plugin\resource\Field

Code

public function getMetadata($key) {
  $path = explode(':', $key);
  $leave = array_pop($path);
  $element = $this
    ->internalMetadataElement($key);
  return isset($element[$leave]) ? $element[$leave] : NULL;
}