public MediaBuilder WithMediaType(IMediaType mediaType) { _mediaTypeBuilder = null; _mediaType = mediaType; return(this); }
public static MediaType CreateVideoMediaType() { var builder = new MediaTypeBuilder(); IMediaType mediaType = builder .WithAlias("video") .WithName("Video") .AddPropertyGroup() .WithName("Media") .WithSortOrder(1) .AddPropertyType() .WithAlias("title") .WithName("Title") .WithSortOrder(1) .Done() .AddPropertyType() .WithAlias("videoFile") .WithName("Video file") .WithSortOrder(1) .Done() .Done() .Build(); // Ensure that nothing is marked as dirty mediaType.ResetDirtyProperties(false); return((MediaType)mediaType); }
public MediaTypeBuilder AddMediaType() { _mediaType = null; var builder = new MediaTypeBuilder(this); _mediaTypeBuilder = builder; return(builder); }
private static MediaType CreateImageMediaType(string alias, string imageFieldPropertyEditorAlias, int imageFieldDataTypeId) { var builder = new MediaTypeBuilder(); IMediaType mediaType = builder .WithAlias(alias) .WithName("Image") .AddPropertyGroup() .WithName("Media") .WithSortOrder(1) .AddPropertyType() .WithPropertyEditorAlias(imageFieldPropertyEditorAlias) .WithAlias(Constants.Conventions.Media.File) .WithName("File") .WithSortOrder(1) .WithDataTypeId(imageFieldDataTypeId) .Done() .AddPropertyType() .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.Label) .WithAlias(Constants.Conventions.Media.Width) .WithName("Width") .WithSortOrder(2) .WithDataTypeId(Constants.System.DefaultLabelDataTypeId) .Done() .AddPropertyType() .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.Label) .WithAlias(Constants.Conventions.Media.Height) .WithName("Height") .WithSortOrder(3) .WithDataTypeId(Constants.System.DefaultLabelDataTypeId) .Done() .AddPropertyType() .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.Label) .WithAlias(Constants.Conventions.Media.Bytes) .WithName("Bytes") .WithSortOrder(4) .WithDataTypeId(Constants.System.DefaultLabelDataTypeId) .Done() .AddPropertyType() .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.Label) .WithAlias(Constants.Conventions.Media.Extension) .WithName("File Extension") .WithSortOrder(5) .WithDataTypeId(Constants.System.DefaultLabelDataTypeId) .Done() .Done() .Build(); // Ensure that nothing is marked as dirty mediaType.ResetDirtyProperties(false); return((MediaType)mediaType); }
public static MediaType CreateSimpleMediaType(string alias, string name, IMediaType parent = null, bool randomizeAliases = false, string propertyGroupAlias = "content", string propertyGroupName = "Content") { var builder = new MediaTypeBuilder(); IMediaType mediaType = builder .WithAlias(alias) .WithName(name) .WithParentContentType(parent) .AddPropertyGroup() .WithAlias(propertyGroupAlias) .WithName(propertyGroupName) .WithSortOrder(1) .AddPropertyType() .WithAlias(RandomAlias("title", randomizeAliases)) .WithName("Title") .WithSortOrder(1) .Done() .AddPropertyType() .WithPropertyEditorAlias(Constants.PropertyEditors.Aliases.TinyMce) .WithValueStorageType(ValueStorageType.Ntext) .WithAlias(RandomAlias("bodyText", randomizeAliases)) .WithName("Body text") .WithSortOrder(2) .WithDataTypeId(-87) .Done() .AddPropertyType() .WithAlias(RandomAlias("author", randomizeAliases)) .WithName("Author") .WithSortOrder(3) .Done() .Done() .Build(); // Ensure that nothing is marked as dirty mediaType.ResetDirtyProperties(false); return((MediaType)mediaType); }