Skip to content

Resources, @fieldset & Controls

Use Mystique::* constants (or raw Inputfield* class names) as the type key on any subfield definition:

Category Constants
Layout & Markup Mystique::FIELDSET, Mystique::TAB, Mystique::MARKUP
Text & Rich Text Mystique::TEXT, Mystique::TEXTAREA, Mystique::TINYMCE, Mystique::CKEDITOR
Booleans & Toggles Mystique::CHECKBOX, Mystique::CHECKBOXES, Mystique::RADIOS, Mystique::TOGGLE, Mystique::TOGGLE_CHECKBOX
Choices & Numbers Mystique::SELECT, Mystique::ASM_SELECT, Mystique::INTEGER, Mystique::FLOAT, Mystique::DATETIME
Pages, Media & Pickers Mystique::PAGE, Mystique::IMAGE, Mystique::FILE, Mystique::ICON_PICKER, Mystique::ICON, Mystique::COLOR

Return a Closure from site/templates/configs/Mystique.<name>.php when the available subfields depend on the edited $page, $field, or current $value (see site/modules/Mystique/configs/Mystique.magician.php):

site/templates/configs/Mystique.contextual-banner.php
<?php
declare(strict_types=1);
namespace ProcessWire;
use Totoglu\Mystique\MystiqueValue;
return static function (?Page $page = null, ?Field $field = null, ?MystiqueValue $value = null): array {
$fields = [
'banner_mode' => [
'label' => __('Banner Mode', __FILE__),
'type' => Mystique::SELECT,
'options' => [
'none' => __('Hidden', __FILE__),
'promo' => __('Seasonal Promo', __FILE__),
],
'defaultValue' => 'none',
],
];
if ($page instanceof Page && $page->template->name === 'yacht') {
$fields['promo_badge'] = [
'label' => __('Yacht Promo Badge', __FILE__),
'type' => Mystique::TEXT,
'useLanguages' => true,
'showIf' => ['banner_mode' => '=promo'],
];
}
return [
'name' => 'contextual-banner',
'title' => __('Contextual Banner', __FILE__),
'fields' => $fields,
];
};

Define shared fieldsets in site/templates/configs/fieldsets/*.{php,json} or site/modules/*/configs/fieldsets/*.{php,json} (or reference any existing Mystique resource) in three styles:

site/templates/configs/Mystique.checkout-meta.php
<?php
declare(strict_types=1);
namespace ProcessWire;
return [
'title' => __('Checkout Metadata', __FILE__),
'fields' => [
// 1. Direct string shorthand (leading "_" auto-prefixes children with "billing_")
'billing' => '@fieldset:_address',
// 2. Map import with display mode ('fieldset' | 'tab' | 'inline'), prefix, exclude, and overrides
'shipping' => [
'import' => '@fieldset:address',
'type' => 'tab',
'label' => __('Shipping Address', __FILE__),
'prefix' => true,
'exclude' => ['tax_id'],
'overrides' => [
'city' => ['columnWidth' => 50, 'required' => true],
],
],
// 3. Container children reference
'company_address' => [
'type' => Mystique::FIELDSET,
'label' => __('Company Address', __FILE__),
'children' => '@fieldset:_address',
],
],
];

Internal showIf and requiredIf sibling conditions inside prefixed fieldsets are automatically rewritten with the active prefix, and circular imports throw WireException.

All Field Configuration Settings (MystiqueField)

Section titled “All Field Configuration Settings (MystiqueField)”

Configure these options under Setup -> Fields -> [Your Mystique Field] (also available per-template via field context overrides):

Setting Type Default Description
resource string '' Resource caller identifier (base.name, for example templates.yacht-specs or mystique.example-dive).
useJson bool false Load the schema from inline jsonString instead of a config file on disk.
jsonString string '' Inline JSON resource definition used when useJson is enabled.
hideWrap int 0 Hide the surrounding Mystique fieldset wrapper, label, description, and notes (1 = hidden).
useEntityEncode bool false Auto-HTML-entity-encode plain text subfields when $page->of(true) (HTML/RichText preserved).
dataType string 'longtext' MySQL storage column type (longtext, mediumtext, text, or json).
allowImport bool false Render a collapsed JSON import textarea in the page editor (1 MiB max, depth 64).
allowExport bool false Render a collapsed JSON export textarea with click-to-select in the page editor.

Next steps