From b76073ab3c1ebf8ec15c951239677213df135330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poulain?= <herve@nexedi.com> Date: Thu, 29 Oct 2009 16:27:50 +0000 Subject: [PATCH] Allows the use of "css_class" and "extra" in the html render of the ImageField. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30129 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Form/ImageField.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/product/ERP5Form/ImageField.py b/product/ERP5Form/ImageField.py index b0e792fbe3..d85b42c61d 100644 --- a/product/ERP5Form/ImageField.py +++ b/product/ERP5Form/ImageField.py @@ -29,7 +29,6 @@ from Products.Formulator import Widget, Validator from Products.Formulator.Field import ZMIField from Products.Formulator.DummyField import fields -from DocumentTemplate.DT_Util import html_quote class ImageFieldWidget(Widget.TextWidget): @@ -80,17 +79,18 @@ class ImageFieldWidget(Widget.TextWidget): image = value alt = field.get_value('description') or \ field.get_value('title') + css_class = field.get_value('css_class') + extra = field.get_value('extra') display = field.get_value('image_display') format = field.get_value('image_format') resolution = field.get_value('image_resolution') - html_string = '<img src="%s?display=%s&format=%s&'\ - 'resolution=%s" alt="%s"/>' % \ - (html_quote(image), - html_quote(display), - html_quote(format), - html_quote(resolution), - html_quote(alt)) - return html_string + return Widget.render_element( + "img", + alt=alt, + src="%s?display=%s&format=%s&" % (image, display, format), + css_class=css_class, + extra=extra, + ) ImageFieldWidgetInstance = ImageFieldWidget() ImageFieldValidatorInstance = Validator.StringValidator() -- 2.30.9