Foros de discusión

Custom data types for structures?

Jon Huff, modificado hace 7 años.

Custom data types for structures?

New Member Mensaje: 1 Fecha de incorporación: 8/09/16 Mensajes recientes
Hi,

Brand new to Liferay and I'm trying understand how I would create a custom data type that I could then use in Web Content Structures.

Let's say I have multiple products in my site. I want to be able to display information about those products at various places throughout the site. I'd like to be able to define a 'Product' data structure that has all of the fields that I want to store about a product. When creating Web Content Structures, I'd like to be able add that 'Product' structure as a data field (similar to a Text or Boolean field). Then, when adding a Web Content Display to a page, I'd be able to choose from the list of existing 'Product' objects.

So on one page, I could have a Web Content Display structure that had a heading, some body text, and three 'Product' objects. The template would display the heading and body, and the Product name and thumbnail preview for each object (both fields would be in the Product data structure).

On another page, I might have a different Web Content Display structure that has a reference to the same Product, but the template for this structure would display the name, thumbnail, and a short description.

Then, if something about the Product changes (like the name), I only have to update the Product object and it will be reflected everywhere throughout the site, because the Web Content structures all refer to the same object.

While looking through the documentation, it appears there are some things that might work, but don't seem to fully do what I'm trying to accomplish. Here's a list of potential candidates:
Web Content Structure (is it possible to nest structures in a way that they're accessible via a Template?)
Dynamic Data Lists
Service Builder

Is there a way to accomplish what I'm trying to do? Or am I completely thinking about this the wrong way? Any thoughts or tips would be greatly appreciated!

Thanks!

(Sorry if my explanation was a rambling mess. It's way past my bedtime emoticon )