Movatterモバイル変換


[0]ホーム

URL:


BloomreachBloomreach
Hippo CMS

Bloomreach Documentation version

Bloomreach.com

Configure a Required Taxonomy Field

Legacy Documentation (Taxonomy Mixin Field)

This documentation page applies to legacy Taxonomy Mixin Field. As of version 15.3, a Taxonomy field type is available in theDocument Type Editor and can be used to add a required taxonomy field to a document type.

Introduction

Goal

Configure a required taxonomy field in a document type so that when saving a document of that type without any categories selected, the taxonomy field is visually marked as invalid using red coloring.

Background

A taxonomy field in a document type can be marked asrequired (meaning that at least one category must be selected) by adding the 'required' validator through configuration in the Console. When applying this to adefault taxonomy field added using the Essentials setup application, attempting to save a document with no categories selected will cause a feedback message to be displayed only. The taxonomy field will not be highlighted in red as is usual for invalid fields in the document type editor. This page describes the additional configuration required to also highlight an invalid taxonomy field using red coloring.

Set a taxonomy field to be required 

In order to mark a taxonomy field as required, the following steps have to be taken:

  1. Configure the org.onehippo.taxonomy.plugin.TaxonomyPickerPlugin frontend plugin.
  2. Setrequired validator on classifiable mixin or document type field.

1. Configure the TaxonomyPickerPlugin as frontend plugin

Although the standard way to configure a taxonomy field is to have aclassifiable node with a org.hippoecm.frontend.editor.plugins.mixin.MixinLoaderPlugin below theeditor:templates part of your document type, using this setup will only give a feedback message and will not show an invalidated field using red coloring.

To produce the correct validation highlighting, configure theTaxonomyPickerPlugin directly like in the example below:

/hippo:namespaces/myproject/mydocumenttype/editor:templates/_default_:  /classifiable:    jcr:primaryType: frontend:plugin    field: keys    plugin.class: org.onehippo.taxonomy.plugin.TaxonomyPickerPlugin    taxonomy.classification.dao: service.taxonomy.dao    taxonomy.id: service.taxonomy    taxonomy.name: exampletaxonomy    wicket.id: ${cluster.id}.field   (or applicable layout part e.g. ${cluster.id}.right.item)

2. Set 'required' validator on classifiable mixin or document type field 

Now, we need to set arequired validator on the taxonomy field. We can do this on the mixin level or on the document type level.

2a. Set classifiable mixin as 'required' 

Setting the mixinhippotaxonomy:classifiable as required will make the taxonomy fields in every document type required. To do that, add a validatorrequired here:

/hippo:namespaces/hippotaxonomy/classifiable/hipposysedit:nodetype/hipposysedit:nodetype:  /keys:    jcr:primaryType: hipposysedit:field    hipposysedit:validators: [ required ]

2b. Add a field with validator 'required' to the document type 

For setting the taxonomy field as required on document type level, add a field node below thehipposysedit:nodetype part of the type, also with a validatorrequired.

/hippo:namespaces/myproject/mydocumenttype/hipposysedit:nodetype/hipposysedit:nodetype:  /keys:    jcr:primaryType: hipposysedit:field    hipposysedit:multiple: true    hipposysedit:path: hippotaxonomy:keys    hipposysedit:type: String    hipposysedit:validators: [ required ]

The result 

The screenshot below, taken using the demo project, shows what a required taxonomy field will look in the CMS:

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

    [8]ページ先頭

    ©2009-2025 Movatter.jp