I've been spending some time setting up some custom Entities in Content Hub recently. I bumped up against an issue with one feature where it took me a while to find the right info to make it work the way I wanted.
What I was up to...
url copied!
I was setting up a new entity. To do that I needed to:
- Configure the schema for the new Entity
- Create Pages for listing, creating and editing entities
The entity in question needed to have a few fields, but the important one here is that it needed to be associated with an image which was going to be the thumbnail / display image for the entity. It needed to work much like the listing and details for PCM Product entities that I've written about before.
But once I'd gone through what I thought was important there, I found that setting the image for the entity did not make the thumbnail or the details page images show up.
So what was I missing?
Solving the problem
url copied!
To make it work, I found I needed to do the following:
Firstly, the the image field:
url copied!
- You need a relation field to
M.Assetto link your asset to an image. -
The pattern in other entities is to name the field
<EntityName>ToMasterAsset. I'm not sure if the name really matters, but I followed this pattern for clarity. (The display name can be whatever you need, of course) - In the "Advanced" tab of the field's properties you need to ensure that "Is rendition relation" option is turned on. You can only have one field with this set on an Entity. This was the bit that I'd missed, and
it turns out it was the important bit:
Secondly, the listing:
url copied!
When you create your listing, you need to add a "Search Component" to it. In the settings for this you need to enable the
Table
view, and then configure the "Image and icon" settings. This needs to have "Thumbnail (if available)" selected.
You don't have to specify a field for it to use here. It appears to pick up the field you tagged with "Is rendition relation" above.
Thirdly, the image display component:
url copied!
On your details page you need an instance of the
Entity Image Viewer
component. Again, you don't need to specify a field here.
Fourthly, allowing navigating to the image Asset:
url copied!
Optionally you may also want to make the image field clickable so a user can navigate the details page for the selected asset after they've set it.
To do that, when you add your "Entity Details" component to your details page, you need to find the image field in the appropriate field group and click the cog icon to the right of its name.
From that dialog, switch to the "Functionality" tab and make sure the "Detail page" field is set to the "Asset Detail" Page:
And with those in place, it should work correctly:
When you set the "Photo" field here to your required image, it becomes a link to the asset detail page, and you see the correct image displayed on the left hand side. (And also on the search listing for these entities)
↑ Back to top