Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Heres an example of the code im working with that hopefully should be more clear.
[Display(
Name = "Page Banner",
Description = "The image appearing in the hero area.",
GroupName = SystemTabNames.Content,
Order = 300)]
[UIHint(UIHint.Image)]
public virtual ContentReference PageBanner{ get; set; }
I'd have a folder called /For All Sites/Landing Pages/Page Banners
I'd like to require the user, when editing the property PageBanner to be required to select an image or upload to the mentioned folder.
I suppose you could solve this using Custom validation. Here is a couple of examples:
http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Content/Properties/Property-types/Writing-custom-attributes/
http://henrikm.com/custom-episerver-property-validation/
Hello Timothy
I have not tried this with image selection but I think this post on changing the root for content references may contain the answer you are looking for:
https://gregwiechec.com/2015/12/changing-root-for-content-references-property/
Let me know how you get on.
David
That sounds like a much better way to handle it than custom validation :-)
I think thats pretty much exactly what I was looking for David, thank you very much. I figured this would be built in but it seems like a simple enough solution.
Hi all,
I'm looking for an answer to the following question (or at least where to look in the forums/documentation, as I havent had any luck yet.):
I want to require a content author to select/upload images from a specific folder for a specific ContentReference property w/ UIHint.Image on a page type. Basically the situation would be having a shared folder for a page type to store images in under the For All Sites media folder, for example: /For All Sites/LandingPage/SomeLandingPageSpecificImageFolder .
Thanks!