You are here

public static function ResourceTypeBuildEvent::createFromEntityTypeAndBundle in Drupal 8

Same name and namespace in other branches
  1. 9 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(sprintf('%s--%s', $entity_type
    ->id(), $bundle), $fields);
}