Plone 4.0 Rich-text Field Schema and View Template
Here's an example field schema and view template code for a rich-text field in Plone 4.0.
The schema code goes in the file like:
my.product/my/product/content/myType.py
The page template code goes in your view:
my.product/my/product/browser/myType.pt
Schema:
atapi.TextField(
name='productDescription',
default_content_type = 'text/restructured',
default_output_type = 'text/x-html-safe',
allowable_content_types=('text/plain', 'text/restructured', 'text/html',),
required=False,
searchable=True,
storage=atapi.AnnotationStorage(),
widget=atapi.RichWidget(
label=u"Product Description",
description=u"The product's Description",
label_msgid='my.product_productDescription',
description_msgid="my.product_productDescription_description",
il8n_domain='my.product',
),
),
View Template:
<div id="myType-productDescription-text" class="myType-product-field-text" tal:content="structure context/getProductDescription"> Description here </div>