Limit tag control to only tags used by particular module

Posted by Community Admin on 03-Aug-2018 21:30

Limit tag control to only tags used by particular module

All Replies

Posted by Community Admin on 12-Apr-2012 00:00

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.

Posted by Community Admin on 12-Apr-2012 00:00

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.

Posted by Community Admin on 13-Apr-2012 00:00

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!

Posted by Community Admin on 23-Apr-2012 00:00

Great! Any ideas for how to sort the tags listed?

This thread is closed