| [ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
Helper class to keep track of options when mixing links and form elements. Copyright © 2008, Niklas Laxström Copyright © 2011, Antoine Musso Copyright © 2013, Bartosz Dziewoński
| Author: | Niklas Laxström |
| Author: | Antoine Musso |
| File Size: | 411 lines (11 kb) |
| Included or required: | 0 times |
| Referenced: | 1 time |
| Includes or requires: | 0 files |
FormOptions:: (20 methods):
add()
delete()
guessType()
validateName()
setValue()
getValue()
getValueReal()
reset()
consumeValue()
consumeValues()
validateIntBounds()
validateBounds()
getUnconsumedValues()
getChangedValues()
getAllValues()
fetchValuesFromRequest()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
Class: FormOptions - X-Ref
Helper class to keep track of options when mixing links and form elements.| add( $name, $default, $type = self::AUTO ) X-Ref |
| Add an option to be handled by this FormOptions instance. param: string $name Request parameter name param: mixed $default Default value when the request parameter is not present param: int $type One of the type constants (optional, defaults to AUTO) |
| delete( $name ) X-Ref |
| Remove an option being handled by this FormOptions instance. This is the inverse of add(). param: string $name Request parameter name |
| guessType( $data ) X-Ref |
| Used to find out which type the data is. All types are defined in the 'Type constants' section of this class. Detection of the INTNULL type is not supported; INT will be assumed if the data is an integer, MWException will be thrown if it's null. param: mixed $data Value to guess the type for return: int Type constant |
| validateName( $name, $strict = false ) X-Ref |
| Verify that the given option name exists. param: string $name Option name param: bool $strict Throw an exception when the option doesn't exist instead of returning false return: bool True if the option exists, false otherwise |
| setValue( $name, $value, $force = false ) X-Ref |
| Use to set the value of an option. param: string $name Option name param: mixed $value Value for the option param: bool $force Whether to set the value when it is equivalent to the default value for this |
| getValue( $name ) X-Ref |
| Get the value for the given option name. Uses getValueReal() internally. param: string $name Option name return: mixed |
| getValueReal( $option ) X-Ref |
| Return current option value, based on a structure taken from $options. param: array $option Array structure describing the option return: mixed Value, or the default value if it is null |
| reset( $name ) X-Ref |
| Delete the option value. This will make future calls to getValue() return the default value. param: string $name Option name |
| consumeValue( $name ) X-Ref |
| Get the value of given option and mark it as 'consumed'. Consumed options are not returned by getUnconsumedValues(). param: string $name Option name return: mixed Value, or the default value if it is null |
| consumeValues( $names ) X-Ref |
| Get the values of given options and mark them as 'consumed'. Consumed options are not returned by getUnconsumedValues(). param: array $names Array of option names as strings return: array Array of option values, or the default values if they are null |
| validateIntBounds( $name, $min, $max ) X-Ref |
| validateBounds( $name, $min, $max ) X-Ref |
| Constrain a numeric value for a given option to a given range. The value will be altered to fit in the range. param: string $name Option name param: int|float $min Minimum value param: int|float $max Maximum value |
| getUnconsumedValues( $all = false ) X-Ref |
| Get all remaining values which have not been consumed by consumeValue() or consumeValues(). param: bool $all Whether to include unchanged options (default: false) return: array |
| getChangedValues() X-Ref |
| Return options modified as an array ( name => value ) return: array |
| getAllValues() X-Ref |
| Format options to an array ( name => value ) return: array |
| fetchValuesFromRequest( WebRequest $r, $optionKeys = null ) X-Ref |
| Fetch values for all options (or selected options) from the given WebRequest, making them available for accessing with getValue() or consumeValue() etc. param: WebRequest $r The request to fetch values from param: array $optionKeys Which options to fetch the values for (default: |
| offsetExists( $name ) X-Ref |
| Whether the option exists. param: string $name return: bool |
| offsetGet( $name ) X-Ref |
| Retrieve an option value. param: string $name return: mixed |
| offsetSet( $name, $value ) X-Ref |
| Set an option to given value. param: string $name param: mixed $value |
| offsetUnset( $name ) X-Ref |
| Delete the option. param: string $name |
| Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |