"Categories and tags" section in Custom Module

Posted by Community Admin on 04-Aug-2018 13:59

"Categories and tags" section in Custom Module

All Replies

Posted by Community Admin on 22-Aug-2011 00:00

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

Posted by Community Admin on 22-Aug-2011 00:00

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

Posted by Community Admin on 22-Aug-2011 00:00

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

Posted by Community Admin on 25-Aug-2011 00:00

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 >>

Posted by Community Admin on 25-Aug-2011 00:00

It may be possible to use Sitefinity taxonomies in an intra-site module, and indeed this is something I am currently looking into for expanding on my original post...

However, I don't quite have a time frame for when this will be completed. If you need immediate access to taxonomies (as well as the many other great features you get from working with Content) they are out-of-the box only with Content based modules.

Posted by Community Admin on 25-Aug-2011 00:00

Thanks for the information all!

This thread is closed