diff --git a/src/Umbraco.Web.UI.Client/docs/src/tutorials/Tag-Enabled-Property-Editors.ngdoc b/src/Umbraco.Web.UI.Client/docs/src/tutorials/Tag-Enabled-Property-Editors.ngdoc new file mode 100644 index 0000000000..ef1fe84f00 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/docs/src/tutorials/Tag-Enabled-Property-Editors.ngdoc @@ -0,0 +1,52 @@ +@ngdoc overview +@name Adding tag support to property editors +@description + +##What is tag support? + +This document will explain how to add tagging support to property editors and what tagging support means. A property editor that has tag support enabled means +that any time a document is published (or saved in the case of media/members) that has a property editor with tagging support, the tags the are exposed +by these property editors will be saved into the tag table in the database and associated with the corresponding document property. This then allows you +to query or render content based on tags on the front-end. + +*NOTE: The documentation for querying tag data is coming soon....* + +##Enabling tag support + +This will explain both ways to enable tag support for property editors: both in c# or by the manifest. + +### CSharp + +Like creating a normal c# property editor you start by declaring a class with the PropertyEditor attribute: + + [PropertyEditor("tags", "Tags", "tags")] + public class TagsPropertyEditor : PropertyEditor + { + } + +To add tag support, we simply add the SupportsTags attribute: + + [SupportTags] + [PropertyEditor(Constants.PropertyEditors.TagsAlias, "Tags", "readonlyvalue")] + public class TagsPropertyEditor : PropertyEditor + { + } + +There are a few options for the `SupportsTag` attribute but normally the default options will suffice. +The default options are: + +* Requires that the property editor value is a comma delimited string value +* Will replace the current property's tags in the tags database table with the ones in the value +* Will add all tags as part of the 'default' tag group in the database table + +These options can all be changed on the attribute, you can specify a different delimiter, you can specify whether to replace or append the tags associated with the property and you can specify a different tag group. + +There is one last option that can be set which is the `TagValueType` enum, the values can be: + +* `FromDelimitedValue` - this is the default +* `CustomTagList` - if this is used then it is expected that the property editor's value (returned from the method `ConvertEditorToDb`) is an `IEnumerable` + * This setting might be handy if you need to dynamically (in c#) generate the tags list + +### Manifest + +*Coming soon!* \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/docs/src/tutorials/Validation.ngdoc b/src/Umbraco.Web.UI.Client/docs/src/tutorials/Validation.ngdoc index d57f94b8fa..0deec77570 100644 --- a/src/Umbraco.Web.UI.Client/docs/src/tutorials/Validation.ngdoc +++ b/src/Umbraco.Web.UI.Client/docs/src/tutorials/Validation.ngdoc @@ -4,6 +4,4 @@ ##Overview -First, I'll explain the validation system in the manifest: -The validation specified in the manifest is for server side only. Client side validation needs to be put into markup (I will write up a whole thing on the full validation process real soon!). Preferably a dev (and ourselves) will setup the same client side validation as the server side validation but the most important validation is server side so people cannot hack stuff. -Each validation item in the validation array specifies a validation type that is executed against the posted value. What this means is that manifest based property editors will generally only be able to store 'simple' values, otherwise are auto-validation will not \ No newline at end of file +TODO: SD: Write this article! :) \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs index c5873eb592..dfbe527178 100644 --- a/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs @@ -4,6 +4,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { //STUB FOR FUTURE USE - need to declare one for the upgrade to work! + [SupportTags] [PropertyEditor(Constants.PropertyEditors.TagsAlias, "Tags", "readonlyvalue")] public class TagsPropertyEditor : PropertyEditor {