Submission actions for forms: locked template with a submit button and Cloudflare Turnstile captcha.
Namespace
prc-block/form-submit
Category
design
Inserter preview
block.json example matches the locked structure: core/button (submit) plus prc-block/form-captcha.
Supports
| Feature | Enabled | Details |
|---|---|---|
| Anchor | Yes | |
| Layout | Yes | Flex, horizontal by default. Justification, orientation, and vertical alignment are enabled. |
| Dimensions | Yes | minWidth (not a default control) |
| Spacing | Yes | margin (top/bottom), padding |
Attributes
No custom attributes. Inner blocks own their attributes.
Inner blocks
Locked template (templateLock: "all"):
| Block | Purpose |
|---|---|
core/button | Submit button (type: submit, text “Submit”) |
prc-block/form-captcha | CAPTCHA widget |
Allowed blocks: core/button, prc-block/form-captcha
Users cannot add, remove, or reorder template children.
Parent / ancestor
Ancestor: prc-block/form
Uses context: form/displayMessage
Usage
- Add inside a Form (often last child, or end of the final Form Page).
- Customize button text on the
core/buttoninner block. - Captcha shows by default and hides the button until verification; then captcha hides and the button appears.
Block markup example
<div
class="wp-block-prc-block-form-submit"
data-wp-class--captcha-hidden="prc-block/form::context.captchaHidden"
data-wp-context='{"submitButtonText":"Submit"}'
>
<div class="wp-block-button">
<button
class="wp-block-button__link"
type="submit"
data-wp-bind--disabled="prc-block/form::state.submissionDisabled"
data-wp-text="prc-block/form::state.submitButtonText"
>
Submit
</button>
</div>
<div class="wp-block-prc-block-form-submit__captcha">
<!-- Captcha widget -->
</div>
</div>
PHP rendering
Server-side via render_block_callback in Form_Submit:
- Finds
<button type="submit">in inner content. - Adds disabled binding for
submissionDisabled. - Binds button text to
submitButtonText. - Wraps with
data-wp-class--captcha-hidden. - Stores original button text in
data-wp-context.
Frontend interactivity
No standalone view.js. Parent prc-block/form store drives captcha visibility and submission state.