From d958957798517e21f01358e89bede5005208351a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 2 Oct 2018 16:15:45 +0200 Subject: [PATCH] Add example --- .../query_types/location_subtree.rst | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/docs/reference/query_types/location_subtree.rst b/docs/reference/query_types/location_subtree.rst index 3df7a814..1ab2e235 100644 --- a/docs/reference/query_types/location_subtree.rst +++ b/docs/reference/query_types/location_subtree.rst @@ -32,6 +32,45 @@ This Query Type is used to build queries that fetch from the Location subtree. Examples -------------------------------------------------------------------------------- +Subtree of the ``calendar`` type Location contains ``event`` type Locations. On the full view for +``calendar`` fetch all pending events from its subtree, sort them by their start date and paginate +them by 10 per page using URL query parameter ``page``: + +.. code-block:: yaml + + ezpublish: + system: + frontend_group: + ngcontent_view: + full: + calendar: + template: '@ezdesign/content/full/calendar.html.twig' + match: + Identifier\ContentType: calendar + queries: + pending_events: + query_type: SiteAPI:Content/Location/Subtree + max_per_page: 10 + page: '@=queryParam("page", 1)' + parameters: + content_type: event + field: + start_date: + gt: '@=timestamp("today")' + sort: field/event/start_date asc + +.. code-block:: twig + +

Pending events:

+ + + + {{ pagerfanta( children, 'twitter_bootstrap' ) }} + Own conditions --------------------------------------------------------------------------------