Taxonomy Plugin Configuration - BloomReach Experience - Open Source CMS

This article covers a Hippo CMS version 10. There's an updated version available that covers our most recent release.

07-03-2016

Taxonomy Plugin Configuration

Installation

The Taxonomy plugin can be added to your project using Hippo's  setup application.

Prerequisites:

Instructions:

  1. Using Hippo's  setup applicationadd Taxonomy to your project.
  2. Rebuild and  restart your project.

Configuration

  1. In the setup application, navigate to  Installed features.
  2. Find Taxonomy and click on the Configure button.
  3. To create a new, empty taxonomy, enter a name and choose the locales to include.
  4. Click on the Create new taxonomy button.
  5. Select the document types to add taxonomy to, and choose the taxonomy to use.
  6. Click on the Add taxonomy to documents button.
  7. Use the BeanWriter tool to regenerate the content bean(s) for the document type(s) you added taxonomy to.

The taxonomy can now be managed in the CMS Content perspective in the newly added Taxonomies section.

When editing documents that use a taxonomy, you can select categories from the taxonomy dialog.

To access the taxonomy from the delivery tier see Taxonomy Plugin Delivery Tier Configuration.

Optional: Write and Configure a Category Filter

Available since 1.11.02

If you have a use case where you want to hide categories in certain circumstances, e.g. based on the current user or some data on the category node, you can create an implementation of the JcrCategoryFilter in your CMS.

Please note that hiding categories for users A while showing them for users B may result in documents with category values on them that are unknown to the users A, resulting in "Invalid category key" in the taxonomy picker. The use case design has to solve that.

import org.onehippo.taxonomy.plugin.api.JcrCategoryFilter;

/**
 * Category filter that hides categories if it doesn't have a certain property.
 */
public class MyCategoryFilter implements JcrCategoryFilter {
    @Override
    public boolean apply(final JcrCategory category, final HippoSession session) {
        // hide for author
        if (session.getUser().getId().equals("author")) {
            return false;
        }

        // hide based on absent property
        if (!category.getJcrNode().hasProperty("myproject:authorized")) {
          return false;
        }

        // OK
        return true;
    }
}

There is also a (non-configured) filter in the demo projectHideForAuthorCategoryFilter.java

Such a filter can be configured by means of the following taxonomy service property:

/hippo:configuration/hippo:frontend/cms/cms-services/taxonomyService
  - taxonomy.category.filters = com.myproject.cms.taxonomy.MyCategoryFilter

Multiple filter classes can be specificied as a comma-separated string.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?