class ResourceTypeRepository in Layout Builder Symmetric Translations 8
Hierarchy
- class \Drupal\jsonapi\ResourceType\ResourceTypeRepository implements ResourceTypeRepositoryInterface
- class \Drupal\layout_builder_st\ResourceTypeRepository
Expanded class hierarchy of ResourceTypeRepository
1 file declares its use of ResourceTypeRepository
- LayoutBuilderEntityViewDisplayTest.php in tests/
src/ Functional/ Jsonapi/ LayoutBuilderEntityViewDisplayTest.php
File
- src/
ResourceTypeRepository.php, line 9
Namespace
Drupal\layout_builder_stView source
class ResourceTypeRepository extends CoreResourceTypeRepository {
/**
* {@inheritdoc}
*/
protected function createResourceType(EntityTypeInterface $entity_type, $bundle) {
if ($entity_type
->id() === 'entity_view_display') {
// In order to prevent the raw layout section data from being exposed via
// the HTTP API, we need to make sure that the entity type is using the
// core entity class for this resource type, rather than our specialized
// one. However, we only want this to be a momentary override; we do NOT
// want it to persist in the entity type manager's cached entity type
// definitions. So, to prevent that from happening, we clone the entity
// type definition, modify it, and send the modified doppelgänger to the
// parent method.
$entity_type = clone $entity_type;
$entity_type
->setClass(LayoutBuilderEntityViewDisplay::class);
}
return parent::createResourceType($entity_type, $bundle);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ResourceTypeRepository:: |
protected | property | The cache backend. | |
ResourceTypeRepository:: |
protected | property | Cache tags used for caching the repository. | |
ResourceTypeRepository:: |
protected | property | The entity field manager. | |
ResourceTypeRepository:: |
protected | property | The bundle manager. | |
ResourceTypeRepository:: |
protected | property | The entity type manager. | |
ResourceTypeRepository:: |
protected | property | The event dispatcher. | |
ResourceTypeRepository:: |
public | function |
Gets all JSON:API resource types. Overrides ResourceTypeRepositoryInterface:: |
|
ResourceTypeRepository:: |
protected | function | Calculates relatable JSON:API resource types for a given resource type. | |
ResourceTypeRepository:: |
protected | function |
Creates a ResourceType value object for the given entity type + bundle. Overrides ResourceTypeRepository:: |
|
ResourceTypeRepository:: |
public | function |
Gets a specific JSON:API resource type based on entity type ID and bundle. Overrides ResourceTypeRepositoryInterface:: |
|
ResourceTypeRepository:: |
protected | function | Gets all bundle IDs for a given entity type. | |
ResourceTypeRepository:: |
protected | function | Gets all field names for a given entity type and bundle. | |
ResourceTypeRepository:: |
public | function |
Gets a specific JSON:API resource type based on a supplied typename. Overrides ResourceTypeRepositoryInterface:: |
|
ResourceTypeRepository:: |
protected | function | Gets the field mapping for the given field names and entity type + bundle. | |
ResourceTypeRepository:: |
protected | function | Gets the field mapping for the given field names and entity type + bundle. | 1 |
ResourceTypeRepository:: |
protected | function | Get relatable resource types from a field definition. | |
ResourceTypeRepository:: |
protected static | function | Whether an entity type + bundle maps to a locatable resource type. | |
ResourceTypeRepository:: |
protected static | function | Whether an entity type + bundle maps to a mutable resource type. | |
ResourceTypeRepository:: |
protected | function | Determines if a given field definition is a reference field. | |
ResourceTypeRepository:: |
protected static | function | Whether an entity type is a versionable resource type. | |
ResourceTypeRepository:: |
public | function | Instantiates a ResourceTypeRepository object. |