Commit e19e4117 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Widget: SingleItemsWidget to check for 'structure' prefix in field's TALES method

and activate/disactivate html-escape accordingly
parent 4ad27de2
......@@ -862,19 +862,28 @@ class SingleItemsWidget(ItemsWidget):
item_text = item
item_value = item
no_escape = False
tales = field.tales.get("items", None)
if tales:
no_escape = tales.hasPrefix('structure')
if item_value == value and not selected_found:
rendered_item = self.render_selected_item(escape(ustr(item_text)),
item_value,
key,
css_class,
extra_item)
rendered_item = self.\
render_selected_item(ustr(item_text) if no_escape else escape(ustr(item_text)),
item_value,
key,
css_class,
extra_item
)
selected_found = 1
else:
rendered_item = self.render_item(escape(ustr(item_text)),
item_value,
key,
css_class,
extra_item)
rendered_item = self.\
render_item(ustr(item_text) if no_escape else escape(ustr(item_text)),
item_value,
key,
css_class,
extra_item
)
rendered_items.append(rendered_item)
......
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