IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
FlatTaxonField in Write mode, used to select tags for a news item.
FlatTaxonField in Read mode, displaying the selected tags for a news item.
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 =
new
FlatTaxonFieldDefinitionElement(section)
{
ID =
"tagsFieldControl"
,
DataFieldName =
"Tags"
DisplayMode = FieldDisplayMode.Write,
ResourceClassId =
typeof
(TaxonomyResources).Name,
TaxonomyId = TaxonomyManager.TagsTaxonomyId,
WebServiceUrl =
"~/Sitefinity/Services/Taxonomies/FlatTaxon.svc"
AllowMultipleSelection =
true
WrapperTag = HtmlTextWriterTag.Li,
Title =
ExpandableDefinitionConfig =
Expanded =
false
ExpandText =
"ClickToAddTags"
(TaxonomyResources).Name
}
};
taxonSection.Fields.Add(tagsField);
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
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important