// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
using Umbraco.Cms.Core.Macros;
namespace Umbraco.Cms.Core.Configuration.Models;
///
/// Typed configuration options for content settings.
///
[UmbracoOptions(Constants.Configuration.ConfigContent)]
public class ContentSettings
{
internal const bool StaticResolveUrlsFromTextString = false;
internal const string StaticDefaultPreviewBadge =
@"
";
internal const string StaticMacroErrors = "Inline";
internal const string StaticDisallowedUploadFiles = "ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,xamlx";
internal const bool StaticShowDeprecatedPropertyEditors = false;
internal const string StaticLoginBackgroundImage = "assets/img/login.svg";
internal const string StaticLoginLogoImage = "assets/img/application/umbraco_logo_white.svg";
internal const bool StaticHideBackOfficeLogo = false;
internal const bool StaticDisableDeleteWhenReferenced = false;
internal const bool StaticDisableUnpublishWhenReferenced = false;
internal const bool StaticAllowEditInvariantFromNonDefault = false;
///
/// Gets or sets a value for the content notification settings.
///
public ContentNotificationSettings Notifications { get; set; } = new();
///
/// Gets or sets a value for the content imaging settings.
///
public ContentImagingSettings Imaging { get; set; } = new();
///
/// Gets or sets a value indicating whether URLs should be resolved from text strings.
///
[DefaultValue(StaticResolveUrlsFromTextString)]
public bool ResolveUrlsFromTextString { get; set; } = StaticResolveUrlsFromTextString;
///
/// Gets or sets a value for the collection of error pages.
///
public ContentErrorPage[] Error404Collection { get; set; } = Array.Empty();
///
/// Gets or sets a value for the preview badge mark-up.
///
[DefaultValue(StaticDefaultPreviewBadge)]
public string PreviewBadge { get; set; } = StaticDefaultPreviewBadge;
///
/// Gets or sets a value for the macro error behaviour.
///
[DefaultValue(StaticMacroErrors)]
public MacroErrorBehaviour MacroErrors { get; set; } = Enum.Parse(StaticMacroErrors);
///
/// Gets or sets a value for the collection of file extensions that are disallowed for upload.
///
[DefaultValue(StaticDisallowedUploadFiles)]
[Obsolete("Please use DisAllowedUploadedFileExtensions instead, scheduled for removal in V13")]
public IEnumerable DisallowedUploadFiles { get; set; } = StaticDisallowedUploadFiles.Split(',');
///
/// Gets or sets a value for the collection of file extensions that are allowed for upload.
///
[Obsolete("Please use AllowedUploadedFileExtensions instead, scheduled for removal in V13")]
public IEnumerable AllowedUploadFiles { get; set; } = Array.Empty();
///
/// Gets or sets a value indicating whether deprecated property editors should be shown.
///
[DefaultValue(StaticShowDeprecatedPropertyEditors)]
public bool ShowDeprecatedPropertyEditors { get; set; } = StaticShowDeprecatedPropertyEditors;
///
/// Gets or sets a value for the path to the login screen background image.
///
[DefaultValue(StaticLoginBackgroundImage)]
public string LoginBackgroundImage { get; set; } = StaticLoginBackgroundImage;
///
/// Gets or sets a value for the path to the login screen logo image.
///
[DefaultValue(StaticLoginLogoImage)]
public string LoginLogoImage { get; set; } = StaticLoginLogoImage;
///
/// Gets or sets a value indicating whether to hide the backoffice umbraco logo or not.
///
[DefaultValue(StaticHideBackOfficeLogo)]
public bool HideBackOfficeLogo { get; set; } = StaticHideBackOfficeLogo;
///
/// Gets or sets a value indicating whether to disable the deletion of items referenced by other items.
///
[DefaultValue(StaticDisableDeleteWhenReferenced)]
public bool DisableDeleteWhenReferenced { get; set; } = StaticDisableDeleteWhenReferenced;
///
/// Gets or sets a value indicating whether to disable the unpublishing of items referenced by other items.
///
[DefaultValue(StaticDisableUnpublishWhenReferenced)]
public bool DisableUnpublishWhenReferenced { get; set; } = StaticDisableUnpublishWhenReferenced;
///
/// Get or sets the model representing the global content version cleanup policy
///
public ContentVersionCleanupPolicySettings ContentVersionCleanupPolicy { get; set; } = new();
///
/// Gets or sets a value indicating whether to allow editing invariant properties from a non-default language variation.
///
[DefaultValue(StaticAllowEditInvariantFromNonDefault)]
public bool AllowEditInvariantFromNonDefault { get; set; } = StaticAllowEditInvariantFromNonDefault;
///
/// Gets or sets a value for the collection of file extensions that are allowed for upload.
///
public string[] AllowedUploadedFileExtensions { get; set; } = Array.Empty();
///
/// Gets or sets a value for the collection of file extensions that are disallowed for upload.
///
[DefaultValue(StaticDisallowedUploadFiles)]
public string[] DisallowedUploadedFileExtensions { get; set; } = StaticDisallowedUploadFiles.Split(',');
///
/// Gets or sets the allowed external host for media. If empty only relative paths are allowed.
///
public string[] AllowedMediaHosts { get; set; } = Array.Empty();
}