-
addFormFormatter ($name, $formatter)
Browse code
| $name |
The formatter name
|
| $formatter |
An sfWidgetFormSchemaFormatter instance
|
Adds a form formatter.
-
(string) generateName ($name)
Browse code
Generates a name.
returns The generated name
-
(string) getDefault ($name = null)
Browse code
| $name |
The field name (required - the default value is here because PHP do not
allow signature changes with inheritance)
|
Gets the default value of a field.
returns The default value
-
(array) getDefaults ()
Browse code
Returns the defaults values for the widget schema.
returns An array of default values
-
Returns an array of fields.
returns An array of sfWidget instance
-
Returns the form formatter to use for widget schema rendering
returns sfWidgetFormSchemaFormatter instance
throws InvalidArgumentException when the form formatter not exists
-
(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
-
(array) getJavaScripts ()
Browse code
Gets the JavaScript paths associated with the widget.
returns An array of JavaScript paths
-
(string) getLabel ($name = null)
Browse code
| $name |
The field name (required - the default value is here because PHP do not
allow signature changes with inheritance)
|
Gets a label by field name.
returns The label name or an empty string if it is not defined
throws InvalidArgumentException when you try to get a label for a none existing widget
-
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
-
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
-
(array) getStylesheets ()
Browse code
Gets the stylesheet paths associated with the widget.
returns An array of stylesheet paths
-
moveField ($field, (constant) $action, $pivot = null)
Browse code
| $field |
The field name to move
|
| $action |
The action (see above for all possible actions)
|
| $pivot |
The field name used for AFTER and BEFORE actions
|
Moves a field in a given position
Available actions are:
* sfWidgetFormSchema::BEFORE * sfWidgetFormSchema::AFTER * sfWidgetFormSchema::LAST * sfWidgetFormSchema::FIRST
throws InvalidArgumentException when field not exist
-
(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
-
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, (sfWidget) $widget)
Browse code
| $name |
The field name
|
| $widget |
An sfWidget instance
|
Sets a field (implements the ArrayAccess interface).
throws InvalidArgumentException when the field is not instance of sfWidget
-
Removes a field by name (implements the ArrayAccess interface).
-
(string) render ($name, $values = array(), $attributes = array(), $errors = array())
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
throws InvalidArgumentException when values type is not array|ArrayAccess
-
(string) renderField ($name, $value = null, $attributes = array(), $errors = array())
Browse code
| $name |
The field name
|
| $value |
The field value
|
| $attributes |
An array of HTML attributes to be merged with the current HTML attributes
|
| $errors |
An array of errors for the field
|
Renders a field by name.
returns An HTML string representing the rendered widget
throws InvalidArgumentException when the widget not exist
-
setDefault ($name, $value = null)
Browse code
| $name |
The field name
|
| $value |
The default value (required - the default value is here because PHP do not
allow signature changes with inheritance)
|
Sets the default value for a field.
-
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 format, you can do it in a
project or application configuration class:
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
sfWidgetFormSchema::setDefaultFormFormatterName('list');
}
}
-
| $values |
The default values for the widget
|
Sets the default values for the widget.
-
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 = null)
Browse code
| $name |
The field name
|
| $value |
The label name (required - the default value is here because PHP do not
allow signature changes with inheritance)
|
Sets a label.
throws InvalidArgumentException when you try to set a label on a none existing widget
-
| $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).
throws InvalidArgumentException when no %s exists in the format
-
setParent ($parent = null)
Browse code
Sets the parent widget schema.
-
setPositions ($positions)
Browse code
| $positions |
An ordered array of field names
|
Sets the positions of the fields.
throws InvalidArgumentException when not all fields set in $positions
-
-
__construct ($fields = null, $options = array(), $attributes = array(), $labels = array(), $helps = array())
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)
throws InvalidArgumentException when the passed fields not null or array