WFFormatter
Formatters provide a way for WFWidget objects to convert to and from text. Formatters are used by widgets to convert their "value" object into what is displayed and vice-versa. For instance, you could assign a DATE object (ie int) to a widget, and also a WFDateFormatter, and it would automatically convert the INT into a nice human-readable format. The user could edit this, and then the WFDateFormatter would convert the string back into a date object before proceeding.
Formatters should always allow EMPTY values cleanly. If the developer wants to enforce a non-empty value, that should be done via validation.
Located in /framework/widgets/WFFormatter.php (line 24)
WFObject | --WFFormatter
| Class | Description |
|---|---|
| WFUNIXDateFormatter | The UNIX date formatter converts between human-readable dates and UNIX time. |
| WFSQLDateFormatter | The SQL Date formatter converts between SQL date format and human-readable dates. |
| WFNumberFormatter | The Number format converts between "pretty" numbers with formatting and PHP numeric types. |
| WFBooleanFormatter | The Boolean formatter converts between boolean values and YES / NO equivalents. |
Retrieve a string for the passed in value. This is the string that the user would EDIT.
The default implementation simply calls stringForValue.
An example of why you would implement this function would be if the value to edit is different from the value to display. For instance, for a dollar value of 5.00 you might prefer to display "$5.00" and edit "5.00".
Retrieve a string for the passed in value.
Retreive a value for the passed in string.
Errors on conversion are detected by the presence of an errorMessage or errorCode.
Inherited From WFObject
WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForUndefinedKey()
WFObject::__toString()
Documentation generated on Thu, 17 Apr 2008 13:51:45 -0400 by phpDocumentor 1.4.1