You are here

public function ResourceFieldResource::addMetadata 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.

You can pass in a namespaced $key using a : as a delimiter. Namespaces will result in nested arrays. That means that addMetadata('foo:bar:baz', 'oof') will result in metadata['foo']['bar']['baz'] = 'oof'.

Parameters

string $key: The metadata item identifier.

mixed $value: The metadata value.

Overrides ResourceFieldInterface::addMetadata

File

src/Plugin/resource/Field/ResourceFieldResource.php, line 187
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldResource.

Class

ResourceFieldResource

Namespace

Drupal\restful\Plugin\resource\Field

Code

public function addMetadata($key, $value) {
  $this->decorated
    ->addMetadata($key, $value);
}