Skip to content

Latest commit

 

History

History
191 lines (141 loc) · 6.69 KB

location_subtree.rst

File metadata and controls

191 lines (141 loc) · 6.69 KB

Location subtree Query Type

This Query Type is used to build queries that fetch from the Location subtree.

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

Examples

Subtree of the calendar type Location contains event type Locations. On the full view for calendar fetch all pending events from its subtree, sort them by their start date and paginate them by 10 per page using URL query parameter page:

ezpublish:
    system:
        frontend_group:
            ngcontent_view:
                full:
                    calendar:
                        template: '@ezdesign/content/full/calendar.html.twig'
                        match:
                            Identifier\ContentType: calendar
                        queries:
                            pending_events:
                                query_type: SiteAPI:Content/Location/Subtree
                                max_per_page: 10
                                page: '@=queryParam("page", 1)'
                                parameters:
                                    content_type: event
                                    field:
                                        start_date:
                                            gt: '@=timestamp("today")'
                                    sort: field/event/start_date asc
<h3>Pending events:</h3>

<ul>
{% for event in ng_query( 'pending_events' ) %}
    <li>{{ event.name }}</li>
{% endfor %}
</ul>

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

Own conditions

exclude_self

Defines whether to include Location defined by the location condition in the result set.

  • value type: boolean
  • value format: single
  • operators: none
  • target: none
  • required: false
  • default: true

Examples:

# do not include the subtree root Location, this is also default behaviour
exclude_self: true
# include the subtree root Location
exclude_self: false

location

Defines the root Location of the Location subtree.

Note

This condition is required.

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

    If used through view builder configuration, value will be automatically set to the Location instance resolved by the view builder.

Examples:

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

relative_depth

Defines depth of the Location in the tree relative to the Location defined by location condition.

  • value type: integer
  • value format: single, array
  • operators: eq, in, gt, gte, lt, lte, between
  • target: none
  • required: false
  • default: not defined

Examples:

# identical to the example below
depth: 2
depth:
    eq: 2
# identical to the example below
depth: [2, 3]
depth:
    in: [2, 3]
# multiple operators are combined with logical AND
depth:
    in: [2, 3]
    gt: 1
    lte: 3
depth:
    between: [2, 4]

Inherited Location conditions