FlatTaxonField is used in the same cases as HierarchicalTaxonField, but it associates items to taxa from flat taxonomies (that is, Tags). All built-in content items already have dynamic properties to associate them with Tags, and you can create such properties for custom flat taxonomies. In all those cases, you can use FlatTaxonField.
Taxonomies and taxa are associated with content items through dynamic properties, no matter if you are developing a static module or a dynamic one. With dynamic modules, the definition for the field is created through the UI. With static modules, you have to use the following code.
var tagsField =
DisplayMode = FieldDisplayMode.Write,
TaxonomyId = TaxonomyManager.TagsTaxonomyId,
WrapperTag = HtmlTextWriterTag.Li,
You have to specify several properties. DataFieldName is the name of the dynamic field in the content item that holds the association with the taxon. TaxonomyId is the ID of the flat taxonomy you want to use. WebServiceUrl should always be the default URL of FlatTaxonService. The rest of the properties control the behavior of the field and you can set them according to your preferences.
When you are creating a custom field of type "classification" in any content module, the choice of the widget to select the classification items is available as a dropdown. When you select "Textbox selector", you are in fact selecting FlatTaxonField.
Back To Top