More in this section

Forums / Developing with Sitefinity / Add custom taxonomy to news item widget edit screen

Add custom taxonomy to news item widget edit screen

2 posts, 0 answered
  1. Darren
    Darren avatar
    4 posts
    Registered:
    21 Oct 2009
    21 Nov 2011
    Link to this post
    Using Sitefinity 4.2 I have created a custom taxonomy (Geographic Location) to the Classifications section.  I have added this to the News Item Create and Edit screens, what I can't find to do is add it to the widget control I add to the pages.  When I drop the news control on a page and go to edit, I get the built in Categories and Tags options of course to filter my news items but I also want to filter my news items by geographic location.

    Can this be added easily via the sitefinity interfaces as with the creating / implimenting in other backend pages. 

    Thanks

    Darren
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    23 Nov 2011
    Link to this post
    Hello Darren,

    If you want to achieve this you will have to extend the ContentSelectorsDesignerView class. Its default template is located as resource in Telerik.Sitefinity.Resources.Templates.Designers.ContentView.ContentSelectorsDesignerView.ascx. In this template there are several <designers:FilterSelectorItem> elements. Here is the default one for the Tags:

    <designers:FilterSelectorItem ID="FilterSelectorItem2" runat="server" Text="<%$Resources:Labels, ByTags %>"
        GroupLogicalOperator="AND" ItemLogicalOperator="OR" ConditionOperator="Contains"
        QueryDataName="Tags" QueryFieldName="Tags" QueryFieldType="System.Guid">
        <SelectorResultView>
            <sitefinity:FlatTaxonSelectorResultView ID="FlatTaxonSelectorResultView1" runat="server" WebServiceUrl="~/Sitefinity/Services/Taxonomies/FlatTaxon.svc"
                AllowMultipleSelection="true">
            </sitefinity:FlatTaxonSelectorResultView>
    </SelectorResultView>

    You can add another one for your custom taxonomy. However you will need to extend the designer class as well so it persists the values that you select in the UI. Basically you can start by overriding

    protected virtual void SetFilterTaxonomyIds()

    whose base implementation is

    this.FilterSelector.SetTaxonomyId("Categories", TaxonomyManager.CategoriesTaxonomyId);
    this.FilterSelector.SetTaxonomyId("Tags", TaxonomyManager.TagsTaxonomyId); Best wishes,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered