You are here

public function LinkCollection::withContext in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/JsonApiResource/LinkCollection.php \Drupal\jsonapi\JsonApiResource\LinkCollection::withContext()
  2. 9 core/modules/jsonapi/src/JsonApiResource/LinkCollection.php \Drupal\jsonapi\JsonApiResource\LinkCollection::withContext()

Establishes a new context for a LinkCollection.

Parameters

\Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel|\Drupal\jsonapi\JsonApiResource\ResourceObject|\Drupal\jsonapi\JsonApiResource\Relationship $context: The new context object.

Return value

static A new LinkCollection with the given context.

File

core/modules/jsonapi/src/JsonApiResource/LinkCollection.php, line 122

Class

LinkCollection
Contains a set of JSON:API Link objects.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function withContext($context) {
  return new static($this->links, $context);
}