You are here

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

3 methods override ResourceFieldInterface::addMetadata()
ResourceFieldBase::addMetadata in src/Plugin/resource/Field/ResourceFieldBase.php
Add metadata to the field.
ResourceFieldEntity::addMetadata in src/Plugin/resource/Field/ResourceFieldEntity.php
Add metadata to the field.
ResourceFieldResource::addMetadata in src/Plugin/resource/Field/ResourceFieldResource.php
Add metadata to the field.

File

src/Plugin/resource/Field/ResourceFieldInterface.php, line 182
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldInterface.

Class

ResourceFieldInterface

Namespace

Drupal\restful\Plugin\resource\Field

Code

public function addMetadata($key, $value);