ParagraphDDMFormFieldTemplateContextContributor implements DDMFormFieldTemplateContextContributor { @Override public Map<String, Object> getParameters( DDMFormField ddmFormField, DDMFormFieldRenderingContext ddmFormFieldRenderingContext) { SoyRawData soyRawData = _soyDataFactory.createSoyRawData( getText(ddmFormField, ddmFormFieldRenderingContext)); return Collections.singletonMap("text", soyRawData.getValue()); }  @Override Map<String, Object> getParameters(
		DDMFormField ddmFormField,
		DDMFormFieldRenderingContext ddmFormFieldRenderingContext);  }
@Test public void testGetParameters() { DDMFormField ddmFormField = new DDMFormField("field", "paragraph"); LocalizedValue text = new LocalizedValue(); text.addString(text.getDefaultLocale(), "<b>This is a header</b>\n"); ddmFormField.setProperty("text", text); Map<String, Object> parameters = _paragraphDDMFormFieldTemplateContextContributor.getParameters( ddmFormField, new DDMFormFieldRenderingContext()); SanitizedContent sanitizedContent = (SanitizedContent)parameters.get( "text"); Assert.assertEquals( text.getString(text.getDefaultLocale()), sanitizedContent.getContent()); }
@Test public void testGetParametersWhenInViewMode() { DDMFormField ddmFormField = new DDMFormField("field", "paragraph"); LocalizedValue text = new LocalizedValue(); text.addString(text.getDefaultLocale(), "<p>This is a paragraph</p>\n"); ddmFormField.setProperty("text", text); DDMFormFieldRenderingContext ddmFormFieldRenderingContext = new DDMFormFieldRenderingContext(); ddmFormFieldRenderingContext.setViewMode(true); Map<String, Object> parameters = _paragraphDDMFormFieldTemplateContextContributor.getParameters( ddmFormField, ddmFormFieldRenderingContext); SanitizedContent sanitizedContent = (SanitizedContent)parameters.get( "text"); Assert.assertEquals( text.getString(text.getDefaultLocale()), sanitizedContent.getContent()); }