<tal:div xmlns="http://www.w3.org/1999/xhtml"
         xmlns:i18n="http://xml.zope.org/namespaces/i18n"
         xmlns:metal="http://xml.zope.org/namespaces/metal"
         xmlns:tal="http://xml.zope.org/namespaces/tal"
         define="
           error view/error;
           proto context/@@proto;
           widget_classes python: proto.get_widget_classes(view);
           use_fieldset python: proto.use_fieldset(view);
           description_as_info view/description_as_info|python: False;
           description view/field/description;
           omit_label view/omit_label|python: False;
           pat_depends view/pat_depends|nothing;
         "
         i18n:domain="ploneintranet"
>
  <fieldset class="${widget_classes} ${python: 'pat-depends' if pat_depends else ''}"
            data-pat-depends="${pat_depends}"
            tal:condition="use_fieldset"
  >
    <legend tal:condition="view/label">${view/label}
      <tal:required define="
                      required view/field/required;
                      mode view/mode;
                    "
                    condition="python: required and mode == 'input'"
      >*</tal:required>
    </legend>
    <tal:widget replace="structure view/render" />
    <tal:error condition="view/error"
               replace="structure view/error/render|nothing"
    />
    <metal:dfn define-macro="dfn">
      <tal:condition condition="description">
        <dfn class="help-icon pat-tooltip tooltip-inactive"
             title="Information"
             data-pat-tooltip="class: info; trigger: click; source: content; position-list: tl"
             tal:condition="not:description_as_info"
             i18n:attributes="title"
        >${description}</dfn>
        <em class="pat-message info"
            tal:condition="description_as_info"
        >${description}</em>
      </tal:condition>
    </metal:dfn>

  </fieldset>
  <label class="${widget_classes} ${python: 'pat-depends' if pat_depends else ''}"
         data-pat-depends="${pat_depends}"
         tal:condition="not:use_fieldset"
  >
    <tal:condition condition="not: omit_label">${view/label}</tal:condition>
    <tal:required define="
                    required view/field/required;
                    mode view/mode;
                  "
                  condition="python: required and mode == 'input' and not omit_label"
    >*</tal:required>
    <tal:widget replace="structure view/render" />
    <tal:error condition="view/error"
               replace="structure view/error/render|nothing"
    />
    <metal:block use-macro="template/macros/dfn" />
  </label>
</tal:div>
