From 0a0ff39bb0acd0d623785c8c84aef19879642fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 3 Oct 2018 15:40:38 +0200 Subject: [PATCH] Add example for all tag field relations query type --- .../content_relations_all_tag_fields.rst | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/reference/query_types/content_relations_all_tag_fields.rst b/docs/reference/query_types/content_relations_all_tag_fields.rst index d32aaef6..dfadbf4c 100644 --- a/docs/reference/query_types/content_relations_all_tag_fields.rst +++ b/docs/reference/query_types/content_relations_all_tag_fields.rst @@ -33,6 +33,44 @@ of a given Content. Examples -------------------------------------------------------------------------------- +On full view for ``product`` type Content fetch all Content of type ``article`` that is tagged with +any of the tags from the given product. Sort them by name and paginate them by 10 per page using URL +query parameter ``page``: + +.. code-block:: yaml + + ezpublish: + system: + frontend_group: + ngcontent_view: + full: + product: + template: '@ezdesign/content/full/product.html.twig' + match: + Identifier\ContentType: product + queries: + related_articles: + query_type: SiteAPI:Content/Relations/AllTagFields + max_per_page: 10 + page: '@=queryParam("page", 1)' + parameters: + content_type: article + sort: name + +.. code-block:: twig + + {% set articles = ng_query( 'related_articles' ) %} + +

Related articles

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