MediaWiki
master
|
The parent class to generate form fields. More...
Public Member Functions | |
__construct ( $params) | |
Initialise the object. More... | |
cancelSubmit ( $value, $alldata) | |
Override this function if the control can somehow trigger a form submission that shouldn't actually submit the HTMLForm. More... | |
canDisplayErrors () | |
True if this field type is able to display errors; false if validation errors need to be displayed in the main HTMLForm error area. More... | |
filter ( $value, $alldata) | |
getAttributes (array $list) | |
Returns the given attributes from the parameters. More... | |
getDefault () | |
getDiv ( $value) | |
Get the complete div for the input, including help text, labels, and whatever. More... | |
getErrorsAndErrorClass ( $value) | |
Determine form errors to display and their classes. More... | |
getErrorsRaw ( $value) | |
Determine form errors to display, returning them in an array. More... | |
getHelpText () | |
Determine the help text to display. More... | |
getHelpTextHtmlDiv ( $helptext) | |
Generate help text HTML in div format. More... | |
getHelpTextHtmlRaw ( $helptext) | |
Generate help text HTML formatted for raw output. More... | |
getHelpTextHtmlTable ( $helptext) | |
Generate help text HTML in table format. More... | |
getInline ( $value) | |
Get the complete field as an inline element. More... | |
getInputHTML ( $value) | |
This function must be implemented to return the HTML to generate the input object itself. More... | |
getInputOOUI ( $value) | |
Same as getInputHTML, but returns an OOUI object. More... | |
getLabel () | |
getLabelHtml ( $cellAttributes=[]) | |
getName () | |
Get the field name that will be used for submission. More... | |
getOOUI ( $value) | |
Get the OOUI version of the div. More... | |
getOptions () | |
Fetch the array of options from the field's parameters. More... | |
getOptionsOOUI () | |
Get options and make them into arrays suitable for OOUI. More... | |
getRaw ( $value) | |
Get the complete raw fields for the input, including help text, labels, and whatever. More... | |
getTableRow ( $value) | |
Get the complete table row for the input, including help text, labels, and whatever. More... | |
getTooltipAndAccessKey () | |
Returns the attributes required for the tooltip and accesskey, for Html::element() etc. More... | |
getTooltipAndAccessKeyOOUI () | |
Returns the attributes required for the tooltip and accesskey, for OOUI widgets' config. More... | |
getVForm ( $value) | |
Get the complete field for the input, including help text, labels, and whatever. More... | |
hasVisibleOutput () | |
If this field has a user-visible output or not. More... | |
isDisabled ( $alldata) | |
Test whether this field is supposed to be disabled, based on the values of the other form fields. More... | |
isHelpInline () | |
Determine if the help text should be displayed inline. More... | |
isHidden ( $alldata) | |
Test whether this field is supposed to be hidden, based on the values of the other form fields. More... | |
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. More... | |
msg ( $key,... $params) | |
Get a translated interface message. More... | |
needsJSForHtml5FormValidation () | |
Whether this field requires the user agent to have JavaScript enabled for the client-side HTML5 form validation to work correctly. More... | |
setShowEmptyLabel ( $show) | |
Tell the field whether to generate a separate label element if its label is blank. More... | |
skipLoadData ( $request) | |
Skip this field when collecting data. More... | |
validate ( $value, $alldata) | |
Override this function to add specific validation checks on the field input. More... | |
Static Public Member Functions | |
static | flattenOptions ( $options) |
flatten an array of options to a single array, for instance, a set of "<options>" inside "<optgroups>". More... | |
static | forceToStringRecursive ( $array) |
Recursively forces values in an array to strings, because issues arise with integer 0 as a value. More... | |
Public Attributes | |
array array[] | $mParams |
HTMLForm null | $mParent |
Protected Member Functions | |
checkStateRecurse (array $alldata, array $params) | |
Helper function for isHidden and isDisabled to handle recursive data structures. More... | |
getClassName () | |
Gets the non namespaced class name. More... | |
getFieldLayoutOOUI ( $inputField, $config) | |
Get a FieldLayout (or subclass thereof) to wrap this field in when using OOUI output. More... | |
getLabelAlignOOUI () | |
Get label alignment when generating field for OOUI. More... | |
getMessage ( $value) | |
Turns a *-message parameter (which could be a MessageSpecifier, or a message name, or a name + parameters array) into a Message. More... | |
getNearestField ( $name, $backCompat=false) | |
Get the closest field matching a given name. More... | |
getNearestFieldByName ( $alldata, $name, $asDisplay=false) | |
Fetch a field value from $alldata for the closest field matching a given name. More... | |
getNearestFieldValue ( $alldata, $name, $asDisplay=false, $backCompat=false) | |
Fetch a field value from $alldata for the closest field matching a given name. More... | |
getOOUIModules () | |
Get the list of extra ResourceLoader modules which must be loaded client-side before it's possible to infuse this field's OOUI widget. More... | |
isSubmitAttempt (WebRequest $request) | |
Can we assume that the request is an attempt to submit a HTMLForm, as opposed to an attempt to just view it? This can't normally be distinguished for e.g. More... | |
needsLabel () | |
Should this field have a label, or is there no input element with the appropriate id for the label to point to? More... | |
parseCondState ( $params) | |
Parse the cond-state array to use the field name for submission, since the key in the form descriptor is never known in HTML. More... | |
parseCondStateForClient () | |
Parse the cond-state array for client-side. More... | |
shouldInfuseOOUI () | |
Whether the field should be automatically infused. More... | |
validateCondState ( $params) | |
Validate the cond-state params, the existence check of fields should be done later. More... | |
Static Protected Member Functions | |
static | formatErrors ( $errors) |
Formats one or more errors as accepted by field validation-callback. More... | |
Protected Attributes | |
$mClass = '' | |
array | $mCondState = [] |
Array to hold params for 'hide-if' or 'disable-if' statements. More... | |
$mCondStateClass = [] | |
$mDefault | |
$mDir | |
$mFilterCallback | |
$mHelpClass = false | |
$mID | |
$mLabel | |
$mName | |
array null false | $mOptions = false |
$mOptionsLabelsNotFromMessage = false | |
bool | $mShowEmptyLabels = true |
If true will generate an empty div element with no label. More... | |
$mValidationCallback | |
$mVFormClass = '' | |
The parent class to generate form fields.
Any field type should be a subclass of this.
Definition at line 12 of file HTMLFormField.php.
HTMLFormField::__construct | ( | $params | ) |
Initialise the object.
array | $params | Associative Array. See HTMLForm doc for syntax. |
MWException |
Reimplemented in Licenses, HTMLUserTextField, HTMLTitleTextField, HTMLTitlesMultiselectField, HTMLTimezoneField, HTMLTextField, HTMLTextAreaField, HTMLSelectOrOtherField, HTMLSelectNamespace, HTMLSelectLanguageField, HTMLSelectAndOtherField, HTMLRadioField, HTMLMultiSelectField, HTMLHiddenField, HTMLFormFieldCloner, HTMLFileField, HTMLDateTimeField, HTMLCheckMatrix, HTMLAutoCompleteSelectField, HTMLTextFieldWithButton, HTMLSelectNamespaceWithButton, HTMLInfoField, HTMLFormFieldWithButton, and HTMLButtonField.
Definition at line 505 of file HTMLFormField.php.
References getMessage(), validateCondState(), and wfDeprecatedMsg().
HTMLFormField::cancelSubmit | ( | $value, | |
$alldata | |||
) |
Override this function if the control can somehow trigger a form submission that shouldn't actually submit the HTMLForm.
string | array | $value | The value the field was submitted with |
array | $alldata | The data collected from the form |
Reimplemented in HTMLFormFieldCloner.
Definition at line 387 of file HTMLFormField.php.
HTMLFormField::canDisplayErrors | ( | ) |
True if this field type is able to display errors; false if validation errors need to be displayed in the main HTMLForm error area.
Reimplemented in HTMLHiddenField.
Definition at line 80 of file HTMLFormField.php.
References hasVisibleOutput().
|
protected |
Helper function for isHidden and isDisabled to handle recursive data structures.
array | $alldata | |
array | $params |
MWException |
Definition at line 261 of file HTMLFormField.php.
References getNearestFieldValue(), and true.
Referenced by isDisabled(), and isHidden().
HTMLFormField::filter | ( | $value, | |
$alldata | |||
) |
mixed | $value | |
mixed[] | $alldata |
Definition at line 430 of file HTMLFormField.php.
References $mFilterCallback.
|
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 1260 of file HTMLFormField.php.
Referenced by HTMLSelectAndOtherField\__construct(), HTMLCheckMatrix\filterDataForSubmit(), HTMLMultiSelectField\filterDataForSubmit(), HTMLAutoCompleteSelectField\getInputHTML(), HTMLSelectOrOtherField\getInputHTML(), HTMLSelectOrOtherField\getInputOOUI(), MediaWiki\Preferences\DefaultPreferencesFactory\getOptionFromUser(), HTMLAutoCompleteSelectField\validate(), HTMLMultiSelectField\validate(), HTMLRadioField\validate(), and HTMLSelectField\validate().
|
static |
Recursively forces values in an array to strings, because issues arise with integer 0 as a value.
array | string | $array |
Definition at line 1202 of file HTMLFormField.php.
Referenced by HTMLMultiSelectField\filterDataForSubmit(), HTMLMultiSelectField\getInputHTML(), and getOptions().
|
staticprotected |
Formats one or more errors as accepted by field validation-callback.
string | Message | array | $errors | Array of strings or Message instances To work around limitations in phan-taint-check the calling class has taintedness disabled. So instead we pretend that this method outputs html, since the result is eventually outputted anyways without escaping and this allows us to verify stuff is safe even though the caller has taintedness cleared. |
-taint | $errors | exec_html |
Definition at line 1287 of file HTMLFormField.php.
References $lines.
Referenced by getErrorsAndErrorClass().
HTMLFormField::getAttributes | ( | array | $list | ) |
Returns the given attributes from the parameters.
array | $list | List of attributes to get |
Reimplemented in HTMLDateTimeField, HTMLComboboxField, and HTMLAutoCompleteSelectField.
Definition at line 1157 of file HTMLFormField.php.
Referenced by HTMLMultiSelectField\formatOptions(), HTMLRadioField\formatOptions(), HTMLButtonField\getInputHTML(), HTMLCheckField\getInputHTML(), HTMLCheckMatrix\getInputHTML(), HTMLFileField\getInputHTML(), HTMLFormFieldWithButton\getInputHTML(), HTMLSelectAndOtherField\getInputHTML(), HTMLSelectField\getInputHTML(), HTMLTextField\getInputHTML(), HTMLButtonField\getInputOOUI(), HTMLCheckField\getInputOOUI(), HTMLCheckMatrix\getInputOOUI(), HTMLFileField\getInputOOUI(), HTMLFormFieldWithButton\getInputOOUI(), HTMLMultiSelectField\getInputOOUI(), HTMLRadioField\getInputOOUI(), HTMLSelectAndOtherField\getInputOOUI(), HTMLSelectField\getInputOOUI(), HTMLSelectOrOtherField\getInputOOUI(), HTMLTextField\getInputOOUI(), and HTMLToggleSwitchField\getInputOOUI().
|
protected |
Gets the non namespaced class name.
Definition at line 787 of file HTMLFormField.php.
Referenced by HTMLFormFieldCloner\__construct(), getDiv(), getOOUI(), HTMLCheckMatrix\getTableRow(), and getTableRow().
HTMLFormField::getDefault | ( | ) |
Reimplemented in HTMLSelectAndOtherField, HTMLRestrictionsField, HTMLMultiSelectField, HTMLInfoField, HTMLFormFieldCloner, HTMLCheckMatrix, and HTMLCheckField.
Definition at line 1117 of file HTMLFormField.php.
Referenced by HTMLButtonField\getInputHTML(), HTMLButtonField\getInputOOUI(), HTMLAutoCompleteSelectField\loadDataFromRequest(), HTMLDateTimeField\loadDataFromRequest(), HTMLNamespacesMultiselectField\loadDataFromRequest(), HTMLSelectOrOtherField\loadDataFromRequest(), HTMLSizeFilterField\loadDataFromRequest(), HTMLTagMultiselectField\loadDataFromRequest(), HTMLTitlesMultiselectField\loadDataFromRequest(), HTMLUsersMultiselectField\loadDataFromRequest(), and 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 HTMLTagFilter, HTMLInfoField, HTMLHiddenField, HTMLEditTools, and HTMLApiField.
Definition at line 657 of file HTMLFormField.php.
References $mClass, $mVFormClass, FormatJson\encode(), getClassName(), getErrorsAndErrorClass(), getHelpText(), getHelpTextHtmlDiv(), getInputHTML(), getLabelHtml(), and parseCondStateForClient().
Referenced by getOOUI(), and getVForm().
HTMLFormField::getErrorsAndErrorClass | ( | $value | ) |
Determine form errors to display and their classes.
phan-taint-check gets confused with returning both classes and errors and thinks double escaping is happening, so specify that return value has no taint.
string | $value | The value of the input |
Definition at line 1021 of file HTMLFormField.php.
References formatErrors(), and validate().
Referenced by getDiv(), getInline(), getRaw(), HTMLCheckMatrix\getTableRow(), and getTableRow().
HTMLFormField::getErrorsRaw | ( | $value | ) |
Determine form errors to display, returning them in an array.
string | $value | The value of the input |
Definition at line 1042 of file HTMLFormField.php.
References validate().
Referenced by getOOUI().
|
protected |
Get a FieldLayout (or subclass thereof) to wrap this field in when using OOUI output.
OOUI\\Widget | $inputField | |
array | $config |
Reimplemented in HTMLTextFieldWithButton, and HTMLSelectNamespaceWithButton.
Definition at line 807 of file HTMLFormField.php.
Referenced by getOOUI().
HTMLFormField::getHelpText | ( | ) |
Determine the help text to display.
Reimplemented in HTMLRestrictionsField.
Definition at line 970 of file HTMLFormField.php.
References getMessage(), and msg().
Referenced by getDiv(), getInline(), getOOUI(), getRaw(), HTMLCheckMatrix\getTableRow(), getTableRow(), and shouldInfuseOOUI().
HTMLFormField::getHelpTextHtmlDiv | ( | $helptext | ) |
Generate help text HTML in div format.
string | null | $helptext |
Definition at line 933 of file HTMLFormField.php.
References $mHelpClass, FormatJson\encode(), and parseCondStateForClient().
Referenced by getDiv(), getHelpTextHtmlRaw(), and getInline().
HTMLFormField::getHelpTextHtmlRaw | ( | $helptext | ) |
Generate help text HTML formatted for raw output.
string | null | $helptext |
Definition at line 960 of file HTMLFormField.php.
References getHelpTextHtmlDiv().
Referenced by getRaw().
HTMLFormField::getHelpTextHtmlTable | ( | $helptext | ) |
Generate help text HTML in table format.
string | null | $helptext |
Definition at line 904 of file HTMLFormField.php.
References $mCondStateClass, $mHelpClass, FormatJson\encode(), and parseCondStateForClient().
Referenced by HTMLCheckMatrix\getTableRow(), and getTableRow().
HTMLFormField::getInline | ( | $value | ) |
Get the complete field as an inline element.
string | $value | The value to set the input to. |
Definition at line 882 of file HTMLFormField.php.
References getErrorsAndErrorClass(), getHelpText(), getHelpTextHtmlDiv(), getInputHTML(), and getLabelHtml().
|
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.
mixed | $value | The value to set the input to; eg a default text for a text input. |
Reimplemented in HTMLFormFieldCloner, Licenses, HTMLUsersMultiselectField, HTMLTitlesMultiselectField, HTMLTextFieldWithButton, HTMLTextField, HTMLTextAreaField, HTMLTagMultiselectField, HTMLTagFilter, HTMLSizeFilterField, HTMLSelectOrOtherField, HTMLSelectNamespaceWithButton, HTMLSelectNamespace, HTMLSelectField, HTMLSelectAndOtherField, HTMLRestrictionsField, HTMLRadioField, HTMLNamespacesMultiselectField, HTMLMultiSelectField, HTMLInfoField, HTMLHiddenField, HTMLFormFieldWithButton, HTMLFileField, HTMLExpiryField, HTMLEditTools, HTMLComboboxField, HTMLCheckMatrix, HTMLCheckField, HTMLButtonField, HTMLAutoCompleteSelectField, and HTMLApiField.
Referenced by getDiv(), getInline(), getRaw(), and getTableRow().
HTMLFormField::getInputOOUI | ( | $value | ) |
Same as getInputHTML, but returns an OOUI object.
Defaults to false, which getOOUI will interpret as "use the HTML version"
string | $value |
Reimplemented in HTMLFormFieldCloner, HTMLUsersMultiselectField, HTMLToggleSwitchField, HTMLTitlesMultiselectField, HTMLTextField, HTMLTextAreaField, HTMLTagMultiselectField, HTMLTagFilter, HTMLSelectOrOtherField, HTMLSelectNamespace, HTMLSelectField, HTMLSelectAndOtherField, HTMLRestrictionsField, HTMLRadioField, HTMLNamespacesMultiselectField, HTMLMultiSelectField, HTMLInfoField, HTMLFormFieldWithButton, HTMLFileField, HTMLExpiryField, HTMLDateTimeField, HTMLComboboxField, HTMLCheckMatrix, HTMLCheckField, HTMLButtonField, and HTMLAutoCompleteSelectField.
Definition at line 70 of file HTMLFormField.php.
Referenced by getOOUI().
HTMLFormField::getLabel | ( | ) |
Reimplemented in HTMLCheckField.
Definition at line 1065 of file HTMLFormField.php.
Referenced by getLabelHtml(), and getOOUI().
|
protected |
Get label alignment when generating field for OOUI.
Reimplemented in HTMLCheckField.
Definition at line 797 of file HTMLFormField.php.
Referenced by getOOUI().
HTMLFormField::getLabelHtml | ( | $cellAttributes = [] | ) |
array | $cellAttributes |
Reimplemented in UploadSourceField.
Definition at line 1075 of file HTMLFormField.php.
References $mID, getLabel(), and needsLabel().
Referenced by getDiv(), getInline(), getRaw(), HTMLCheckMatrix\getTableRow(), and getTableRow().
|
protected |
Turns a *-message parameter (which could be a MessageSpecifier, or a message name, or a name + parameters array) into a Message.
mixed | $value |
Definition at line 1318 of file HTMLFormField.php.
References Message\newFromSpecifier().
Referenced by HTMLButtonField\__construct(), HTMLAutoCompleteSelectField\__construct(), HTMLFileField\__construct(), HTMLSelectAndOtherField\__construct(), HTMLTextAreaField\__construct(), HTMLTextField\__construct(), __construct(), HTMLEditTools\formatMsg(), getHelpText(), and getOptions().
HTMLFormField::getName | ( | ) |
Get the field name that will be used for submission.
Definition at line 120 of file HTMLFormField.php.
References $mName.
|
protected |
Get the closest field matching a given name.
It can handle array fields like the user would expect. The general algorithm is to look for $name as a sibling of $this, then a sibling of $this's parent, and so on.
string | $name | |
bool | $backCompat | Whether to try striping the 'wp' prefix. |
Definition at line 135 of file HTMLFormField.php.
Referenced by getNearestFieldValue(), and parseCondState().
|
protected |
Fetch a field value from $alldata for the closest field matching a given name.
array | $alldata | |
string | $name | |
bool | $asDisplay |
Definition at line 194 of file HTMLFormField.php.
References getNearestFieldValue().
|
protected |
Fetch a field value from $alldata for the closest field matching a given name.
array | $alldata | |
string | $name | |
bool | $asDisplay | Whether the reverting logic of HTMLCheckField should be ignored. |
bool | $backCompat | Whether to try striping the 'wp' prefix. |
Definition at line 164 of file HTMLFormField.php.
References getNearestField().
Referenced by checkStateRecurse(), and getNearestFieldByName().
HTMLFormField::getOOUI | ( | $value | ) |
Get the OOUI version of the div.
Falls back to getDiv by default.
string | $value | The value to set the input to. |
Reimplemented in HTMLTagFilter, and HTMLInfoField.
Definition at line 707 of file HTMLFormField.php.
References $mClass, getClassName(), getDiv(), getErrorsRaw(), getFieldLayoutOOUI(), getHelpText(), getInputOOUI(), getLabel(), getLabelAlignOOUI(), getOOUIModules(), isHelpInline(), parseCondStateForClient(), and shouldInfuseOOUI().
|
protected |
Get the list of extra ResourceLoader modules which must be loaded client-side before it's possible to infuse this field's OOUI widget.
Reimplemented in HTMLUserTextField, HTMLUsersMultiselectField, HTMLToggleSwitchField, HTMLTitleTextField, HTMLTitlesMultiselectField, HTMLTagMultiselectField, HTMLSizeFilterField, HTMLSelectOrOtherField, HTMLSelectNamespace, HTMLSelectAndOtherField, HTMLNamespacesMultiselectField, HTMLExpiryField, HTMLDateTimeField, and HTMLCheckMatrix.
Definition at line 831 of file HTMLFormField.php.
Referenced by getOOUI().
HTMLFormField::getOptions | ( | ) |
Fetch the array of options from the field's parameters.
In order, this checks 'options-messages', 'options', then 'options-message'.
Definition at line 1216 of file HTMLFormField.php.
References $mOptions, forceToStringRecursive(), getMessage(), and Xml\listDropDownOptions().
Referenced by HTMLAutoCompleteSelectField\__construct(), HTMLSelectAndOtherField\__construct(), HTMLSelectOrOtherField\__construct(), HTMLMultiSelectField\filterDataForSubmit(), HTMLAutoCompleteSelectField\getAttributes(), HTMLAutoCompleteSelectField\getInputHTML(), HTMLComboboxField\getInputHTML(), HTMLMultiSelectField\getInputHTML(), HTMLRadioField\getInputHTML(), HTMLSelectField\getInputHTML(), HTMLSelectOrOtherField\getInputHTML(), HTMLMultiSelectField\getInputOOUI(), HTMLRadioField\getInputOOUI(), HTMLSelectOrOtherField\getInputOOUI(), getOptionsOOUI(), HTMLAutoCompleteSelectField\validate(), HTMLMultiSelectField\validate(), HTMLRadioField\validate(), and HTMLSelectField\validate().
HTMLFormField::getOptionsOOUI | ( | ) |
Get options and make them into arrays suitable for OOUI.
Reimplemented in HTMLMultiSelectField.
Definition at line 1243 of file HTMLFormField.php.
References getOptions(), and Xml\listDropDownOptionsOoui().
Referenced by HTMLComboboxField\getInputOOUI(), HTMLSelectAndOtherField\getInputOOUI(), HTMLSelectField\getInputOOUI(), and HTMLSelectOrOtherField\getInputOOUI().
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 845 of file HTMLFormField.php.
References getErrorsAndErrorClass(), getHelpText(), getHelpTextHtmlRaw(), getInputHTML(), and getLabelHtml().
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 HTMLTagFilter, HTMLInfoField, HTMLHiddenField, HTMLEditTools, HTMLCheckMatrix, and HTMLApiField.
Definition at line 599 of file HTMLFormField.php.
References FormatJson\encode(), getClassName(), getErrorsAndErrorClass(), getHelpText(), getHelpTextHtmlTable(), getInputHTML(), getLabelHtml(), and parseCondStateForClient().
HTMLFormField::getTooltipAndAccessKey | ( | ) |
Returns the attributes required for the tooltip and accesskey, for Html::element() etc.
Definition at line 1126 of file HTMLFormField.php.
Referenced by HTMLCheckField\getInputHTML(), HTMLFileField\getInputHTML(), HTMLTextAreaField\getInputHTML(), and HTMLTextField\getInputHTML().
HTMLFormField::getTooltipAndAccessKeyOOUI | ( | ) |
Returns the attributes required for the tooltip and accesskey, for OOUI widgets' config.
Definition at line 1139 of file HTMLFormField.php.
Referenced by HTMLCheckField\getInputOOUI(), HTMLFileField\getInputOOUI(), HTMLTextAreaField\getInputOOUI(), HTMLTextField\getInputOOUI(), and HTMLToggleSwitchField\getInputOOUI().
HTMLFormField::getVForm | ( | $value | ) |
Get the complete field for the input, including help text, labels, and whatever.
Fall back from 'vform' to 'div' when not overridden.
string | $value | The value to set the input to. |
Definition at line 869 of file HTMLFormField.php.
References getDiv().
HTMLFormField::hasVisibleOutput | ( | ) |
If this field has a user-visible output or not.
If not, it will not be rendered
Reimplemented in HTMLHiddenField, and HTMLApiField.
Definition at line 110 of file HTMLFormField.php.
Referenced by canDisplayErrors().
HTMLFormField::isDisabled | ( | $alldata | ) |
Test whether this field is supposed to be disabled, based on the values of the other form fields.
array | $alldata | The data collected from the form |
Definition at line 364 of file HTMLFormField.php.
References checkStateRecurse(), and isHidden().
HTMLFormField::isHelpInline | ( | ) |
Determine if the help text should be displayed inline.
Only applies to OOUI forms.
Definition at line 1005 of file HTMLFormField.php.
Referenced by getOOUI(), and shouldInfuseOOUI().
HTMLFormField::isHidden | ( | $alldata | ) |
Test whether this field is supposed to be hidden, based on the values of the other form fields.
array | $alldata | The data collected from the form |
Definition at line 348 of file HTMLFormField.php.
References checkStateRecurse().
Referenced by isDisabled(), HTMLRestrictionsField\validate(), and validate().
|
protected |
Can we assume that the request is an attempt to submit a HTMLForm, as opposed to an attempt to just view it? This can't normally be distinguished for e.g.
checkboxes.
Returns true if the request was posted and has a field for a CSRF token (wpEditToken), or has a form identifier (wpFormIdentifier).
WebRequest | $request |
Definition at line 473 of file HTMLFormField.php.
References WebRequest\getCheck(), and WebRequest\wasPosted().
Referenced by HTMLCheckField\loadDataFromRequest(), HTMLCheckMatrix\loadDataFromRequest(), and HTMLMultiSelectField\loadDataFromRequest().
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 HTMLUsersMultiselectField, HTMLTitlesMultiselectField, HTMLTagMultiselectField, HTMLSubmitField, HTMLSizeFilterField, HTMLSelectOrOtherField, HTMLSelectAndOtherField, HTMLRestrictionsField, HTMLNamespacesMultiselectField, HTMLMultiSelectField, HTMLFormFieldCloner, HTMLExpiryField, HTMLDateTimeField, HTMLCheckMatrix, HTMLCheckField, and HTMLAutoCompleteSelectField.
Definition at line 488 of file HTMLFormField.php.
References getDefault().
HTMLFormField::msg | ( | $key, | |
$params | |||
) |
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().
string | string[] | MessageSpecifier | $key | |
mixed | ...$params |
Definition at line 96 of file HTMLFormField.php.
References wfMessage().
Referenced by HTMLAutoCompleteSelectField\__construct(), HTMLDateTimeField\__construct(), HTMLMultiSelectField\__construct(), HTMLSelectAndOtherField\__construct(), Licenses\__construct(), HTMLRestrictionsField\__construct(), HTMLEditTools\formatMsg(), HTMLSelectAndOtherField\getDefault(), HTMLRestrictionsField\getHelpText(), getHelpText(), HTMLSizeFilterField\getInputHTML(), HTMLFormFieldCloner\getInputHTMLForKey(), HTMLNamespacesMultiselectField\getInputOOUI(), HTMLTagMultiselectField\getInputOOUI(), HTMLTitlesMultiselectField\getInputOOUI(), HTMLUsersMultiselectField\getInputOOUI(), HTMLUserTextField\isValidIPRange(), HTMLSelectAndOtherField\loadDataFromRequest(), Licenses\makeLines(), Licenses\outputOption(), HTMLAutoCompleteSelectField\validate(), HTMLCheckMatrix\validate(), HTMLDateTimeField\validate(), HTMLFloatField\validate(), HTMLIntField\validate(), HTMLMultiSelectField\validate(), HTMLNamespacesMultiselectField\validate(), HTMLRadioField\validate(), HTMLRestrictionsField\validate(), HTMLSelectAndOtherField\validate(), HTMLSelectField\validate(), HTMLTagMultiselectField\validate(), HTMLTitlesMultiselectField\validate(), HTMLTitleTextField\validate(), HTMLUsersMultiselectField\validate(), HTMLUserTextField\validate(), validate(), and HTMLFormFieldCloner\validate().
HTMLFormField::needsJSForHtml5FormValidation | ( | ) |
Whether this field requires the user agent to have JavaScript enabled for the client-side HTML5 form validation to work correctly.
Definition at line 1346 of file HTMLFormField.php.
|
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 HTMLSizeFilterField, HTMLRadioField, HTMLMultiSelectField, HTMLInfoField, HTMLFormFieldCloner, HTMLCheckField, and HTMLButtonField.
Definition at line 445 of file HTMLFormField.php.
Referenced by getLabelHtml().
|
protected |
Parse the cond-state array to use the field name for submission, since the key in the form descriptor is never known in HTML.
Also check for field existence here.
array | $params |
Definition at line 302 of file HTMLFormField.php.
References getNearestField().
Referenced by parseCondStateForClient().
|
protected |
Parse the cond-state array for client-side.
Definition at line 332 of file HTMLFormField.php.
References $type, and parseCondState().
Referenced by getDiv(), getHelpTextHtmlDiv(), getHelpTextHtmlTable(), getOOUI(), and getTableRow().
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 458 of file HTMLFormField.php.
Referenced by HTMLButtonField\__construct().
|
protected |
Whether the field should be automatically infused.
Note that all OOUI HTMLForm fields are infusable (you can call OO.ui.infuse() on them), but not all are infused by default, since there is no benefit in doing it e.g. for buttons and it's a small performance hit on page load.
Reimplemented in HTMLUserTextField, HTMLUsersMultiselectField, HTMLToggleSwitchField, HTMLTitleTextField, HTMLTitlesMultiselectField, HTMLTagMultiselectField, HTMLTagFilter, HTMLSelectOrOtherField, HTMLSelectNamespace, HTMLSelectField, HTMLNamespacesMultiselectField, HTMLFileField, HTMLExpiryField, HTMLDateTimeField, HTMLComboboxField, and HTMLCheckMatrix.
Definition at line 819 of file HTMLFormField.php.
References getHelpText(), and isHelpInline().
Referenced by getOOUI().
HTMLFormField::skipLoadData | ( | $request | ) |
Skip this field when collecting data.
WebRequest | $request |
Reimplemented in HTMLSubmitField.
Definition at line 1335 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
mixed | $value | The value the field was submitted with |
array | $alldata | The data collected from the form |
Reimplemented in HTMLFormFieldCloner, EditWatchlistCheckboxSeriesField, HTMLUserTextField, HTMLUsersMultiselectField, HTMLTitleTextField, HTMLTitlesMultiselectField, HTMLTimezoneField, HTMLTagMultiselectField, HTMLSelectLimitField, HTMLSelectField, HTMLSelectAndOtherField, HTMLRestrictionsField, HTMLRadioField, HTMLNamespacesMultiselectField, HTMLMultiSelectField, HTMLIntField, HTMLFloatField, HTMLDateTimeField, HTMLCheckMatrix, HTMLButtonField, and HTMLAutoCompleteSelectField.
Definition at line 403 of file HTMLFormField.php.
References $mParent, isHidden(), and msg().
Referenced by getErrorsAndErrorClass(), getErrorsRaw(), and EditWatchlistCheckboxSeriesField\validate().
|
protected |
Validate the cond-state params, the existence check of fields should be done later.
array | $params |
MWException |
Definition at line 205 of file HTMLFormField.php.
References $type.
Referenced by __construct().
|
protected |
Definition at line 22 of file HTMLFormField.php.
Referenced by getDiv(), HTMLAutoCompleteSelectField\getInputHTML(), HTMLCheckField\getInputHTML(), HTMLFileField\getInputHTML(), HTMLSelectAndOtherField\getInputHTML(), HTMLSelectOrOtherField\getInputHTML(), HTMLTextAreaField\getInputHTML(), HTMLTextField\getInputHTML(), HTMLCheckField\getInputOOUI(), HTMLComboboxField\getInputOOUI(), HTMLFileField\getInputOOUI(), HTMLMultiSelectField\getInputOOUI(), HTMLSelectField\getInputOOUI(), HTMLTextAreaField\getInputOOUI(), HTMLTextField\getInputOOUI(), HTMLToggleSwitchField\getInputOOUI(), and getOOUI().
|
protected |
Array to hold params for 'hide-if' or 'disable-if' statements.
Definition at line 36 of file HTMLFormField.php.
|
protected |
Definition at line 37 of file HTMLFormField.php.
Referenced by getHelpTextHtmlTable().
|
protected |
Definition at line 25 of file HTMLFormField.php.
Referenced by HTMLCheckField\getDefault(), and HTMLHiddenField\getHiddenFieldData().
|
protected |
Definition at line 19 of file HTMLFormField.php.
Referenced by HTMLFileField\getInputHTML(), HTMLTextField\getInputHTML(), HTMLNamespacesMultiselectField\getInputOOUI(), and HTMLTitlesMultiselectField\getInputOOUI().
|
protected |
Definition at line 17 of file HTMLFormField.php.
Referenced by filter().
|
protected |
Definition at line 24 of file HTMLFormField.php.
Referenced by getHelpTextHtmlDiv(), and getHelpTextHtmlTable().
|
protected |
Definition at line 21 of file HTMLFormField.php.
Referenced by HTMLHiddenField\getHiddenFieldData(), HTMLButtonField\getInputHTML(), HTMLCheckField\getInputHTML(), HTMLFileField\getInputHTML(), HTMLSelectAndOtherField\getInputHTML(), HTMLSelectOrOtherField\getInputHTML(), HTMLTextAreaField\getInputHTML(), HTMLTextField\getInputHTML(), Licenses\getInputHTML(), HTMLCheckField\getInputOOUI(), HTMLDateTimeField\getInputOOUI(), HTMLNamespacesMultiselectField\getInputOOUI(), HTMLTitlesMultiselectField\getInputOOUI(), HTMLToggleSwitchField\getInputOOUI(), and getLabelHtml().
|
protected |
Definition at line 20 of file HTMLFormField.php.
|
protected |
Definition at line 18 of file HTMLFormField.php.
Referenced by HTMLHiddenField\getHiddenFieldData(), HTMLButtonField\getInputHTML(), HTMLFileField\getInputHTML(), HTMLTextField\getInputHTML(), Licenses\getInputHTML(), HTMLCheckField\getInputOOUI(), HTMLDateTimeField\getInputOOUI(), HTMLNamespacesMultiselectField\getInputOOUI(), HTMLSelectAndOtherField\getInputOOUI(), HTMLSelectOrOtherField\getInputOOUI(), HTMLTagMultiselectField\getInputOOUI(), HTMLTitlesMultiselectField\getInputOOUI(), HTMLToggleSwitchField\getInputOOUI(), HTMLUsersMultiselectField\getInputOOUI(), and getName().
|
protected |
Definition at line 31 of file HTMLFormField.php.
Referenced by HTMLSelectAndOtherField\__construct(), HTMLSelectOrOtherField\__construct(), and getOptions().
|
protected |
Definition at line 32 of file HTMLFormField.php.
array array [] HTMLFormField::$mParams |
Definition at line 14 of file HTMLFormField.php.
Referenced by HTMLExpiryField\getFieldByType().
HTMLForm null HTMLFormField::$mParent |
Definition at line 48 of file HTMLFormField.php.
Referenced by validate().
|
protected |
If true will generate an empty div element with no label.
Definition at line 43 of file HTMLFormField.php.
|
protected |
Definition at line 16 of file HTMLFormField.php.
|
protected |
Definition at line 23 of file HTMLFormField.php.
Referenced by getDiv().