Transforms
The basic component of Transform API is transforms. These are objects that implement TransformInterface either directly or through extending TransformBase or PluginTransformBase.
The job of a transform is to represent a component and then transform that into a transform array.
For instance, any url requested to be transformed through the format=json parameter is turned into a RequestPathTransform, which will add BlockTransform(s) and then either create an EntityTransform if the url points to an entity or a RouteTransform otherwise as the main content.
The module itself includes the following transform types:
BlockTransform
Plugins: Transform/Block
These take a transform block and transforms them in the region they are configured for. For more information see the transform block section later.
EntityTransform
Static creation functions: createFromEntity(), createFromMultipleEntities()
Multiple: EntityTransform(s) can be given either a single entity id or an array which will transform multiple entities.
These are used to take a fieldable entity and transform it. It makes use of transform modes (explained later) to get a configuration of FieldTransform(s) that it nests inside it.
FieldTransform
Plugins: Transform/Field
Static creation functions: createFromEntity()
These are used to transform the individual fields on an entity based on the configuration from a transform mode. The plugins for this transform takes certain field types and transforms them in a certain way depending on their configuration.
PagerTransform
This takes a pager as it currently exists in Drupal and transforms it.
RequestPathTransform
This takes a Url, finds transform blocks and finds either a RouteTransform or EntityTransform based on the Url transformed.
RouteTransform
Plugins: Transform/Route
In case a url is not an entity that can be handled using an EntityTransform then this transform will take the route name that normally handles an url and finds a plugin that can transform that route.
SimpleTransform
This transform just takes a normal array and delivers it as a transform array.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion