Documentation

Displaying Object Entries

Available 7.4+

With Liferay Objects, you can use existing DXP frameworks to display Object entries dynamically in Sites. This includes collection displays for multiple entries and display pages for individual entries.

When an Object is published, Liferay creates a Collection Provider that you can use with the Collection Display fragment to display multiple Object entries. You can also configure the fragment to style, filter, and paginate the collection. And since published Objects are integrated with the Info framework, you can select them as the content type for Display Page Templates. When selected, the Object is set as the template’s mapping source, so you can easily map fragment fields to Object fields to create flexible page displays for individual Object entries.

Additionally, you can use FreeMarker to create Information Templates for Objects. Once created, you can map fragment fields to your template to determine how entries are rendered in Content Pages and Display Pages.

Note

Information Templates can be used in Content Display fragments and any other fragment with sub-elements (e.g., text, rich text) that can be mapped to Objects.

Together, these integrations enable users to leverage Liferay’s WYSIWYG page building capabilities while delivering personalized user experiences.

Using the Collection Provider for Objects

Once you’ve published an Object, follow these steps to use the Collection Display fragment to display an Object’s entries:

  1. Create a new Content Page or Display Page Template. Alternatively, begin editing (Edit Button) an existing one.

    Note

    You can also create a Collection Page using the Collection Provider. See Collections and Collection Pages for more information.

  2. Drag and drop the Collection Display fragment into the Page or Template from the Fragments and Widgets (Fragments and Widgets) sidebar.

    Drag and drop the Collection Display fragment into the Page or Template.

  3. Select the Collection Display Fragment to access its configuration options and click Select Collection in the General tab.

    Select the fragment and click Select Collection.

  4. In the modal window, click on the Collection Providers tab and select the Object’s provider.

    In the Collection Providers tab, select the Object's provider.

  5. (Optional) Filter which Object entries are displayed. You can filter by any Picklist or Boolean fields in the Object.

    To do this, click the Collection Options button (Collection Options Button) and select Filter Collection.

    Click on the Collection Options button and select Filter Collection.

    Then, select the desired filters and click Apply.

    Select the Filters to apply.

After selecting the desired provider, use additional fragment options to determine how Object entries are displayed, including List Style and Pagination.

Use fragment options to determine how Object entries are displayed.

Creating Display Page Templates for Objects

  1. Open the Site Menu (Site Menu). Go to DesignPage Templates and click on the Display Page Templates tab.

  2. Click the Add button (Add Button) and select the Blank template.

    This opens a modal window.

  3. Enter a name and select the desired Object for Content Type.

    Enter a name and select the desired Object for Content Type

  4. Click Save.

Once saved, the selected Object is set as the template’s mapping source, and you’re redirected to edit the template. Here, you can design flexible page displays for individual Object entries using fragments that map to Object fields. See Using Display Page Templates for information.

Map fragment elements to Object fields to dynamically populate Display Pages for individual entries.

Creating Information Templates for Objects

  1. Open the Site Menu (Site Menu) and go to DesignTemplatesInformation Templates.

  2. Click the Add button (Add Button)

  3. Enter a name and select the desired Object.

    Enter a name and select the desired Object.

  4. Click Save. This redirects you to the template design page.

  5. (Optional) Click the Actions button (Actions Button) in the Application Bar, select Import Script, and choose an .ftl file to import. This replaces the current template with the file’s FreeMarker script.

    Import script from an .ftl file.

  6. Use FreeMarker to design your template.

    In the Elements side panel (Elements), you can access available fields from the selected Object’s structure.

    Select from available fields in the Object's structure.

  7. (Optional) Add a description or image to the template in the Properties side panel (Properties).

    Add a description or image in the Properties panel.

  8. Click Save when finished.

You can now select from the template when mapping Object entries to fragment fields.

Select the template when mapping fragment elements.

Adding Entries to Navigation Menus

Since Objects are integrated with the info framework, you can add Object entries to navigation menus to provide quick access. All published Objects are automatically listed as available sources for menu elements. See Using the Navigation Menus Application for more information.