MediaWiki
REL1_23
|
The parent class to generate form fields. More...
Public Member Functions | |
__construct ($params) | |
Initialise the object. | |
filter ($value, $alldata) | |
getAttributes (array $list) | |
Returns the given attributes from the parameters. | |
getDefault () | |
getDiv ($value) | |
Get the complete div for the input, including help text, labels, and whatever. | |
getErrorsAndErrorClass ($value) | |
Determine form errors to display and their classes. | |
getHelpText () | |
Determine the help text to display. | |
getHelpTextHtmlDiv ($helptext) | |
Generate help text HTML in div format. | |
getHelpTextHtmlRaw ($helptext) | |
Generate help text HTML formatted for raw output. | |
getHelpTextHtmlTable ($helptext) | |
Generate help text HTML in table format. | |
getInputHTML ($value) | |
This function must be implemented to return the HTML to generate the input object itself. | |
getLabel () | |
getLabelHtml ($cellAttributes=array()) | |
getOptions () | |
Fetch the array of options from the field's parameters. | |
getRaw ($value) | |
Get the complete raw fields for the input, including help text, labels, and whatever. | |
getTableRow ($value) | |
Get the complete table row for the input, including help text, labels, and whatever. | |
getTooltipAndAccessKey () | |
Returns the attributes required for the tooltip and accesskey. | |
loadDataFromRequest ($request) | |
Get the value that this input has been set to from a posted form, or the input's default value if it has not been set. | |
msg () | |
Get a translated interface message. | |
setShowEmptyLabel ($show) | |
Tell the field whether to generate a separate label element if its label is blank. | |
validate ($value, $alldata) | |
Override this function to add specific validation checks on the field input. | |
Static Public Member Functions | |
static | flattenOptions ($options) |
flatten an array of options to a single array, for instance, a set of "<options>" inside "<optgroups>". | |
static | forceToStringRecursive ($array) |
Recursively forces values in an array to strings, because issues arise with integer 0 as a value. | |
Public Attributes | |
$mParams | |
HTMLForm | $mParent |
Protected Member Functions | |
needsLabel () | |
Should this field have a label, or is there no input element with the appropriate id for the label to point to? | |
Static Protected Member Functions | |
static | formatErrors ($errors) |
Formats one or more errors as accepted by field validation-callback. | |
Protected Attributes | |
$mClass = '' | |
$mDefault | |
$mFilterCallback | |
$mID | |
$mLabel | |
$mName | |
$mOptions = false | |
$mOptionsLabelsNotFromMessage = false | |
bool | $mShowEmptyLabels = true |
If true will generate an empty div element with no label. | |
$mValidationCallback | |
Private Member Functions | |
lookupOptionsKeys ($options) | |
Given an array of msg-key => value mappings, returns an array with keys being the message texts. |
The parent class to generate form fields.
Any field type should be a subclass of this.
Definition at line 7 of file HTMLFormField.php.
HTMLFormField::__construct | ( | $ | params | ) |
Initialise the object.
array | $params | Associative Array. See HTMLForm doc for syntax. |
MWException |
Reimplemented in Licenses, HTMLCheckMatrix, HTMLSelectAndOtherField, HTMLButtonField, HTMLInfoField, HTMLSelectOrOtherField, and HTMLHiddenField.
Definition at line 142 of file HTMLFormField.php.
HTMLFormField::filter | ( | $ | value, |
$ | alldata | ||
) |
Definition at line 88 of file HTMLFormField.php.
static HTMLFormField::flattenOptions | ( | $ | options | ) | [static] |
flatten an array of options to a single array, for instance, a set of "<options>" inside "<optgroups>".
array | $options | Associative Array with values either Strings or Arrays |
Definition at line 601 of file HTMLFormField.php.
Referenced by HTMLSelectAndOtherField\__construct(), Preferences\datetimePreferences(), HTMLMultiSelectField\filterDataForSubmit(), HTMLCheckMatrix\filterDataForSubmit(), HTMLSelectOrOtherField\getInputHTML(), Preferences\getOptionFromUser(), HTMLRadioField\validate(), HTMLSelectField\validate(), and HTMLMultiSelectField\validate().
static HTMLFormField::forceToStringRecursive | ( | $ | array | ) | [static] |
Recursively forces values in an array to strings, because issues arise with integer 0 as a value.
array | $array |
Definition at line 536 of file HTMLFormField.php.
Referenced by HTMLMultiSelectField\filterDataForSubmit(), and HTMLMultiSelectField\getInputHTML().
static HTMLFormField::formatErrors | ( | $ | errors | ) | [static, protected] |
Formats one or more errors as accepted by field validation-callback.
Definition at line 622 of file HTMLFormField.php.
HTMLFormField::getAttributes | ( | array $ | list | ) |
Returns the given attributes from the parameters.
array | $list | List of attributes to get |
Definition at line 493 of file HTMLFormField.php.
Referenced by HTMLMultiSelectField\formatOptions(), HTMLRadioField\formatOptions(), HTMLCheckField\getInputHTML(), HTMLTextField\getInputHTML(), HTMLTextAreaField\getInputHTML(), HTMLButtonField\getInputHTML(), HTMLSelectAndOtherField\getInputHTML(), and HTMLCheckMatrix\getInputHTML().
Reimplemented in HTMLCheckMatrix, and HTMLMultiSelectField.
Definition at line 466 of file HTMLFormField.php.
Referenced by HTMLCheckField\loadDataFromRequest(), HTMLSelectAndOtherField\loadDataFromRequest(), and HTMLSelectOrOtherField\loadDataFromRequest().
HTMLFormField::getDiv | ( | $ | value | ) |
Get the complete div for the input, including help text, labels, and whatever.
string | $value | The value to set the input to. |
Reimplemented in HTMLInfoField, HTMLHiddenField, HTMLEditTools, and HTMLApiField.
Definition at line 270 of file HTMLFormField.php.
HTMLFormField::getErrorsAndErrorClass | ( | $ | value | ) |
Determine form errors to display and their classes.
string | $value | The value of the input |
Definition at line 409 of file HTMLFormField.php.
Referenced by HTMLCheckMatrix\getTableRow().
Determine the help text to display.
Definition at line 374 of file HTMLFormField.php.
Referenced by HTMLCheckMatrix\getTableRow().
HTMLFormField::getHelpTextHtmlDiv | ( | $ | helptext | ) |
Generate help text HTML in div format.
string | null | $helptext |
Definition at line 348 of file HTMLFormField.php.
HTMLFormField::getHelpTextHtmlRaw | ( | $ | helptext | ) |
Generate help text HTML formatted for raw output.
string | null | $helptext |
Definition at line 365 of file HTMLFormField.php.
HTMLFormField::getHelpTextHtmlTable | ( | $ | helptext | ) |
Generate help text HTML in table format.
string | null | $helptext |
Definition at line 329 of file HTMLFormField.php.
Referenced by HTMLCheckMatrix\getTableRow().
HTMLFormField::getInputHTML | ( | $ | value | ) | [abstract] |
This function must be implemented to return the HTML to generate the input object itself.
It should not implement the surrounding table cells/rows, or labels/help messages.
string | $value | the value to set the input to; eg a default text for a text input. |
Reimplemented in Licenses, HTMLCheckMatrix, HTMLHiddenField, HTMLRadioField, HTMLSelectAndOtherField, HTMLMultiSelectField, HTMLSelectField, HTMLSelectOrOtherField, HTMLButtonField, HTMLApiField, HTMLTextAreaField, HTMLInfoField, HTMLTextField, HTMLCheckField, and HTMLEditTools.
Reimplemented in HTMLCheckField.
Definition at line 425 of file HTMLFormField.php.
HTMLFormField::getLabelHtml | ( | $ | cellAttributes = array() | ) |
Reimplemented in UploadSourceField.
Definition at line 429 of file HTMLFormField.php.
Referenced by HTMLCheckMatrix\getTableRow().
Fetch the array of options from the field's parameters.
In order, this checks 'options-messages', 'options', then 'options-message'.
Definition at line 550 of file HTMLFormField.php.
Referenced by HTMLSelectOrOtherField\__construct(), HTMLSelectAndOtherField\__construct(), HTMLMultiSelectField\filterDataForSubmit(), HTMLSelectOrOtherField\getInputHTML(), HTMLSelectField\getInputHTML(), HTMLMultiSelectField\getInputHTML(), HTMLRadioField\getInputHTML(), HTMLRadioField\validate(), HTMLMultiSelectField\validate(), and HTMLSelectField\validate().
HTMLFormField::getRaw | ( | $ | value | ) |
Get the complete raw fields for the input, including help text, labels, and whatever.
string | $value | The value to set the input to. |
Reimplemented in HTMLInfoField, HTMLHiddenField, HTMLEditTools, and HTMLApiField.
Definition at line 307 of file HTMLFormField.php.
HTMLFormField::getTableRow | ( | $ | value | ) |
Get the complete table row for the input, including help text, labels, and whatever.
string | $value | The value to set the input to. |
Reimplemented in HTMLCheckMatrix, HTMLInfoField, HTMLHiddenField, HTMLEditTools, and HTMLApiField.
Definition at line 224 of file HTMLFormField.php.
Returns the attributes required for the tooltip and accesskey.
Definition at line 479 of file HTMLFormField.php.
Referenced by HTMLCheckField\getInputHTML(), HTMLTextField\getInputHTML(), and HTMLTextAreaField\getInputHTML().
HTMLFormField::loadDataFromRequest | ( | $ | request | ) |
Get the value that this input has been set to from a posted form, or the input's default value if it has not been set.
WebRequest | $request |
Reimplemented in HTMLCheckMatrix, HTMLMultiSelectField, HTMLSelectOrOtherField, HTMLSelectAndOtherField, and HTMLCheckField.
Definition at line 126 of file HTMLFormField.php.
HTMLFormField::lookupOptionsKeys | ( | $ | options | ) | [private] |
Given an array of msg-key => value mappings, returns an array with keys being the message texts.
It also forces values to strings.
array | $options |
Definition at line 518 of file HTMLFormField.php.
Get a translated interface message.
This is a wrapper around $this->mParent->msg() if $this->mParent is set and wfMessage() otherwise.
Parameters are the same as wfMessage().
Definition at line 51 of file HTMLFormField.php.
Referenced by HTMLEditTools\formatMsg(), HTMLSelectAndOtherField\loadDataFromRequest(), HTMLIntField\validate(), HTMLSelectField\validate(), HTMLMultiSelectField\validate(), HTMLRadioField\validate(), HTMLFloatField\validate(), HTMLCheckMatrix\validate(), and HTMLSelectAndOtherField\validate().
HTMLFormField::needsLabel | ( | ) | [protected] |
Should this field have a label, or is there no input element with the appropriate id for the label to point to?
Reimplemented in HTMLMultiSelectField, HTMLRadioField, HTMLCheckField, HTMLInfoField, and HTMLButtonField.
Definition at line 102 of file HTMLFormField.php.
HTMLFormField::setShowEmptyLabel | ( | $ | show | ) |
Tell the field whether to generate a separate label element if its label is blank.
bool | $show | Set to false to not generate a label. |
Definition at line 115 of file HTMLFormField.php.
HTMLFormField::validate | ( | $ | value, |
$ | alldata | ||
) |
Override this function to add specific validation checks on the field input.
Don't forget to call parent::validate() to ensure that the user-defined callback mValidationCallback is still run
string | $value | The value the field was submitted with |
array | $alldata | The data collected from the form |
Reimplemented in EditWatchlistCheckboxSeriesField, HTMLBlockedUsersItemSelect, HTMLSelectAndOtherField, HTMLCheckMatrix, HTMLButtonField, HTMLFloatField, HTMLIntField, HTMLMultiSelectField, HTMLRadioField, and HTMLSelectField.
Definition at line 73 of file HTMLFormField.php.
Referenced by HtmlCheckMatrixTest\validate().
HTMLFormField::$mClass = '' [protected] |
Definition at line 15 of file HTMLFormField.php.
HTMLFormField::$mDefault [protected] |
Definition at line 16 of file HTMLFormField.php.
HTMLFormField::$mFilterCallback [protected] |
Definition at line 11 of file HTMLFormField.php.
HTMLFormField::$mID [protected] |
Definition at line 14 of file HTMLFormField.php.
HTMLFormField::$mLabel [protected] |
Definition at line 13 of file HTMLFormField.php.
HTMLFormField::$mName [protected] |
Definition at line 12 of file HTMLFormField.php.
HTMLFormField::$mOptions = false [protected] |
Definition at line 17 of file HTMLFormField.php.
HTMLFormField::$mOptionsLabelsNotFromMessage = false [protected] |
Definition at line 18 of file HTMLFormField.php.
HTMLFormField::$mParams |
Definition at line 8 of file HTMLFormField.php.
HTMLForm HTMLFormField::$mParent |
Definition at line 27 of file HTMLFormField.php.
bool HTMLFormField::$mShowEmptyLabels = true [protected] |
If true will generate an empty div element with no label.
Definition at line 23 of file HTMLFormField.php.
HTMLFormField::$mValidationCallback [protected] |
Definition at line 10 of file HTMLFormField.php.