sulu-workshop
sulu-workshop copied to clipboard
05 - Add a page template Event overview to the website
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 atemplates/pages/event_overview.html.twig
file - Add a property
events
with typesmart_content
and the providerevents
to yourevent_overview.xml
- Log into the admin UI with user "admin" and password "admin"
- Create a new page
Events
and select the newly createdevent_overview
template - Assign the page to the
main
navigation context - Output the events provided by the
smart_content
property in yourtemplates/pages/event_overview.html.twig
Hints
- Use
{{ dump(content.events) }}
in the Twig template to find out how the data that is returned by asmart_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
- Next assignment pull request: 06 - Add an event registration to the website
- Source file of this assignment: assignments/05.md