I created a custom Product entity (let's call it MyProduct) with a field "reward" of type Media.
Code: Select all
@ManyToOne(targetEntity = MediaImpl.class)
@JoinColumn(name = "REWARD_ID")
@AdminPresentation(friendlyName = "reward", fieldType = SupportedFieldType.MEDIA)
private Media reward;
Problem is in admin, when rendered, I got all the Media fields (url, title, altText).
What I want the admin to render in the product detail page, is a picker for the media without all the fields. So I tried to add :
Code: Select all
@AdminPresentationToOneLookup(lookupDisplayProperty = "url")
It then renders what I want (only one field with the media picker), but when a click on the button "Lookup" to choose an image, some are missing when I compare the list to the "Media Assets List".
There's also a difference in the button, when all the Media fields are rendered I got a "Select/Upload image" for the "url" field, but when a add the annotation the button near the field is called "Lookup".
I guess I could use the Media Map of SkuImpl but it means I will have to change its annotation @AdminPresentationMapFields and that's not that easy I think.
So my question is : How should I write a Media field in a custom Entity to render it like the primary media is rendered ? And please, don't tell me to create my own map just for one field
Keep up the good work !
BR,