function ResourceTypeBuildEvent::__construct

Same name and namespace in other branches
  1. 8.9.x core/modules/jsonapi/src/ResourceType/ResourceTypeBuildEvent.php \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent::__construct()
  2. 10 core/modules/jsonapi/src/ResourceType/ResourceTypeBuildEvent.php \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent::__construct()
  3. 11.x core/modules/jsonapi/src/ResourceType/ResourceTypeBuildEvent.php \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent::__construct()

ResourceTypeBuildEvent constructor.

This constructor is protected by design. Use static::createFromEntityTypeAndBundle() instead.

Parameters

string $resource_type_name: A JSON:API resource type name.

\Drupal\jsonapi\ResourceType\ResourceTypeField[] $fields: The fields of the resource type to be built.

File

core/modules/jsonapi/src/ResourceType/ResourceTypeBuildEvent.php, line 49

Class

ResourceTypeBuildEvent
An event used to configure the construction of a JSON:API resource type.

Namespace

Drupal\jsonapi\ResourceType

Code

protected function __construct($resource_type_name, array $fields) {
    assert(Inspector::assertAllObjects($fields, ResourceTypeField::class));
    $this->resourceTypeName = $resource_type_name;
    $this->fields = $fields;
}

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