Skip to content

Latest commit

 

History

History
116 lines (90 loc) · 5.06 KB

location_siblings.rst

File metadata and controls

116 lines (90 loc) · 5.06 KB

Location siblings Query Type

This Query Type is used to build queries that fetch Location siblings.

Identifier SiteAPI:Location/Siblings
Own conditions
Inherited Location conditions
Common Content conditions
Common query parameters

Examples

On the full view for article type Content fetch all siblings of type news that are in ObjectState review/approved, sort them by name and paginate them by 10 per page using URL query parameter page:

ibexa:
    system:
        frontend_group:
            ng_content_view:
                full:
                    article:
                        template: '@ibexadesign/content/full/article.html.twig'
                        match:
                            Identifier\ContentType: article
                        queries:
                            news_siblings:
                                query_type: SiteAPI:Location/Siblings
                                max_per_page: 10
                                page: '@=queryParam("page", 1)'
                                parameters:
                                    content_type: news
                                    state:
                                        review: approved
                                    sort: name
{% set news_list = ng_query( 'news_siblings' ) %}

<h3>Article's news siblings</h3>

<ul>
{% for news in news_list %}
    <li>{{ news.content.name }}</li>
{% endfor %}
</ul>

{{ pagerfanta( news_list, 'twitter_bootstrap' ) }}

Own conditions

location

Defines sibling Location reference for fetching other siblings Locations.

Note

This condition is required. It's also automatically set to the Location instance resolved by the view builder if the query is defined in the view builder configuration.

  • value type: Location
  • value format: single
  • operators: none
  • target: none
  • required: true
  • default: not defined

Examples:

# this is also automatically set when using from view builder configuration
location: '@=location'
# fetch siblings of the parent Location
location: '@=location.parent'
# fetch siblings of the parent Location's parent Location
location: '@=location.parent.parent'

Inherited Location conditions