Added some docs about tag support.
This commit is contained in:
@@ -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<string>`
|
||||
* This setting might be handy if you need to dynamically (in c#) generate the tags list
|
||||
|
||||
### Manifest
|
||||
|
||||
*Coming soon!*
|
||||
@@ -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
|
||||
TODO: SD: Write this article! :)
|
||||
Reference in New Issue
Block a user