sfWidgetFormSchema represents an array of fields.
Method Summary
-
addFormFormatter($name, $formatter)
Adds a form formatter.
-
generateName($name, )
Generates a name.
-
sfWidget
getFields()
Returns an array of fields.
-
sfWidgetFormSchemaFormatter
getFormFormatter()
Returns the form formatter to use for widget schema rendering
-
string
getFormFormatterName()
Gets the form formatter name that will be used to render the widget schema.
-
array
getFormFormatters()
Returns all the form formats defined for this form schema.
-
string
getGlobalErrors($errors)
Gets errors that need to be included in global errors.
-
string
getHelp($name)
Gets a text help by field name.
-
array
getHelps()
Sets the help texts.
-
string
getLabel($name)
Gets a label by field name.
-
array
getLabels()
Gets the labels.
-
string
getNameFormat()
Gets the format string for the name HTML attribute.
-
sfWidgetFormSchema
getParent()
Gets the parent widget schema.
-
array
getPositions()
Gets the positions of the fields.
-
moveField(, , )
Moves a field in a given position
-
bool
needsMultipartForm()
Returns true if the widget schema needs a multipart form.
-
bool
offsetExists($name)
Returns true if the schema has a field with the given name (implements the ArrayAccess interface).
-
sfWidget
offsetGet($name)
Gets the field associated with the given name (implements the ArrayAccess interface).
-
offsetSet($name, $widget)
Sets a field (implements the ArrayAccess interface).
-
offsetUnset()
Removes a field by name (implements the ArrayAccess interface).
-
string
render($name, $values, $attributes, $errors)
Renders the widget.
-
string
renderField($name, $value, $attributes, $attributes)
Renders a field by name.
-
setDefaultFormFormatterName($name)
Sets the generic default formatter name used by the class. If you want all
-
setFormFormatterName($name)
Sets the form formatter name to use when rendering the widget schema.
-
setHelp($name, $help)
Sets a help text.
-
setHelps($helps)
Sets the help texts to render for each field.
-
setLabel($name, $value)
Sets a label.
-
setLabels($labels)
Sets the label names to render for each field.
-
setNameFormat($format)
Sets the format string for the name HTML attribute.
-
setParent()
Sets the parent widget schema.
-
setPositions()
Sets the positions of the fields.
-
__clone()
-
__construct($fields, $options, $attributes, $labels, $helps)
Constructor.
fixFormId , generateId , generateTwoCharsRange , getIdFormat , isHidden , needsMultipartForm , renderContentTag , renderTag , setHidden , setIdFormat , __construct
Methods inherited from sfWidget
addOption , addRequiredOption , attributesToHtml , attributesToHtmlCallback , configure , escapeOnce , fixDoubleEscape , getAttribute , getAttributes , getCharset , getOption , getOptions , getRequiredOptions , hasOption , isXhtml , render , renderContentTag , renderTag , setAttribute , setAttributes , setCharset , setOption , setOptions , setXhtml , __construct
Method Details
-
addFormFormatter ($name, $formatter)
Browse code
| $name |
The formatter name |
| $formatter |
An sfWidgetFormSchemaFormatter instance |
Adds a form formatter.
-
generateName ($name, )
Browse code
Generates a name.
-
(sfWidget) getFields ()
Browse code
Returns an array of fields.
returns An array of sfWidget instance
-
(sfWidgetFormSchemaFormatter) getFormFormatter ()
Browse code
Returns the form formatter to use for widget schema rendering
returns sfWidgetFormSchemaFormatter instance
throws InvalidArgumentException
-
(string) getFormFormatterName ()
Browse code
Gets the form formatter name that will be used to render the widget schema.
returns The form formatter name
-
(array) getFormFormatters ()
Browse code
Returns all the form formats defined for this form schema.
returns An array of named form formats
-
(string) getGlobalErrors ($errors)
Browse code
| $errors |
An array of errors |
Gets errors that need to be included in global errors.
returns An HTML representation of global errors for the widget
-
(string) getHelp ($name)
Browse code
Gets a text help by field name.
returns The help text or an empty string if it is not defined
-
Sets the help texts.
returns An array of help texts
-
(string) getLabel ($name)
Browse code
Gets a label by field name.
returns The label name or an empty string if it is not defined
-
Gets the labels.
returns An array of label names
-
(string) getNameFormat ()
Browse code
Gets the format string for the name HTML attribute.
returns The format string
-
(sfWidgetFormSchema) getParent ()
Browse code
Gets the parent widget schema.
returns The parent widget schema
-
(array) getPositions ()
Browse code
Gets the positions of the fields.
The field positions are only used when rendering the schema with ->render().
returns An ordered array of field names
-
Moves a field in a given position
Available actions are: * sfWidgetFormSchema::BEFORE
* sfWidgetFormSchema::AFTER
* sfWidgetFormSchema::LAST
* sfWidgetFormSchema::FIRST
-
(bool) needsMultipartForm ()
Browse code
Returns true if the widget schema needs a multipart form.
returns true if the widget schema needs a multipart form, false otherwise
-
(bool) offsetExists ($name)
Browse code
Returns true if the schema has a field with the given name (implements the ArrayAccess interface).
returns true if the schema has a field with the given name, false otherwise
-
(sfWidget) offsetGet ($name)
Browse code
Gets the field associated with the given name (implements the ArrayAccess interface).
returns The sfWidget instance associated with the given name, null if it does not exist
-
offsetSet ($name, $widget)
Browse code
| $name |
The field name |
| $widget |
An sfWidget instance |
Sets a field (implements the ArrayAccess interface).
-
Removes a field by name (implements the ArrayAccess interface).
-
(string) render ($name, $values, $attributes, $errors)
Browse code
| $name |
The name of the HTML widget |
| $values |
The values of the widget |
| $attributes |
An array of HTML attributes |
| $errors |
An array of errors |
Renders the widget.
returns An HTML representation of the widget
-
(string) renderField ($name, $value, $attributes, $attributes)
Browse code
| $name |
The field name |
| $value |
The field value |
| $attributes |
An array of errors for the field |
Renders a field by name.
returns An HTML string representing the rendered widget
-
setDefaultFormFormatterName ($name)
Browse code
| $name |
New default formatter name |
Sets the generic default formatter name used by the class. If you want all
of your forms to be generated with the list format, you can
do it in a project or application configuration class:
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
sfWidgetFormSchema::setDefaultFormFormatterName('list');
}
}
-
setFormFormatterName ($name)
Browse code
| $name |
The form formatter name |
Sets the form formatter name to use when rendering the widget schema.
-
setHelp ($name, $help)
Browse code
| $name |
The field name |
| $help |
The help text |
Sets a help text.
-
| $helps |
An array of help texts |
Sets the help texts to render for each field.
-
setLabel ($name, $value)
Browse code
| $name |
The field name |
| $value |
The label name |
Sets a label.
-
| $labels |
An array of label names |
Sets the label names to render for each field.
-
setNameFormat ($format)
Browse code
| $format |
The format string (must contain a %s for the name placeholder) |
Sets the format string for the name HTML attribute.
If you are using the form framework with symfony, do not use a reserved word in the
name format. If you do, symfony may act in an unexpected manner. For symfony 1.1 and 1.2, the following words are reserved and must NOT be used as
the name format: * module (example: module[%s])
* action (example: action[%s]) However, you CAN use other variations, such as actions[%s] (note the s).
-
Sets the parent widget schema.
-
Sets the positions of the fields.
-
-
__construct ($fields, $options, $attributes, $labels, $helps)
Browse code
| $fields |
Initial fields |
| $options |
An array of options |
| $attributes |
An array of default HTML attributes |
| $labels |
An array of HTML labels |
| $helps |
An array of help texts |
Constructor.
The first argument can be: * null
* an array of sfWidget instances Available options: * name_format: The sprintf pattern to use for input names
* form_formatter: The form formatter name (table and list are bundled)
|