Defining the Asset model
This article explains how to set up the asset model in Prepr to add fields to assets and to enable localization.
Introduction
The Asset model is a model that's part of the Prepr Schema and Shared schema by default and cannot be deleted. The Asset model allows you to define additional fields and to enable localization for all assets.
The Asset model is available by default when you create a new environment.
For existing environments, contact Prepr Support (opens in a new tab) to request the Asset model.
You need at least the GraphQL API version 2024-05-15
to use it in your environment.
Asset fields
The fields listed below are the core fields always available in an asset. These fields are also used for internal purposes, for example: in thumbnails, media browser, for Alt text, etc.
- Internal name - This field is required and is used to enter the Title of the asset.
- Author - This optional field can be used to enter the name of the photographer or the visual designer of the asset.
- Description - This optional field is used by editors to describe the asset.
These core fields cannot be removed or redefined in the Asset model.
Add fields to the Asset model
Sometimes the front end app needs more information about the asset beyond the Title, Description and Author. For example: If there is a requirement to display the copyright information with the image. In this case you can add more fields to the assets with the following steps:
- From the Schema tab, click the Asset model.
- Drag and drop one of the field types from the list on the right into the model. The following field types are available when adding fields to the assets:
- Text - Use this type to allow content editors to enter details like copyright information. The following settings are not available on the Text fields in the Asset model:
- Unique constraint validation
- Allowing scripts
- AI features
- Links option (in the HTML editor)
- Boolean - Use this field type to set a True/False indicator in the assets.
- List - Use the list field type for content editors to select values from an enumeration.
- Number - Use this field type to store number-related info in the assets.
- Text - Use this type to allow content editors to enter details like copyright information. The following settings are not available on the Text fields in the Asset model:
Field validations are triggered when a content editor saves an asset in the Media library or when an existing asset is changed through the Mutation API. Validations are not triggered when a new asset is uploaded through the API.
Enable localization in assets
In some cases, content editors need to enter asset information in different languages or define different info depending on the locale. For example: To include cultural context and nuances. To allow content editors to do this, you can enable localization in the Asset model with the following steps:
- Click the Schema tab to open the Schema Editor.
- Click the Asset model.
- At the top of the model, click Settings to open the setting options.
- Enable the Localization toggle to make language variants visible for users to edit in the assets.
Was this article helpful?
We’d love to learn from your feedback