function ResourceResponseTestTrait::getRelationshipLink

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::getRelationshipLink()
  2. 10 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::getRelationshipLink()
  3. 11.x core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::getRelationshipLink()

Creates a relationship link for a given resource identifier and field.

Parameters

array $resource_identifier: A resource identifier for which to create a link.

string $relationship_field_name: The relationship field for which to create a link.

Return value

string The relationship link.

1 call to ResourceResponseTestTrait::getRelationshipLink()
ResourceResponseTestTrait::getRelationshipResponses in core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
Gets an array of relationship responses for the given field names.

File

core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php, line 399

Class

ResourceResponseTestTrait
Utility methods for handling resource responses.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected static function getRelationshipLink(array $resource_identifier, $relationship_field_name) {
    return static::getResourceLink($resource_identifier) . "/relationships/{$relationship_field_name}";
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.