Skip to content

Commit

Permalink
feat(#2): 🚧 add unmodified widget.pt from plone.app.z3cform
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmassmann committed Dec 19, 2021
1 parent c567e3f commit 57022d5
Showing 1 changed file with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div
metal:define-macro="widget-wrapper"
i18n:domain="plone"
tal:define="widget nocall:context;
error python:widget.error;
error_class python:error and ' error' or '';
empty_values python: (None, '', [], ('', '', '', '00', '00', ''), ('', '', ''));
empty_class python: (widget.value in empty_values) and ' empty' or '';
"
id="formfield-${python:widget.id}"
class="mb-3 field pat-inlinevalidation fieldname-${python:widget.name}} widget-mode-${python:widget.mode}${error_class}${empty_class} ${python:getattr(widget, 'wrapper_css_class', False) or False}"
data-fieldname="${widget/name}"
data-pat-inlinevalidation='{"type":"z3c.form"}'>
<label for="${python:widget.id}"
class="form-label"
tal:condition="python: widget.mode == 'input' and widget.label">
<span i18n:translate="" tal:replace="python:widget.label">label</span>

<span class="required" title="Required"
tal:condition="python:widget.required"
i18n:attributes="title title_required;"></span>
</label>
<b class="widget-label form-label d-block"
tal:condition="python: widget.mode == 'display' and widget.label">
<span i18n:translate="" tal:replace="python:widget.label">label</span>
</b>

<input type="text" tal:replace="structure python:widget.render()"
metal:define-slot="widget" />

<div tal:define="description python: getattr(widget, 'description', widget.field.description)"
i18n:translate=""
tal:content="structure description"
tal:condition="python:description and widget.mode == 'input'"
class="form-text">
help text
</div>

<div tal:condition="error"
tal:replace="structure python:error.render() or False">
Error
</div>

</div>

0 comments on commit 57022d5

Please sign in to comment.