staticAssetUrlPrefix = "";
} else {
imageUrl = staticAssetUrlPrefix + imageUrl;
}
MediaField mf = (MediaField) new MediaField()
.withName("thumbnail")
.withFriendlyName("Asset_thumbnail")
.withFieldType(SupportedFieldType.IMAGE.toString())
.withOrder(Integer.MIN_VALUE)
.withValue(imageUrl);
// Add a hidden field for the large thumbnail path
record.getHiddenFields().add(new Field()
.withName("cmsUrlPrefix")
.withValue(staticAssetUrlPrefix));
record.getHiddenFields().add(new Field()
.withName("thumbnailKey")
.withValue("?smallAdminThumbnail"));
record.getHiddenFields().add(new Field()
.withName("servletContext")
.withValue(BroadleafRequestContext.getBroadleafRequestContext().getRequest().getContextPath()));
// Set the height value on this field
mf.setHeight(operationMap.getNamedOperations().get("smallAdminThumbnail").get("resize-height-amount"));
record.getFields().add(mf);
// Since we've added a new field, we need to clear the cached map to ensure it will display
record.clearFieldMap();
}