Repository navigation
Showing a form on some sites only
Written against v0.6.1.
A form with no sites shows on every site. To show it on some sites only, assign it to those sites; the others then render the page without it.
- Open the form's settings in the Control Panel.
- In the Sites section, choose the sites in the Sites field.
- Save.
The form file lists the sites:
# resources/forms/contact.yaml
sites:
- enTo show the form on every site again, clear the Sites field.
On a site the form is not assigned to, the {{ form }} tags render nothing, and the rest of the page renders as usual. The log names the form and the site once per request:
local.WARNING: Multisite Forms rendered nothing for a form not assigned to the page's site. {"form":"contact","site":"es"}
That suits a form placed in a shared layout or partial, which renders on every site while only some of them use it.
A submit to the form from such a site answers 404, even from a request made by hand.
When a page that renders an unassigned form should not exist on that site at all, publish the config file:
php artisan vendor:publish --tag=statamic-multisite-forms-configThen set not_assigned to 404 in config/statamic-multisite-forms.php:
'not_assigned' => '404',The page then answers with the site's 404 page on a site the form is not assigned to, and renders as before on the sites it is.
A heading or an introduction around the form still renders on a site where the form does not. Wrap it in the form:assigned tag; see Checking a form's site in a template.
-
Configuration: every value of
not_assigned, and what each tag does. -
Form assigned tag:
form:assigned.
Home | README | Repository
Written against v0.6.1. These pages are edited in docs/wiki/ through a pull request; an edit made in the wiki is overwritten by the next publish.
Guides for site builders
- Showing a form on some sites only
- Giving each site its own title, email and store
- Checking a form's site in a template
Guides for administrators
Guides for developers
Troubleshooting
Reference
- Configuration
- Per-site title, email and store
- Control Panel access
- Attribute command
- API site filter
- Form assigned tag
- Site form view
- README
Project