0
votes

I'm building a site using Orchard CMS and have built several lists of taxonomoies. I now want to create links on the admin menu directly to some of these lists (so the user doesn't have to navigate through the taxonomy link).

I have tried adding the Admin Menu content part to the taxonomy type and then checking the 'Show on Admin Menu' checkbox for a taxonomy, and this does create a admin menu link, but it is a link to the definition for the taxonomy - not the list of the terms for the taxonomy.

I can programmatically add a link via the Orchard.Taxonomies.Admin.GetNavigation(NavigationBuilder) method (as below) but I don't want to have to hard code the links

public void GetNavigation(NavigationBuilder builder) {
        builder
            .AddImageSet("taxonomies")
            .Add(T("Topics"), "4", menu => menu
                .Add(T("Manage Topics"), "1.0", item => item.Action("ListByName", "TermAdmin", new {area = "Orchard.Taxonomies", taxonomyName = "Topics"}).Permission(Permissions.ManageTerms))
            )
            .Add(T("Taxonomies"), "5", menu => menu
                .Add(T("Manage Taxonomies"), "1.0", item => item.Action("Index", "Admin", new { area = "Orchard.Taxonomies"}).Permission(Permissions.ManageTaxonomies))
            );
    }

Is there any other way to create a link to the taxonomy list on the admin menu?

Thanks

1

1 Answers

0
votes

You are doing great, but you need to get the taxonomyIds and their names to show in the links right? then the links should look something like this: /Taxonomies/TermAdmin?taxonomyId=767, not with the name.

In the Taxonomies AdminController and its View you can find some of the logic.

You should be able to inject the taxonomyService and query the taxonomies created and their terms or if its only one taxonomy you are interested in get its id by querying with the name.