"Categories and tags" section in Custom Module
Any chance anyone knows how I go about imeplementing, "Categories and tags" section which is found in the Events module, in a custom module?
Thanks
R
Are you planning to use this in a custom, content-based module? This section is specified using definitions. For a walkthrough on how definitions are used to create the backend, see this post
Creating Sitefinity 4 Content Modules Part 3: Backend Administration
The file you want to look at is LocationsDefinitions.cs, specifically the helper method CreateBackendSections. Look for the following code that adds this selector to the form:
#region Categories and Tags Section
// define new section
var taxonSection =
new
ContentViewSectionElement(detailView.Sections)
Name =
"TaxonSection"
,
Title =
"Categories and Tags"
,
CssClass =
"sfExpandableForm"
,
ExpandableDefinitionConfig =
Expanded =
false
;
// add categories field to section
var categories = DefinitionTemplates.CategoriesFieldWriteMode(taxonSection.Fields);
categories.DisplayMode = displayMode;
// add categories section to view
taxonSection.Fields.Add(categories);
// add tags field to section
var tags = DefinitionTemplates.TagsFieldWriteMode(taxonSection.Fields);
tags.DisplayMode = displayMode;
tags.CssClass =
"sfFormSeparator"
;
tags.ExpandableDefinition.Expanded =
true
;
tags.Description =
"TagsFieldInstructions"
;
taxonSection.Fields.Add(tags);
// add tags section to view
detailView.Sections.Add(taxonSection);
#endregion
Hi,
Thanks for the input.
I've built this module which I do not believe is content based (I might be mistaken?) :
http://www.sitefinity.com/blogs/joshmorales/posts/11-06-30/sitefinity_intra-site_module_webinar_notes.aspx
Do you think I can still get it work with it or do I need to redo the whole module?
Thanks,
R
Hello Richard,
The module in this blog post you mention is based on ModuleBase. Basically the intra site module uses user controls to function(.ascx files). Modules inheriting from ContentModuleBase(which is the class for the built in modules) rely on definitions and resources to take the information with available fields(textboxes, tags, htmlfield) and present it trough a widget on the frontend.
Regards,
Stanislav Velikov
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Thanks for the information all!