Skip to content

Latest commit

 

History

History
129 lines (98 loc) · 5.56 KB

location_children.rst

File metadata and controls

129 lines (98 loc) · 5.56 KB

Location children Query Type

This Query Type is used to build queries that fetch children Locations.

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

Examples

On full view for folder type Location fetch folder's children Locations of the type document that are in restricted Section, sort them by priority descending and paginate them by 10 per page using URL query parameter page:

ezpublish:
    system:
        frontend_group:
            ng_content_view:
                full:
                    folder:
                        template: '@ezdesign/content/full/folder.html.twig'
                        match:
                            Identifier\ContentType: folder
                        queries:
                            children_documents:
                                query_type: SiteAPI:Location/Children
                                max_per_page: 10
                                page: '@=queryParam("page", 1)'
                                parameters:
                                    content_type: document
                                    section: restricted
                                    sort: priority desc
{% set documents = ng_query( 'children_documents' ) %}

<h3>Documents in this folder</h3>

<ul>
{% for document in documents %}
    <li>{{ document.content.name }}</li>
{% endfor %}
</ul>

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

Own conditions

location

Defines the parent Location for children 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 children of the parent Location
location: '@=location.parent'
# fetch children of the parent Location's parent Location
location: '@=location.parent.parent'

Inherited Location conditions

Common query parameters

  • value type: string, SortClause
  • value format: single, array
  • required: false
  • default: as is defined on the parent Location (see location parameter)