[Hippo-cms7-user] Dropdown Plugin

Jeroen Hoffman j.hoffman at onehippo.com
Tue Nov 17 14:43:22 CET 2009


nvankampenhout wrote:
> Hi Jeroen,
> 
> Do you have an example of how to use the MultiSelect? I tried adding a
> Dynamic Dropdown through the GUI, and then changing the plugin.class
> property on the node at
> /hippo:namespaces/mynamespace/mytype/editor.template/_default_/[some_id]
> from "org.hippoecm.frontend.editor.plugins.field.PropertyFieldPlugin" to
> "org.onehippo.forge.cms.frontend.plugin.DynamicMultiSelectPlugin", but that
> didn't do the trick. I probably need to do more?
> 

I can imagine that that doesn't work as you're missing some properties/subnode. 
This is some example XML that is to be placed under editor:templates/_default_:

<sv:node sv:name="your_field_name">
   <sv:property sv:name="jcr:primaryType" sv:type="Name">
     <sv:value>frontend:plugin</sv:value>
   </sv:property>
   <sv:property sv:name="caption" sv:type="String">
     <sv:value>Your caption</sv:value>
   </sv:property>
   <sv:property sv:name="engine" sv:type="String">
     <sv:value>${engine}</sv:value>
   </sv:property>
   <sv:property sv:name="field" sv:type="String">
     <sv:value>your_field_name</sv:value>
   </sv:property>
   <sv:property sv:name="mode" sv:type="String">
     <sv:value>${mode}</sv:value>
   </sv:property>
   <sv:property sv:name="plugin.class" sv:type="String">
 
<sv:value>org.onehippo.forge.cms.frontend.plugin.DynamicMultiSelectPlugin</sv:value>
   </sv:property>
   <sv:property sv:name="wicket.id" sv:type="String">
     <sv:value>${cluster.id}.item</sv:value>
   </sv:property>
   <sv:property sv:name="wicket.model" sv:type="String">
     <sv:value>${wicket.model}</sv:value>
   </sv:property>
   <sv:property sv:name="multiselect.type" sv:type="String">
     <sv:value>selectlist</sv:value>
   </sv:property>
   <sv:property sv:name="selectlist.maxrows" sv:type="String">
     <sv:value>10</sv:value>
   </sv:property>
   <sv:property sv:name="valuelist.provider" sv:type="String">
     <sv:value>service.valuelist.default</sv:value>
   </sv:property>
   <sv:node sv:name="valuelist.options">
     <sv:property sv:name="jcr:primaryType" sv:type="Name">
       <sv:value>frontend:pluginconfig</sv:value>
     </sv:property>
     <sv:property sv:name="source" sv:type="String">
       <sv:value>/content/documents/your_valuelist_document_path</sv:value>
     </sv:property>
   </sv:node>
</sv:node>

Note that the wicket.id property might be different for you.


> I wrote a simple value provider that creates a hardcoded ValueList, and
> added a node under /hippo:configuration/hippo:frontend/cms/cms-services.
> This is its XML:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <sv:node sv:name="ExternalXMLValueListProvider"
> xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
>   <sv:property sv:name="jcr:primaryType" sv:type="Name">
>     <sv:value>frontend:plugin</sv:value>
>   </sv:property>
>   <sv:property sv:name="plugin.class" sv:type="String">
>    
> <sv:value>org.onehippo.forge.cms.frontend.provider.ExternalXMLValueListProvider</sv:value>
>   </sv:property>
>   <sv:property sv:name="valuelist.provider" sv:type="String">
>     <sv:value>service.valuelist.externalxml</sv:value>
>   </sv:property>
> </sv:node>
> 
> Then I tried letting a Dynamic Dropdown in a type use it. I tried adding a
> property "valuelist.provider" with value "service.valuelist.externalxml" to
> /hippo:namespaces/mynamespace/mytype/editor.template/_default_/[some_id],
> and also to
> /hippo:namespaces/mynamespace/mytype/editor.template/_default_/[some_id]/cluster.options
> (not clear from the sparse docs which is the correct one), but in both cases
> the Dynamic Dropdown still uses the default value provider. The only way I
> could test my own valueprovider, was by changing the "valuelist.provider"
> property on
> /hippo:configuration/hippo:frontend/cms/cms-services/DocumentValueListProvider
> to some other than "service.valuelist.default", and setting the same
> property for
> /hippo:configuration/hippo:frontend/cms/cms-services/ExternalXMLValueListProvider
> to "service.valuelist.default". Only then the Dynamic Dropdown used my value
> provider with its hardcoded value list.
> 
> What am I doing wrong?

I think that this is due to a missing property under 
/hippo:namespaces/system/DynamicDropdown/editor:templates/_default_/root.
Could you try this: add a String property 'valuelist.provider' with value 
'${valuelist.provider}'? I hope this will pass this property from the 
cluster.options subnode, like is done with the 'source' property. If correct, 
this should be incorporated into a new version of dropdown.

Jeroen Hoffman






More information about the Hippo-cms7-user mailing list