Movatterモバイル変換


[0]ホーム

URL:


BloomreachBloomreach
Hippo CMS

Bloomreach Documentation version

Bloomreach.com

Selection Plugin Delivery Tier Configuration and Implementation

Content Bean

You can use the Beanwriter tool in thesetup application to update thecontent bean for the document type you added the selection field to.

At repository level a selection field is simply a String (or Boolean) property, so the corresponding get method in the content bean is no different from that of a regular String property:

@HippoEssentialsGenerated(internalName = "myproject:city")public String getCity() {    return getProperty("myproject:city");}

Make Value Lists Available to the Site

When a CMS user selects a value from a selection field in a document's editing template, thekey for that value is stored in the repository. In order to render the label value associated with that key, you need access to the value list from the delivery tier.

Thesetup application provides a UI to make value lists available to the site application, by means of the ValueListManager Spring bean.

valueListManager.xml

The generated Spring bean configuration can be found in your project'ssite module in site/components/src/main/resources/META-INF/hst-assembly/overrides/valueListManager.xml:

<beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">    <bean        >     <constructor-arg>       <map>         <!--<entry key="name" value="/absolute/repository/path"/>-->          <entry key="cities" value="/content/documents/administration/value-lists/cities"/>      </map>     </constructor-arg>   </bean> </beans>

Access value lists

You can access theValueListManager bean from within any page component class. The example below extends the standardContent Component and overrides itsdoBeforeRender method to retrieve thecities value list and put it in a request attribute:

public class NewsComponent extends EssentialsContentComponent {    @Override    public void doBeforeRender(HstRequest request, HstResponse response) {        super.doBeforeRender(request, response);        final ValueList citiesValueList =             SelectionUtil.getValueListByIdentifier("cities", RequestContextProvider.get());        if (citiesValueList != null) {            request.setAttribute("citiesMap", SelectionUtil.valueListAsMap(citiesValueList));        }    }}

Template

In your template you can then use the value list to lookup the value label for the key stored in a document:

${citiesMap[document.city]}
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