function ResourceTypeBuildEvent::createFromEntityTypeAndBundle

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

Creates a new ResourceTypeBuildEvent.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: An entity type for the resource type to be built.

string $bundle: A bundle name for the resource type to be built. If the entity type does not have bundles, the entity type ID.

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

Return value

\Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent A new event.

1 call to ResourceTypeBuildEvent::createFromEntityTypeAndBundle()
ResourceTypeRepository::createResourceType in core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php
Creates a ResourceType value object for the given entity type + bundle.

File

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

Class

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

Namespace

Drupal\jsonapi\ResourceType

Code

public static function createFromEntityTypeAndBundle(EntityTypeInterface $entity_type, $bundle, array $fields) {
    return new static($entity_type->id() . ResourceType::TYPE_NAME_URI_PATH_SEPARATOR . $bundle, $fields);
}

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