Commit afc47b35 authored by Kevin Deldycke's avatar Kevin Deldycke

Patch the render_view of TextField to enclose the value within <span> html...

Patch the render_view of TextField to enclose the value within <span> html tags if css class defined

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8469 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6e895dcf
......@@ -325,6 +325,22 @@ class PatchedLinkWidget(TextWidget) :
PatchedLinkWidgetInstance = PatchedLinkWidget()
LinkField.widget = PatchedLinkWidgetInstance
# Patch the render_view of TextField to enclose the value within <span> html tags if css class defined
def TextWidget_patched_render_view(self, field, value):
"""Render text as non-editable.
"""
if value is None:
return ''
css_class = field.get_value('css_class')
if css_class not in ('', None):
return "<span class='%s'>%s</span>" % (css_class, value)
return value
from Products.Formulator.Widget import TextWidget
TextWidget.render_view = TextWidget_patched_render_view
class IntegerWidget(TextWidget) :
def render(self, field, key, value, REQUEST) :
"""Render link.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment