Skip to content

Commit

Permalink
Add example for all tag field relations query type
Browse files Browse the repository at this point in the history
  • Loading branch information
pspanja committed Oct 3, 2018
1 parent 7652bd6 commit 0a0ff39
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/reference/query_types/content_relations_all_tag_fields.rst
Expand Up @@ -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' ) %}
<h3>Related articles</h3>
<ul>
{% for article in articles %}
<li>{{ article.name }}</li>
{% endfor %}
</ul>
{{ pagerfanta( articles, 'twitter_bootstrap' ) }}
Own conditions
--------------------------------------------------------------------------------

Expand Down

0 comments on commit 0a0ff39

Please sign in to comment.