mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.8 KiB
78 lines
1.8 KiB
// ==========================================================================
|
|
// FieldProperties.cs
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex Group
|
|
// All rights reserved.
|
|
// ==========================================================================
|
|
|
|
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using Squidex.Infrastructure;
|
|
|
|
namespace Squidex.Core.Schemas
|
|
{
|
|
public abstract class FieldProperties : NamedElementPropertiesBase, IValidatable
|
|
{
|
|
private bool isRequired;
|
|
private bool isLocalizable;
|
|
private bool isListField;
|
|
private string placeholder;
|
|
|
|
public bool IsRequired
|
|
{
|
|
get { return isRequired; }
|
|
set
|
|
{
|
|
ThrowIfFrozen();
|
|
|
|
isRequired = value;
|
|
}
|
|
}
|
|
|
|
public bool IsLocalizable
|
|
{
|
|
get { return isLocalizable; }
|
|
set
|
|
{
|
|
ThrowIfFrozen();
|
|
|
|
isLocalizable = value;
|
|
}
|
|
}
|
|
|
|
public bool IsListField
|
|
{
|
|
get { return isListField; }
|
|
set
|
|
{
|
|
ThrowIfFrozen();
|
|
|
|
isListField = value;
|
|
}
|
|
}
|
|
|
|
public string Placeholder
|
|
{
|
|
get { return placeholder; }
|
|
set
|
|
{
|
|
ThrowIfFrozen();
|
|
|
|
placeholder = value;
|
|
}
|
|
}
|
|
|
|
public abstract JToken GetDefaultValue();
|
|
|
|
public void Validate(IList<ValidationError> errors)
|
|
{
|
|
foreach (var error in ValidateCore())
|
|
{
|
|
errors.Add(error);
|
|
}
|
|
}
|
|
|
|
protected abstract IEnumerable<ValidationError> ValidateCore();
|
|
}
|
|
}
|