ResourceTypeBuildEvent
class ResourceTypeBuildEvent extends Event (View source)
An event used to configure the construction of a JSON:API resource type.
Properties
| protected null|string | $resourceTypeName | The JSON:API resource type name of the instance to be built. |
|
| protected ResourceTypeField[] | $fields | The fields of the resource type to be built. |
|
| protected bool | $disabled | Whether the JSON:API resource type to be built should be disabled. |
Methods
ResourceTypeBuildEvent constructor.
Creates a new ResourceTypeBuildEvent.
Gets current resource type name of the resource type to be built.
Sets the name of the resource type to be built.
Disables the resource type to be built.
Whether the resource type to be built should be disabled.
Gets the current fields of the resource type to be built.
Sets the public name of the given field on the resource type to be built.
Details
protected
__construct(string $resource_type_name, array $fields)
ResourceTypeBuildEvent constructor.
This constructor is protected by design. Use static::createFromEntityTypeAndBundle() instead.
static ResourceTypeBuildEvent
createFromEntityTypeAndBundle(EntityTypeInterface $entity_type, string $bundle, array $fields)
Creates a new ResourceTypeBuildEvent.
string
getResourceTypeName()
Gets current resource type name of the resource type to be built.
void
setResourceTypeName(string $resource_type_name)
Sets the name of the resource type to be built.
disableResourceType()
Disables the resource type to be built.
bool
resourceTypeShouldBeDisabled()
Whether the resource type to be built should be disabled.
ResourceTypeField[]
getFields()
Gets the current fields of the resource type to be built.
setPublicFieldName(ResourceTypeField $field, string $public_field_name)
Sets the public name of the given field on the resource type to be built.
disableField(ResourceTypeField $field)
Disables the given field on the resource type to be built.