interface LinkManagerInterface implements TypeLinkManagerInterface, RelationLinkManagerInterface (View source)

Interface implemented by link managers.

There are no explicit methods on the manager interface. Instead link managers broker the interactions of the different components, and therefore must implement each component interface, which is enforced by this interface extending all of the component ones.

While a link manager may directly implement these interface methods with custom logic, it is expected to be more common for plugin managers to proxy the method invocations to the respective components.

Methods

$this
setLinkDomain(string $domain)

Sets the link domain used in constructing link URIs.

string
getTypeUri($entity_type, $bundle, array $context = [])

Gets the URI that corresponds to a bundle.

array|bool
getTypeInternalIds(string $type_uri, array $context = [])

Get a bundle's Typed Data IDs based on a URI.

string
getRelationUri(string $entity_type, string $bundle, string $field_name, array $context = [])

Gets the URI that corresponds to a field.

array
getRelationInternalIds(string $relation_uri)

Translates a REST URI into internal IDs.

Details

$this setLinkDomain(string $domain)

Sets the link domain used in constructing link URIs.

Parameters

string $domain

The link domain to use for constructing link URIs.

Return Value

$this

string getTypeUri($entity_type, $bundle, array $context = [])

Gets the URI that corresponds to a bundle.

When using hypermedia formats, this URI can be used to indicate which bundle the data represents. Documentation about required and optional fields can also be provided at this URI.

Parameters

$entity_type

The bundle's entity type.

$bundle

The bundle name.

array $context

(optional) Optional serializer/normalizer context.

Return Value

string

The corresponding URI for the bundle.

array|bool getTypeInternalIds(string $type_uri, array $context = [])

Get a bundle's Typed Data IDs based on a URI.

Parameters

string $type_uri

The type URI.

array $context

Context from the normalizer/serializer operation.

Return Value

array|bool

If the URI matches a bundle, returns an array containing entity_type and bundle. Otherwise, returns false.

string getRelationUri(string $entity_type, string $bundle, string $field_name, array $context = [])

Gets the URI that corresponds to a field.

When using hypermedia formats, this URI can be used to indicate which field the data represents. Documentation about this field can also be provided at this URI.

Parameters

string $entity_type

The bundle's entity type.

string $bundle

The bundle name.

string $field_name

The field name.

array $context

(optional) Optional serializer/normalizer context.

Return Value

string

The corresponding URI (or IANA link relation type) for the field.

array getRelationInternalIds(string $relation_uri)

Translates a REST URI into internal IDs.

Parameters

string $relation_uri

Relation URI (or IANA link relation type) to transform into internal IDs.

Return Value

array

Array with keys 'entity_type_id', 'bundle' and 'field_name'. For backwards compatibility, the entity_type key returns the full entity type object, this will be removed before Drupal 9.0.