More in this section

Forums / Developing with Sitefinity / "Categories and tags" section in Custom Module

"Categories and tags" section in Custom Module

6 posts, 2 answered
  1. Richard
    Richard avatar
    77 posts
    Registered:
    24 Oct 2007
    22 Aug 2011
    Link to this post
    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
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    22 Aug 2011
    Link to this post
    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

    Answered
  3. Richard
    Richard avatar
    77 posts
    Registered:
    24 Oct 2007
    22 Aug 2011
    Link to this post
    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
  4. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    25 Aug 2011
    Link to this post
    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 >>

    Answered
  5. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    25 Aug 2011
    Link to this post
    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.

  6. Richard
    Richard avatar
    77 posts
    Registered:
    24 Oct 2007
    25 Aug 2011
    Link to this post
    Thanks for the information all!
6 posts, 2 answered