function ResourceTypeRelationship::withRelatableResourceTypes

Establishes the relatable resource types of this field.

Parameters

array $resource_types: The array of relatable resource types.

Return value

static A new instance of the field with the given relatable resource types.

File

core/modules/jsonapi/src/ResourceType/ResourceTypeRelationship.php, line 34

Class

ResourceTypeRelationship
Specialization of a ResourceTypeField to represent a resource relationship.

Namespace

Drupal\jsonapi\ResourceType

Code

public function withRelatableResourceTypes(array $resource_types) {
  $relationship = new static($this->internalName, $this->publicName, $this->enabled, $this->hasOne);
  $relationship->relatableResourceTypes = $resource_types;
  return $relationship;
}

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