Create Contact Form 7 form
fabrement-create-cf7-formCreate a Contact Form 7 form (CF7 must be active). YOU WRITE THE MARKUP: template is the CF7 form body — your HTML plus CF7 [tags] — so the layout is whatever the design asks for, not a column of generated paragraphs. The mail body, Reply-To and attachments are derived from the tags in it. Returns { form: { id, title, shortcode, fields } } — the id is the default of the form attribute of a block (FormField). LIST-FORMS FIRST: a duplicate title is NOT refused, so calling this twice leaves two forms with the same name and no way to tell which one a page renders. Reuse the existing form, or update it with update-cf7-form.
Rules: get-skill-doc {id:"forms-contract"} — read it before the first call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Form title (admin label). | |
| subject | No | Notification email subject line. | |
| messages | No | CF7 "Messages" tab as {key: text} — mail_sent_ok, validation_error, invalid_required, invalid_email, … (get-cf7-form lists every key with its current text and default). Only the keys sent change; "" resets one to the default; unknown keys are refused. | |
| template | Yes | CF7 form markup — the layout is yours to write, tags included. One control per CF7 tag: [text* your-name], [email* your-email], [tel your-phone], [textarea your-message], [select your-topic "Sales" "Support"], [acceptance your-consent], [file your-cv filetypes:pdf|doc], and [submit "Send"] for the button — a trailing * means required. Everything around them is your HTML: rows, fieldsets, hints, a consent line with a link. Wrap each control in its own element and give it classes, because the CSS is written against YOUR wrappers (CF7 adds its own classes to the control itself at render time). WHAT IS DERIVED FROM THIS MARKUP: the notification mail body (one line per control), the Reply-To (the first REQUIRED email tag — an optional one is skipped, CF7 rejects a possibly-blank mailbox), and the file attachments (every file tag). A control named after a WordPress query var (name, search, author, page, day, order, term, …) is REFUSED, not renamed: prefix it the way CF7 does, your-name. At most 40 controls. | |
| recipient | No | Email address the submissions are sent to (default: site admin). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| form | Yes | ||
| note | No | Present when another form already carries this title. |