[opencms-dev] XmlContent & Mapping on "Assign categories", howto

Paul-Inge Flakstad flakstad at npolar.no
Mon Oct 8 18:07:52 CEST 2012


Hi Sandrine,

Not quite sure what you're asking, but to enable assignment of categories when editing the structured content, you need to do something like this in your XSD:
1. Define the category element, e.g.: <xsd:element name="Category" type="OpenCmsString" minOccurs="0" maxOccurs="20" />
2. Define the layout, e.g.: <layout element="Category" widget="CategoryWidget" configuration="onlyleafs=true|property=category" />
3. Define the mapping, e.g. <mapping element="Category" mapto="propertyList:collector.categories" />

The mapping is especially important. I've never tested it myself, but you should be able to place the category selector in a nested element. However, I don't think you can have one category selector in one element, and then another category selector in another element and expect that to work. (It would probably appear to work, but I don't think the mapping would survive like you'd want.)

Hope this was of some help to you.

Cheers,
Paul

From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Sandrine Prousteau
Sent: 4. oktober 2012 12:08
To: The OpenCms mailing list
Subject: [opencms-dev] XmlContent & Mapping on "Assign categories", howto

Hi all !

I have a question about category fields on xmlcontent.
I know that, with a VfsFile field with CategoryWidget directly in my type xsd, this field content is mapped on categories stored when we do "Assign category" in context menu.
I'd like to use a similar category field which is in a nested XSD in this type XSD, like the Xpath /ID/Category, for mapping this value.
Can I do that and how?

Thanks in advance.

(I'm on OpenCms 8.0.4 / 8.5.0)

Sandrine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20121008/17d67476/attachment.htm>


More information about the opencms-dev mailing list