-
(sfWidget) addFormFormatter ($name, $formatter)
Browse code
| $name |
The formatter name |
| $formatter |
An sfWidgetFormSchemaFormatter instance |
Adds a form formatter.
returns The current widget instance
-
(string) generateName ($name)
Browse code
Generates a name.
returns The generated name
-
(string) getDefault ($name)
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
-
(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 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)
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
-
(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, $action, $pivot)
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
-
(sfWidget|null) 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).
throws InvalidArgumentException when the field is not instance of sfWidget
-
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
throws InvalidArgumentException when values type is not array|ArrayAccess
-
(string) renderField ($name, $value, $attributes, $errors)
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
-
(sfWidget) setDefault ($name, $value)
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.
returns The current widget instance
-
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');
}
}
-
(sfWidget) setDefaults ($values)
Browse code
| $values |
The default values for the widget |
Sets the default values for the widget.
returns The current widget instance
-
(sfWidget) setFormFormatterName ($name)
Browse code
| $name |
The form formatter name |
Sets the form formatter name to use when rendering the widget schema.
returns The current widget instance
-
(sfWidget) setHelp ($name, $help)
Browse code
| $name |
The field name |
| $help |
The help text |
Sets a help text.
returns The current widget instance
-
(sfWidget) setHelps ($helps)
Browse code
| $helps |
An array of help texts |
Sets the help texts to render for each field.
returns The current widget instance
-
(sfWidget) setLabel ($name, $value)
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.
returns The current widget instance
throws InvalidArgumentException when you try to set a label on a none existing widget
-
(sfWidget) setLabels ($labels)
Browse code
| $labels |
An array of label names |
Sets the label names to render for each field.
returns The current widget instance
-
(sfWidget) 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+, 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).
returns The current widget instance
throws InvalidArgumentException when no %s exists in the format
-
(sfWidget) setPositions ($positions)
Browse code
| $positions |
An ordered array of field names |
Sets the positions of the fields.
returns The current widget instance
throws InvalidArgumentException when not all fields set in $positions
-
-
__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)
throws InvalidArgumentException when the passed fields not null or array