Layout
======

plone.z3cform tries to avoid mixing Acqusition into your forms.  Also,
it tries to separate form templates from layout templates (aka main
template), so that your forms are usable in different contexts,
e.g. in portlets.

Using schemas is one way of defining the fields in a form:

  >>> from zope import interface, schema
  >>> from z3c.form import form, field

  >>> class MySchema(interface.Interface):
  ...     age = schema.Int(title=u"Age", description=u"Enter your age")
  >>> class MyForm(form.Form):
  ...     ignoreContext = True
  ...     fields = field.Fields(MySchema)

Note that no Plone chickens were harmed in the implementation of the
form.  The only Plone specific part comes now, where we wrap the form
into a Plone layout and register it:

  >>> from plone.z3cform.layout import wrap_form
  >>> MyWrappedForm = wrap_form(MyForm)

``MyWrappedForm`` is the class that you can register as your view.
We render it:

  >>> view = MyWrappedForm(portal, portal.REQUEST).__of__(portal)
  >>> html = view()
  >>> print html # doctest: +ELLIPSIS
  <...You are here:...Enter your age...>

Let's make sure that we're rendering the Plone macros here.  Only
these have a CSS class "horizontal":

  >>> 'class="horizontal"' in html
  True

We also want to make sure that we got the Plone version of the layout macro.
This one uses a documentFirstHeading class for the main page title:

  >>> 'class="documentFirstHeading"' in html
  True