I have made an ImageBlock with an ImageUrl property and a Description property. The ImageUrl is required.
[ContentType(
DisplayName = "Image",
Description = "Image with description and caption",
GUID = "387A029C-F193-403C-89C9-375A2A6BF028",
AvailableInEditMode = false)]
public class ImageBlock : BaseBlock
{
[Required]
[UIHint(UIHint.Image)]
[Display(
Name = "Image Url",
Description = "",
GroupName = SystemTabNames.Content,
Order = 10)]
public virtual Url ImageUrl { get; set; }
[Display(
Name = "Image Description",
Description = "A description of the image",
GroupName = SystemTabNames.Content,
Order = 20)]
public virtual string Description { get; set; }
}
My ArticlePage uses this ImageBlock for its Image property, but it's not required to have an image in the article. However, if the editor chooses to have an image, the url should be required.
[Display(
Name = "Image",
Description = "",
GroupName = SystemTabNames.Content,
Order = 20)]
public virtual ImageBlock Image { get; set; }
But when I create a new instance of an ArticlePage I am prompted for the ImageUrl which EPiServer claims is required. Am I missing something?
I have made an ImageBlock with an ImageUrl property and a Description property. The ImageUrl is required.
My ArticlePage uses this ImageBlock for its Image property, but it's not required to have an image in the article. However, if the editor chooses to have an image, the url should be required.
But when I create a new instance of an ArticlePage I am prompted for the ImageUrl which EPiServer claims is required. Am I missing something?