Querying plans and areas
craft.hitz
craft.hitz.plan('spring-fair') | A plan by slug or ID, or null. |
craft.hitz.plans() | A plan query. |
craft.hitz.areas() | An area query. |
craft.hitz.areaTypes() | Every area type. |
craft.hitz.render(plan, options) | The interactive plan — see The front-end plan. |
craft.hitz.planData(plan, options) | The same plan as an array. |
craft.hitz.isPro() | Whether Pro features are on. |
Area queries
{% set available = craft.hitz.areas()
.plan('spring-fair')
.kind('stand')
.availability('available')
.surface('>= 20')
.orderBy('hitz_areas.surface desc')
.all() %}
| Param | Accepts |
|---|---|
plan(…) | A plan, its slug or ID, or a list. An unknown plan matches nothing. |
planId(…) | Plan IDs. |
type(…) | Area-type handles, IDs or objects. |
typeId(…) | Area-type IDs. |
kind(…) | 'hall', 'stand', 'feature', or a list. |
hall(…) / hallId(…) | A hall area or its ID; ':empty:' for areas in no hall. |
code(…) | Codes, with Craft's usual syntax ('A-*'). |
availability(…) | 'available', 'reserved', 'booked', 'unavailable'. |
surface(…) | Number syntax: '>= 20', ['and', '>= 20', '< 50']. |
Default order is the order areas were drawn, then code.
Plan queries
craft.hitz.plans().slug('spring-fair').one(), plus unit('m') and backgroundId(…).
Area properties
area.code, area.title | |
area.plan, area.type, area.kind | |
area.hall | The hall it is in, or null. |
area.children | For a hall: a query for the areas inside it. |
area.availability, area.availabilityLabel | |
area.surface, area.surfaceLabel | 24.0, "24 m²". |
area.dimensions | "6 × 4 m". |
area.geometry | The shape — .type, .points, .center, .radius, .centroid(), .bounds(). |
area.isStand, area.isHall |
Plan properties
plan.width, plan.height, plan.unit, plan.gridSize, plan.background (an asset),
plan.surface, plan.formatDimensions(), plan.areas (a query), plan.render({ … }).
Relation fields
Hitz Plans and Hitz Areas are ordinary Craft relation fields: selection modal, eager
loading, relatedTo from either end. (They are not in the GraphQL schema in 5.0 — use the
JSON endpoint for headless.)
{% set exhibitors = craft.entries.section('exhibitors').relatedTo({ targetElement: area, field: 'stand' }).all() %}
Reference tags
{hitzarea:123:title} and {hitzplan:12:title} work in rich text.