sfWidget is the base class for all widgets.
Method Summary
-
addOption($name, $value)
Adds a new option value with a default value.
-
addRequiredOption($name)
Adds a required option.
-
string
attributesToHtml($attributes)
Converts an array of attributes to its HTML representation.
-
string
attributesToHtmlCallback($k, $v)
Prepares an attribute key and value for HTML representation.
-
configure($options, $attributes)
Configures the current widget.
-
string
escapeOnce($value)
Escapes a string.
-
string
fixDoubleEscape($escaped)
Fixes double escaped strings.
-
string
getAttribute($name)
Returns the HTML attribute value for a given attribute name.
-
getAttributes()
Returns the default HTML attributes.
-
string
getCharset()
Returns the charset to use when rendering widgets.
-
mixed
getOption()
Gets an option value.
-
array
getOptions()
Gets all options.
-
getRequiredOptions()
Returns all required option names.
-
bool
hasOption($name)
Returns true if the option exists.
-
bool
isXhtml()
Returns whether to generate XHTML tags or not.
-
string
render($name, $value, $attributes, $errors)
Renders the widget as HTML.
-
renderContentTag($tag, $content, $attributes, )
Renders a HTML content tag.
-
renderTag($tag, $attributes, )
Renders a HTML tag.
-
setAttribute($name, $value)
Sets a default HTML attribute.
-
setAttributes($attributes)
Sets the HTML attributes.
-
setCharset($charset)
Sets the charset to use when rendering widgets.
-
setOption($name, $value)
Changes an option value.
-
setOptions($options)
Sets the options.
-
setXhtml($boolean)
Sets the XHTML generation flag.
-
__construct($options, $attributes)
Constructor.
Method Details
-
addOption ($name, $value)
Browse code
| $name |
The option name |
| $value |
The default value |
Adds a new option value with a default value.
-
addRequiredOption ($name)
Browse code
Adds a required option.
-
(string) attributesToHtml ($attributes)
Browse code
| $attributes |
An array of attributes |
Converts an array of attributes to its HTML representation.
returns The HTML representation of the HTML attribute array.
-
(string) attributesToHtmlCallback ($k, $v)
Browse code
| $k |
The attribute key |
| $v |
The attribute value |
Prepares an attribute key and value for HTML representation.
returns The HTML representation of the HTML key attribute pair.
-
configure ($options, $attributes)
Browse code
| $options |
An array of options |
| $attributes |
An array of HTML attributes |
Configures the current widget.
This method allows each widget to add options or HTML attributes
during widget creation. If some options and HTML attributes are given in the sfWidget constructor
they will take precedence over the options and HTML attributes you configure
in this method.
-
(string) escapeOnce ($value)
Browse code
Escapes a string.
returns escaped string
-
(string) fixDoubleEscape ($escaped)
Browse code
Fixes double escaped strings.
returns single escaped string
-
(string) getAttribute ($name)
Browse code
| $name |
The attribute name. |
Returns the HTML attribute value for a given attribute name.
returns The attribute value, or null if the attribute does not exist
-
Returns the default HTML attributes.
-
(string) getCharset ()
Browse code
Returns the charset to use when rendering widgets.
returns The charset (defaults to UTF-8)
-
Gets an option value.
returns The option value
-
Gets all options.
returns An array of named options
-
Returns all required option names.
-
(bool) hasOption ($name)
Browse code
Returns true if the option exists.
returns true if the option exists, false otherwise
-
Returns whether to generate XHTML tags or not.
returns true if widgets must be generated as XHTML, false otherwise
-
(string) render ($name, $value, $attributes, $errors)
Browse code
| $name |
The name of the HTML widget |
| $value |
The value of the widget |
| $attributes |
An array of HTML attributes |
| $errors |
An array of errors |
Renders the widget as HTML.
All subclasses must implement this method.
returns A HTML representation of the widget
-
renderContentTag ($tag, $content, $attributes, )
Browse code
| $tag |
The tag name |
| $content |
The content of the tag |
| $attributes |
An array of HTML attributes to be merged with the default HTML attributes |
Renders a HTML content tag.
-
renderTag ($tag, $attributes, )
Browse code
| $tag |
The tag name |
| $attributes |
An array of HTML attributes to be merged with the default HTML attributes |
Renders a HTML tag.
-
setAttribute ($name, $value)
Browse code
| $name |
The attribute name |
| $value |
The attribute value |
Sets a default HTML attribute.
-
setAttributes ($attributes)
Browse code
| $attributes |
An array of HTML attributes |
Sets the HTML attributes.
-
Sets the charset to use when rendering widgets.
-
setOption ($name, $value)
Browse code
| $name |
The option name |
| $value |
The value |
Changes an option value.
-
| $options |
An array of options |
Sets the options.
-
| $boolean |
true if widgets must be generated as XHTML, false otherwise |
Sets the XHTML generation flag.
-
__construct ($options, $attributes)
Browse code
| $options |
An array of options |
| $attributes |
An array of default HTML attributes |
Constructor.
|