Symfony Forms – Definition List Form Formatter

Submitted by:Pitter Alderson

Date added:21 July, 2011


To create the formatter paste this code into a new file and name it sfWidgetFormSchemaFormatterDefList.class.php. I saved it in /lib but it also makes sense to put it in /lib/form, depending on your personal preference.

Tags: symfony forms

Code Snippet:

// lib/sfWidgetFormSchemaFormatterDefList.class.php
class sfWidgetFormSchemaFormatterDefList extends sfWidgetFormSchemaFormatter {
$rowFormat = '<dt>%label%<dd>%error%%field%%help%%hidden_fields%</dd>',
$helpFormat = '<span class="help">%help%</span>',
$errorRowFormat = '<dt class="error">Errors:</dt><dd>%errors%</dd>',
$errorListFormatInARow = '<ul class="error_list">%errors%</ul>',
$errorRowFormatInARow = '<li>%error%</li>',
$namedErrorRowFormatInARow = '<li>%name%: %error%</li>',
$decoratorFormat = '<dl id="formContainer">%content%</dl>';