CLI Commands & Troubleshooting
Blocks ships two trk/processwire-console commands (make:block and blocks:doctor), both supporting --json for CI and automation pipelines.
make:block
Section titled “make:block”Scaffolds a YAML blueprint in ./site/blocks/, a React component in ./site/templates/assets/js/blocks/, and an optional native PHP view in ./site/templates/blocks/:
# Preview planned files safely without writing to diskphp vendor/bin/wire make:block feature_banner --mode=single --role=element --allowed-parents=row --category=Marketing --icon=speakerphone --php-view --dry-run --json
# Scaffold files (overwriting existing targets in non-interactive mode requires --force)php vendor/bin/wire make:block feature_banner --mode=single --category=Marketing --icon=speakerphone --php-view --force --json
# Scaffold an extend: true override YAML for a pack blockphp vendor/bin/wire make:block card --extend --allowed-parents=section,row --json| Argument / Option | Short | Default | Description |
|---|---|---|---|
<name> (argument) |
(required) | Block machine name in snake_case starting with a letter (^[a-zA-Z][a-zA-Z0-9_-]{1,63}$). |
|
--mode |
-m |
single |
Block cardinality: single or multiple. |
--role |
-r |
element |
Block ontology role: element, container, item, or opener. |
--allowed-parents |
(role-aware) | Comma-separated parent types (defaults to @root for opener, @root,@container for container, omitted for item, @any for element). |
|
--extend |
false |
Generate an extend: true base-pack override YAML without creating full view files unless --php-view is set. |
|
--category |
-c |
Content |
Catalog category label in the Block Picker and Setup > Blocks. |
--icon |
-i |
box |
Vector icon slug (^[a-z0-9-]{1,64}$). |
--php-view |
false |
Also generate ./site/templates/blocks/{name}.php. |
|
--dry-run |
false |
Preview generated file paths without writing to disk. | |
--force |
-f |
false |
Overwrite existing files without confirmation. |
--json |
false |
Output structured JSON ({"ok": true, "data": ...}). |
blocks:doctor
Section titled “blocks:doctor”Audits your entire Blocks setup and exits with BLOCKS_ISSUES_FOUND whenever a structural error is detected:
php vendor/bin/wire blocks:doctor --jsonChecks performed by blocks:doctor:
- Validates every compiled
./site/blocks/*.yamlblueprint and pack override. - Verifies
1:1Template Layout, Global Layout, and Panel Layouthandleassignments. - Flags active Template or Page Layouts missing a
blocks_page_slot. - Detects Reusable Block reference cycles and dangling
blocks_reusable_ref/_blocks_presetpointers. - Flags duplicate
_blocks_keywarnings and self or circular_blocks_depends_onloops. - Verifies Preset
target_blockeligibility and1:1blocks-defaultsrecords. - Emits non-fatal warnings for viewless block blueprints.
Troubleshooting
Section titled “Troubleshooting”Page renders empty or ignores my Template Layout
Section titled “Page renders empty or ignores my Template Layout”Confirm your template calls $blocks->forPage($page) or $blocks->renderPage($page) rather than reading $page->blocks directly, and run php vendor/bin/wire blocks:doctor --json to verify that the active Template Layout is published and includes a blocks_page_slot.
A block does not appear in the Visual Block Picker
Section titled “A block does not appear in the Visual Block Picker”Check allowedParents, allowedChildren, allowedContexts, and disallowContexts in the block YAML, as well as the active Layout’s Page Block Rules (allowedBlocks).
Preset editor refuses to save a target block
Section titled “Preset editor refuses to save a target block”Presets can only target active block blueprints with presettable: true. Add presettable: true to your ./site/blocks/{block}.yaml (or an extend: true override) and refresh.
Visual Studio live preview shows a blank frame or 403 error
Section titled “Visual Studio live preview shows a blank frame or 403 error”Verify the logged-in user has blocks, blocks-admin, or page-edit (with $page->editable()), that ProcessWire CSRF cookies are not stripped by a reverse proxy, and that X-Frame-Options allows SAMEORIGIN.