using System;
namespace Umbraco.Core.PropertyEditors
{
///
/// Allows for specifying an attribute on a property of a custm PreValueEditor to be included in the field list. OTherwise it can be attributed
/// on a custom implemention of a PreValueField to have the properties auto-filled.
///
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = false)]
public class PreValueFieldAttribute : Attribute
{
///
/// Used when specifying a PreValueFieldType
///
public PreValueFieldAttribute(Type preValueFieldType)
{
PreValueFieldType = preValueFieldType;
}
public PreValueFieldAttribute(string key, string name, string view)
{
Key = key;
Name = name;
View = view;
}
public PreValueFieldAttribute(string name, string view)
{
Name = name;
View = view;
}
///
/// The description to display for the pre-value field
///
public string Description { get; set; }
///
/// The key to store the pre-value against in the databaes
///
///
/// If this is not specified and the attribute is being used at the property level then the property name will become the key
///
public string Key { get; private set; }
///
/// The name (label) of the pre-value field
///
public string Name { get; private set; }
///
/// The view to use to render the pre-value field
///
public string View { get; private set; }
///
/// Whether or not to hide the label for the pre-value field
///
public bool HideLabel { get; set; }
///
/// This can be used when assigned to a property which will attempt to create the type
/// of PreValueField declared and assign it to the fields. Any property declared on this
/// attribute will get overwritten on the class that is instantiated.
///
public Type PreValueFieldType { get; set; }
}
}