<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:z3c="http://namespaces.zope.org/z3c"
    >

  <adapter
      factory=".error.ErrorViewTemplate"
      provides="zope.pagetemplate.interfaces.IPageTemplate"
      for="z3c.form.interfaces.IErrorViewSnippet
           ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      />

  <!--

  The following adapters are used to provide:

  - custom actions for the form
  - custom widgets for the fields
  - custom data converters for the fields

  -->

  <adapter factory=".actions.PIAuthenticatedButtonActions" />

  <adapter factory=".file.MultipleFileInputFieldWidget" />
  <adapter factory=".file.MultipleFileInputDataConverter" />

  <adapter factory=".related_items.PIRelatedItemsFieldWidget" />
  <adapter factory=".related_items.PIRelatedItemsDataConverter" />

  <adapter factory=".miller_columns.PIContentBrowserFieldWidget" />

  <adapter factory=".select.PISelectFieldWidget" />
  <adapter factory=".select.PIGooglePlaceSelectFieldWidget" />

  <adapter factory=".text.PIEmailFieldWidget" />
  <adapter factory=".text.TelephoneFieldWidget" />
  <adapter factory=".text.PIURIFieldWidget" />

  <!-- component library overview page and helpers -->

  <browser:page
      name="component-library"
      for="*"
      class=".component_library.ComponentLibraryEditView"
      template="templates/component_library.pt"
      permission="zope.Public"
      />

  <browser:page
      name="component-library-panel"
      for="*"
      class=".component_library.ComponentLibraryPanelEditView"
      template="templates/component_library_panel.pt"
      permission="zope.Public"
      />

  <browser:page
      name="component-library-saved"
      for="*"
      class=".component_library.ComponentLibraryDisplayView"
      template="templates/component_library_saved.pt"
      permission="zope.Public"
      />

  <browser:page
      name="component-library-canceled"
      for="*"
      class=".component_library.ComponentLibraryDisplayView"
      template="templates/component_library_canceled.pt"
      permission="zope.Public"
      />

  <!-- Reimplement getSource returned value to translate in a pat-autosuggest compatible way -->

  <browser:page
      name="getSource"
      for="z3c.form.interfaces.IWidget"
      class=".vocabulary.PISourceView"
      permission="zope.Public"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      />

  <!-- component library macros -->

  <browser:page
      name="ploneform-macros"
      for="*"
      class="plone.z3cform.templates.Macros"
      allowed_interface="zope.interface.common.mapping.IItemMapping"
      template="templates/ploneform_macros.pt"
      permission="zope.Public"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      />

  <!--
    The widget layout templates wrap the form widgets
    in a consistent way.

    We have a widget layout defined in z3c.form for every standard mode
    (display, hidden, input).

    Note that you can define your own modes and customize
    the layouts per widget.
  -->
  <z3c:widgetLayout
      widget="z3c.form.interfaces.IWidget"
      template="templates/widget_display_layout.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="display"
      />

  <z3c:widgetLayout
      widget="z3c.form.interfaces.IWidget"
      template="templates/widget_input_layout.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <!-- input widget templates -->

  <z3c:widgetTemplate
      widget="z3c.form.interfaces.ISingleCheckBoxWidget"
      template="templates/checkbox_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="ploneintranet.layout.widgets.checkbox.IPIMinimalCheckBoxWidget"
      template="templates/checkboxminimal_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="z3c.form.interfaces.ICheckBoxWidget"
      template="templates/checkboxlist_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="z3c.form.interfaces.IRadioWidget"
      template="templates/radio_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="z3c.form.interfaces.ITextWidget"
      template="templates/text_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="z3c.form.interfaces.ITextAreaWidget"
      template="templates/textarea_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="z3c.form.interfaces.ISelectWidget"
      template="templates/select_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget=".select.ISelectFromOptgroupsWidget"
      template="templates/select_from_optgroups_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="plone.app.z3cform.interfaces.IAjaxSelectWidget"
      template="templates/ajaxselect_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="plone.app.z3cform.interfaces.IDatetimeWidget"
      template="templates/date_time_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="plone.app.z3cform.interfaces.IDateWidget"
      template="templates/date_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget=".text.IPIEmailWidget"
      template="templates/email_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="z3c.form.interfaces.ISubmitWidget"
      template="templates/submit_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget=".text.IPIURIWidget"
      template="templates/uri_input.pt"
      layer="z3c.form.interfaces.IFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="plone.formwidget.namedfile.interfaces.INamedFileWidget"
      template="templates/file_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget="plone.formwidget.namedfile.interfaces.INamedImageWidget"
      template="templates/image_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget=".miller_columns.IPIContentBrowserWidget"
      template="templates/miller_columns_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <browser:page
      name="panel_miller_columns"
      for="z3c.form.interfaces.IWidget"
      class=".miller_columns.PanelMillerColumns"
      template="templates/panel_miller_columns.pt"
      permission="zope2.View"
      layer="ploneintranet.layout.interfaces.IPloneintranetLayoutLayer"
      />

  <z3c:widgetTemplate
      widget=".file.IMultipleFileInputWidget"
      template="templates/multiple_file_input.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="input"
      />

  <z3c:widgetTemplate
      widget=".file.IMultipleFileInputWidget"
      template="templates/multiple_file_display.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="display"
      />

  <!-- display widgets templates -->

  <z3c:widgetTemplate
      widget=".text.IPIEmailWidget"
      template="templates/email_display.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="display"
      />

  <z3c:widgetTemplate
      widget="ploneintranet.layout.widgets.select.IPIGooglePlaceSelectWidget"
      template="templates/google_place_display.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="display"
      />

  <z3c:widgetTemplate
      widget="ploneintranet.layout.widgets.text.ITelephoneWidget"
      template="templates/phone_display.pt"
      layer="ploneintranet.layout.interfaces.IPloneintranetFormLayer"
      mode="display"
      />

  <z3c:widgetTemplate
      widget=".text.IPIURIWidget"
      template="templates/uri_display.pt"
      layer="z3c.form.interfaces.IFormLayer"
      mode="display"
      />

</configure>
