Templates, Media & Selectors
Native ProcessWire Return Types
Section titled “Native ProcessWire Return Types”MystiqueValue respects $page->of() exactly like core ProcessWire fields:
| Subfield Type | Output When $page->of(false) |
Output When $page->of(true) |
|---|---|---|
Mystique::PAGE (derefAsPage=0) |
PageArray |
PageArray |
Mystique::PAGE (derefAsPage=1) |
Page|false |
Page|false |
Mystique::PAGE (derefAsPage=2) |
Page|NullPage |
Page|NullPage |
Mystique::IMAGE (maxFiles=1) |
Pageimages |
Pageimage|null |
Mystique::IMAGE (maxFiles!=1) |
Pageimages |
Pageimages |
Mystique::FILE (maxFiles=1) |
Pagefiles |
Pagefile|null |
Mystique::FILE (maxFiles!=1) |
Pagefiles |
Pagefiles |
Mystique::DATETIME |
ISO-8601 (Y-m-d / Y-m-d H:i:s) |
Formatted via dateOutputFormat |
Reading, Multi-Language & Helper Methods
Section titled “Reading, Multi-Language & Helper Methods”<?php
declare(strict_types=1);
namespace ProcessWire;
use Totoglu\Mystique\MystiqueValue;
/** @var MystiqueValue $specs */$specs = $page->yacht_specs;
// Multi-language values (falls back to default language automatically)$headline = $specs->getLanguageValue('headline');$turkishHeadline = $specs->getLanguageValue('headline', 'tr');
// Option labels & presence checks$classLabel = $specs->optionLabel('yacht_class', (string) $specs->yacht_class);$allClasses = $specs->optionLabels('yacht_class');$hasBrochure = $specs->hasValue('brochure_pdf');
// Export to PHP array or JSON$asArray = $specs->toArray();$asJson = $specs->toJson(pretty: true);Isolated HostPage Media, AJAX Uploads & Repeaters
Section titled “Isolated HostPage Media, AJAX Uploads & Repeaters”- Isolated storage:
Mystique::IMAGEandMystique::FILEsubfields store uploads undersite/assets/files/mystique/{pageId}/{fieldName}/{subfieldName}/viaMystiqueFilesManagerandMystiqueFileHost. - Full native API: Images support
size(),width(),height(),webp,focus(), descriptions, and tags, plus drag-and-drop AJAX uploads (InputfieldFileAjax=1) inside the page editor. - Repeater & RepeaterMatrix ready:
RepeaterAssetPreloaderpreloads required JS/CSS assets automatically soMystiquefields inside dynamically loaded Repeater and RepeaterMatrix items render and upload cleanly without page reloads.
Type-Aware ProcessWire Selectors (MystiqueQueryEngine)
Section titled “Type-Aware ProcessWire Selectors (MystiqueQueryEngine)”Query any subfield directly through $pages->find(), $pages->findOne(), or $pages->count():
<?php
declare(strict_types=1);
namespace ProcessWire;
$pages = $this->wire()->pages;
// Exact match & not-equal (LEFT JOIN IS NULL matches missing keys accurately)$exact = $pages->find('template=yacht, yacht_specs.yacht_class=gulet, limit=25');$notDraft = $pages->find('template=yacht, yacht_specs.yacht_class!=motoryacht, limit=25');
// Numeric comparisons (CAST(... AS SIGNED/DECIMAL))$midRange = $pages->find('template=yacht, yacht_specs.pricing_weekly_rate>=15000, yacht_specs.pricing_weekly_rate<=30000, limit=25');
// Multi-select & Page references (JSON_CONTAINS + scalar fallback)$byMarina = $pages->find('template=yacht, yacht_specs.home_marina=1042, limit=25');
// Multi-language text search (COALESCE active language -> default language)$textMatch = $pages->find('template=yacht, yacht_specs.headline*=Gocek, limit=25');$allWords = $pages->find('template=yacht, yacht_specs.headline~=classic gulet, limit=25');
// Empty checks (handles missing JSON keys and empty arrays via JSON_LENGTH)$missingPhoto = $pages->find('template=yacht, yacht_specs.hero_image="", limit=25');