public static IEnumerable <Content> CreateMultipleTextpageContent(IContentType contentType, int parentId, int amount) { var list = new List <Content>(); for (var i = 0; i < amount; i++) { var name = "Textpage No-" + i; Content content = new ContentBuilder() .WithName(name) .WithParentId(parentId) .WithContentType(contentType) .WithPropertyValues(new { title = name + " title", bodyText = $"This is a textpage based on the {contentType.Alias} ContentType", keywords = "text,page,meta", description = "This is the meta description for a textpage" }) .Build(); list.Add(content); } return(list); }
public static Content CreateAllTypesContent(IContentType contentType, string name, int parentId) { Content content = new ContentBuilder() .WithName(name) .WithParentId(parentId) .WithContentType(contentType) .Build(); content.SetValue("isTrue", true); content.SetValue("number", 42); content.SetValue("bodyText", "Lorem Ipsum Body Text Test"); content.SetValue("singleLineText", "Single Line Text Test"); content.SetValue("multilineText", "Multiple lines \n in one box"); content.SetValue("upload", "/media/1234/koala.jpg"); content.SetValue("label", "Non-editable label"); content.SetValue("dateTime", DateTime.Now.AddDays(-20)); content.SetValue("colorPicker", "black"); content.SetValue("ddlMultiple", "1234,1235"); content.SetValue("rbList", "random"); content.SetValue("date", DateTime.Now.AddDays(-10)); content.SetValue("ddl", "1234"); content.SetValue("chklist", "randomc"); content.SetValue("contentPicker", Udi.Create(Constants.UdiEntityType.Document, new Guid("74ECA1D4-934E-436A-A7C7-36CC16D4095C")).ToString()); content.SetValue("mediaPicker", Udi.Create(Constants.UdiEntityType.Media, new Guid("44CB39C8-01E5-45EB-9CF8-E70AAF2D1691")).ToString()); content.SetValue("memberPicker", Udi.Create(Constants.UdiEntityType.Member, new Guid("9A50A448-59C0-4D42-8F93-4F1D55B0F47D")).ToString()); content.SetValue("multiUrlPicker", "[{\"name\":\"https://test.com\",\"url\":\"https://test.com\"}]"); content.SetValue("tags", "this,is,tags"); return(content); }
public static Content CreateSimpleContent(IContentType contentType, string name, IContent parent, string culture = null, string segment = null, bool setPropertyValues = true) { ContentBuilder builder = new ContentBuilder() .WithContentType(contentType) .WithName(name) .WithParent(parent); if (!(culture is null)) { builder = builder.WithCultureName(culture, name); } if (setPropertyValues) { builder = builder.WithPropertyValues( new { title = name + " Subpage", bodyText = "This is a subpage", author = "John Doe" }, culture, segment); } Content content = builder.Build(); content.ResetDirtyProperties(false); return(content); }