More in this section

Forums / General Discussions / Limit tag control to only tags used by particular module

Limit tag control to only tags used by particular module

4 posts, 1 answered
  1. Jules
    Jules avatar
    65 posts
    Registered:
    20 Jul 2005
    12 Apr 2012
    Link to this post
    Is there a way to limit the tags control to only display tags used by a particular module? If so, how?

    I've created a custom module with the Module Builder. The tags control is great for quickly putting together a filter for its list view, but in order to really make it useful I need to be able to filter the tags too.
  2. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    12 Apr 2012
    Link to this post
    Looking at the DynamicModulesConfig.config file, you might be able to change the taxonomyId property that is set for the tags. Maybe change it to a different taxonomy that you created through the taxonomy section. You could create a taxonomy and call it your module name. Then get the id by using the api or a tool like firbug to inspect the json that is sent back when the taxonomy section is populated.
  3. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    13 Apr 2012
    Link to this post
    Julia,

    if you are referring to the Taxonomy widget, I believe there is currently a known issue with filtering based on a custom module type for the built in taxonomy types (Category, Tag, etc).

    Richard's suggestion of using a custom taxonomy type is a valid one. If you make a custom taxonomy type for exclusive use by your dynamic module, and set the taxonomy widget to use that type, it will work as you expect.

    Gabe demonstrated this in the recent Module Builder Webinar

    If, however, you want to use the built-in taxonomy types, a temporary workaround is to make a custom taxonomy control that inherits from the built-in one, and allows you to specify a dynamic type.

    Simply add this class to your project:
    public class DynamicModuleTaxonomyControl : TaxonomyControl
    {
        public string DynamicModuleType { get; set; }
        protected override void CreateChildControls()
        {
            Type showcaseType = TypeResolutionService.ResolveType(DynamicModuleType);
            this.ContentType = showcaseType;
            base.CreateChildControls();
        }
    }

    then register this control in your toolbox (specify the full type including namespace instead of the path to the control) and you will be able to specify the full Dynamic Module type and it should filter the tags based on that type.

    Hope this is helfpul!
    Answered
  4. Jules
    Jules avatar
    65 posts
    Registered:
    20 Jul 2005
    23 Apr 2012
    Link to this post
    Great! Any ideas for how to sort the tags listed?
4 posts, 1 answered