sulu-workshop icon indicating copy to clipboard operation
sulu-workshop copied to clipboard

05 - Add a page template Event overview to the website

Open luca-rath opened this issue 4 years ago • 0 comments

Add an event_overview page template to the project

Goal

Unfortunately our website is lacking an overview of all events. We would love to provide a page that displays all the events we are managing.

Steps

  • Create a new template by adding a config/templates/pages/event_overview.xml file and a templates/pages/event_overview.html.twig file
  • Add a property events with type smart_content and the provider events to your event_overview.xml
  • Log into the admin UI with user "admin" and password "admin"
  • Create a new page Events and select the newly created event_overview template
  • Assign the page to the main navigation context
  • Output the events provided by the smart_content property in your templates/pages/event_overview.html.twig

Hints

  • Use {{ dump(content.events) }} in the Twig template to find out how the data that is returned by a smart_content property is structured.

More Information

The smart content is one of the most powerful content types of Sulu. It allows the content manager to dynamically configure an aggregation of content from different data sources. This is possible by registering data providers for different data sources in the system. A data provider defines which options are supported for its data source and is responsible for loading the respective data.

Sulu already includes preconfigured data providers for pages from the content management section, contacts, accounts and media entities.

Links

luca-rath avatar Jul 07 '20 10:07 luca-rath