Skip to content

CLI Commands & Troubleshooting

Blocks ships two trk/processwire-console commands (make:block and blocks:doctor), both supporting --json for CI and automation pipelines.

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/:

Terminal window
# Preview planned files safely without writing to disk
php 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 block
php 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": ...}).

Audits your entire Blocks setup and exits with BLOCKS_ISSUES_FOUND whenever a structural error is detected:

Terminal window
php vendor/bin/wire blocks:doctor --json

Checks performed by blocks:doctor:

  • Validates every compiled ./site/blocks/*.yaml blueprint and pack override.
  • Verifies 1:1 Template Layout, Global Layout, and Panel Layout handle assignments.
  • Flags active Template or Page Layouts missing a blocks_page_slot.
  • Detects Reusable Block reference cycles and dangling blocks_reusable_ref / _blocks_preset pointers.
  • Flags duplicate _blocks_key warnings and self or circular _blocks_depends_on loops.
  • Verifies Preset target_block eligibility and 1:1 blocks-defaults records.
  • Emits non-fatal warnings for viewless block blueprints.

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.

Next steps