Repository navigation
Form assigned tag
form:assigned answers whether a form renders on the page's site, so a template can hide what surrounds it, such as a heading or an introduction.
| Form | Result |
|---|---|
| Assigned to the page's site | true |
| With no sites | true |
| Assigned to other sites only | false |
| Does not exist | false |
It never aborts or logs, whatever not_assigned says.
The tag names the form the way form:create does: with in, handle, is, form or formset, or from a form in the template's context.
Use it as a condition, or as a tag pair that renders its contents only when the form is assigned:
{{ if {form:assigned in="contact"} }}
<h2>Contact us</h2>
{{ /if }}
{{ form:assigned in="contact" }}
<p>We reply within two working days.</p>
{{ /form:assigned }}Fetch it, or use the tag pair as a component:
@if (Statamic::tag('form:assigned')->params(['in' => 'contact'])->fetch())
<h2>Contact us</h2>
@endif
<s:form:assigned in="contact">
<p>We reply within two working days.</p>
</s:form:assigned>Like Statamic's own form:create and form:errors, the tag's name takes precedence over a form whose handle is assigned in the {{ form:assigned }} shorthand; render such a form with {{ form:create in="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