A section's field of the format query: what a section shows from a collection of the application (its articles, its projects), chosen in the page editor -- filters, an order, how many to skip and how many to show -- rather than kept in the page. The schema says which collection, and what may be chosen; nothing else reaches the repository.
class MMO\editor\cms\CollectionQuery
Namespace
MMO\editor\cms
The field's schema:
- `collection` the collection's name, `repository` its repository among [`Pages`](https://mmoframework.fr/en/documentation/mmo.editor/php/cms/Pages.md#pages)'s (`main` by default);
- `filters` what an editor may filter on, field => `{label, type: string|boolean, enum?, options?}`: a value chosen
keeps the entities whose field equals it (a list: one of them), a boolean `true` or `false` only. `options` reads
the choices from a collection (`{repository, collection, value, label, where}`: the categories of the articles),
as `enum` and `enumLabels` ([`ResolveFilter`](https://mmoframework.fr/en/documentation/mmo.editor/php/cms/CollectionQuery.md#collectionquery-resolvefilter));
- `sorts` what an editor may order by, field => label; `sort` in the data is one of them, `-` first for descending;
- `where` what every query keeps whatever was chosen (`{"status": "published", "date": {"$lte": "{today}"}}`):
mmo.core's filter, its `{today}` and `{now}` replaced by the day's date (`Y-m-d`) and the time (ISO 8601);
- `item` the schema of an entity's fields, for the template to print them ([`SectionFields`](https://mmoframework.fr/en/documentation/mmo.editor/php/cms/SectionFields.md#sectionfields): `html`, `image`...);
- `maxLimit` the most a section may show at once, 100 by default.
Its data: `{filters: {field: value}, sort: "-date", offset: 0, limit: 6}`.
Any other field of a section or a block may take its choices from a collection the same way: a field with `options`
(`{repository, collection, value, label, where, empty}`: the project an article names) is offered as a list of them
-- `empty`, the label of a first choice, `''` (none) -- [`Resolve`](https://mmoframework.fr/en/documentation/mmo.editor/php/cms/CollectionQuery.md#collectionquery-resolve).
What a section may hold for a field: the filters it declares and of their type, an order it declares, an offset and a limit in their bounds -- the rest dropped (SectionType::clean).
A filter whose choices are a collection's (options: {repository, collection, value, label, where}), with its enum (the values of value) and enumLabels (those of label), read now: what t…
What a section may hold for a field: the filters it declares and of their type, an order it declares, an offset and a limit in their bounds -- the rest dropped (SectionType::clean).
static function Clean(array $field, mixed $data): array
A filter whose choices are a collection's (options: {repository, collection, value, label, where}), with its enum (the values of value) and enumLabels (those of label), read now: what the editor offers, and what
static function ResolveFilter(array $filter): array
See
Clean keeps. A collection it cannot read gives no choice. Any other filter, as it is.
list<array<string, mixed>>, total: int, offset: int, limit: int, more: bool} the entities (as arrays), how many the filter keeps in all past the field's offset, and whether some come after these