API / Minn\Blocks / QueryVars

QueryVars final class

Minn\Blocks\QueryVars · public/minn/src/Minn/Blocks/QueryVars.php · 122 lines

The query variables a Query Loop block's context asks for, the way the reference's build_query_vars_from_query_block builds them (probe query-loop): a viewable post type; stickies only, left out, or ignored; exclusions; a page size and offset for the page asked for; the old category and tag ids and each viewable taxonomy's terms, merged; formats (standard as no format) OR'd, beside the terms in a group of their own; order, orderby, authors (a list, a comma list, or one id), a search, and parents for a hierarchical type.

Public

staticfromContext(?array $context, int $page, array $sticky, array $site): array#

The query vars a query block's context amounts to.

$contextarray<string, mixed>|nullthe block's `query` context
$stickylist<int>the site's sticky post ids
$sitearray{viewableType: callable(string): bool, hierarchicalType: callable(string): bool, viewableTaxonomy: callable(string): bool, formats: list<string>}what the site says about types, taxonomies and formats

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatesticky(array $query, mixed $setting, array $sticky): array#
$queryarray<string, mixed>@param list<int> $sticky @return array<string, mixed>
privateidTerms(array $context): array#

The old categoryIds and tagIds settings as clauses. @param array<string, mixed> $context @return list<array<string, mixed>>

$contextarray<string, mixed>@return list<array<string, mixed>>
privatetaxonomyTerms(array $context, callable $viewable): array#

Each viewable taxonomy's terms as a clause. @param array<string, mixed> $context @param callable(string): bool $viewable @return list<array<string, mixed>>

$contextarray<string, mixed>@param callable(string): bool $viewable @return list<array<string, mixed>>
privateformats(array $query, mixed $formats, array $known): array#

The formats asked for (standard, or one the site knows) OR'd; beside other term clauses, AND'd with them as a group.

$queryarray<string, mixed>
$knownlist<string>
@return array<string, mixed>
privateauthor(array $query, mixed $author): array#

Authors: a list or a comma list as author__in, one id as author. @param array<string, mixed> $query @return array<string, mixed>

$queryarray<string, mixed>@return array<string, mixed>