This Query Type is used to build queries that fetch Locations with Content relations to the given Content from its relation type fields.
Note
Only visible main Locations of the related Content will be used.
Identifier | SiteAPI:Location/Relations/ReverseFields |
Own conditions | |
Inherited Location conditions | |
Common Content conditions | |
Common query parameters |
Content of type article
has relation field authors
which is used to define relations to
author
type Content. On full view for author
fetch all articles authored by that author,
sort them by title and paginate them by 10 per page using URL query parameter page
:
ibexa:
system:
frontend_group:
ng_content_view:
full:
author:
template: '@ibexadesign/content/full/author.html.twig'
match:
Identifier\ContentType: author
queries:
authored_articles:
query_type: SiteAPI:Location/Relations/ReverseFields
max_per_page: 10
page: '@=queryParam("page", 1)'
parameters:
relation_field: authors
content_type: article
sort: field/article/title asc
<h3>Author's articles</h3>
<ul>
{% for article in ng_query( 'authored_articles' ) %}
<li>{{ article.content.name }}</li>
{% endfor %}
</ul>
{{ pagerfanta( children, 'twitter_bootstrap' ) }}
Defines the destination (to) relation Content.
Note
This condition is required. It's also automatically set to the Content
instance resolved by
the view builder if the query is defined in the view builder configuration.
Note
Since this is about reverse relations, Content defined by this condition is not
the one containing relation type fields referenced by relation_field
. It's the one
receiving relations from Content containing those fields.
- value type:
Content
- value format:
single
- operators: none
- target: none
- required:
true
- default: not defined
Examples:
# this is also automatically set when using from view builder configuration
content: '@=content'
# fetch relations to Content's main Location parent Location's Content
content: '@=content.mainLocation.parent.content'
# fetch relations to Content's main Location parent Location's parent Location's Content
content: '@=content.mainLocation.parent.parent.content'
Defines Content fields to take into account for determining relations.
- value type:
string
- value format:
single
,array
- operators: none
- target: none
- required:
true
- default: not defined
Examples:
relation_field: authors
relation_field: [color, size]
Defines whether returned Locations are main Locations or not.
Use true
to get main Locations (which is also the default behaviour), false
to get non-main Locations and null
to get both.
- value type:
boolean
,null
- value format:
single
- operators:
eq
- target: none
- required:
false
- default:
true
Defines whether returned Locations are main Locations or not.
Use true
to get main Locations (which is also the default behaviour), false
to get non-main Locations and null
to get both.
- value type:
boolean
,null
- value format:
single
- operators:
eq
- target: none
- required:
false
- default:
true