MediaWiki  REL1_19
HTMLFormField Class Reference

The parent class to generate form fields. More...

Inheritance diagram for HTMLFormField:

List of all members.

Public Member Functions

 __construct ($params)
 Initialise the object.
 filter ($value, $alldata)
 getDefault ()
 getInputHTML ($value)
 This function must be implemented to return the HTML to generate the input object itself.
 getLabel ()
 getLabelHtml ($cellAttributes=array())
 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.
 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>.

Public Attributes

 $mParams
 $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
 $mValidationCallback

Detailed Description

The parent class to generate form fields.

Any field type should be a subclass of this.

Definition at line 890 of file HTMLForm.php.


Constructor & Destructor Documentation

Initialise the object.

Parameters:
$paramsarray Associative Array. See HTMLForm doc for syntax.

Reimplemented in HTMLSubmitField, HTMLHiddenField, HTMLInfoField, HTMLSelectAndOtherField, HTMLSelectOrOtherField, and Licenses.

Definition at line 972 of file HTMLForm.php.

References Sanitizer\escapeId(), and wfMsgExt().

Here is the call graph for this function:


Member Function Documentation

HTMLFormField::filter ( value,
alldata 
)

Definition at line 936 of file HTMLForm.php.

static HTMLFormField::flattenOptions ( options) [static]

flatten an array of options to a single array, for instance, a set of <options> inside <optgroups>.

Parameters:
$optionsarray Associative Array with values either Strings or Arrays
Returns:
Array flattened input

Definition at line 1158 of file HTMLForm.php.

References $options.

Referenced by HTMLSelectAndOtherField\__construct(), Preferences\datetimePreferences(), PreferencesForm\filterDataForSubmit(), HTMLSelectOrOtherField\getInputHTML(), Preferences\getOptionFromUser(), HTMLSelectField\validate(), HTMLMultiSelectField\validate(), and HTMLRadioField\validate().

Here is the caller graph for this function:

static HTMLFormField::formatErrors ( errors) [static, protected]

Formats one or more errors as accepted by field validation-callback.

Parameters:
$errorsString|Message|Array of strings or Message instances
Returns:
String html
Since:
1.18

Definition at line 1178 of file HTMLForm.php.

References $lines, and Html\rawElement().

Referenced by getTableRow().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$valueString the value to set the input to; eg a default text for a text input.
Returns:
String valid HTML.

Reimplemented in HTMLApiField, HTMLEditTools, HTMLSubmitField, HTMLHiddenField, HTMLInfoField, HTMLRadioField, HTMLSelectAndOtherField, HTMLMultiSelectField, HTMLSelectOrOtherField, HTMLSelectField, HTMLCheckField, HTMLTextAreaField, HTMLTextField, and Licenses.

Referenced by getTableRow().

Here is the caller graph for this function:

Reimplemented in HTMLCheckField.

Definition at line 1114 of file HTMLForm.php.

Referenced by getLabelHtml().

Here is the caller graph for this function:

HTMLFormField::getLabelHtml ( cellAttributes = array())

Reimplemented in UploadSourceField.

Definition at line 1117 of file HTMLForm.php.

References getLabel(), needsLabel(), and Html\rawElement().

Referenced by getTableRow().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the complete table row for the input, including help text, labels, and whatever.

Parameters:
$valueString the value to set the input to.
Returns:
String complete HTML table row.

Reimplemented in HTMLApiField, HTMLEditTools, HTMLHiddenField, and HTMLInfoField.

Definition at line 1041 of file HTMLForm.php.

References formatErrors(), getInputHTML(), getLabelHtml(), Html\rawElement(), validate(), and wfMessage().

Here is the call graph for this function:

Returns the attributes required for the tooltip and accesskey.

Returns:
array Attributes

Definition at line 1144 of file HTMLForm.php.

References Linker\tooltipAndAccesskeyAttribs().

Referenced by HTMLTextField\getInputHTML(), HTMLTextAreaField\getInputHTML(), and HTMLCheckField\getInputHTML().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$requestWebRequest
Returns:
String the value

Reimplemented in HTMLSelectAndOtherField, HTMLMultiSelectField, HTMLSelectOrOtherField, and HTMLCheckField.

Definition at line 960 of file HTMLForm.php.

References getDefault().

Here is the call graph for this function:

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?

Returns:
bool True to output a label, false to suppress

Reimplemented in HTMLSubmitField, HTMLInfoField, HTMLRadioField, and HTMLMultiSelectField.

Definition at line 950 of file HTMLForm.php.

Referenced by getLabelHtml().

Here is the caller graph for this function:

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

Parameters:
$valueString the value the field was submitted with
$alldataArray the data collected from the form
Returns:
Mixed Bool true on success, or String error to display.

Reimplemented in HTMLSubmitField, HTMLRadioField, HTMLSelectAndOtherField, HTMLMultiSelectField, HTMLSelectField, HTMLIntField, HTMLFloatField, EditWatchlistCheckboxSeriesField, and HTMLBlockedUsersItemSelect.

Definition at line 924 of file HTMLForm.php.

References wfMsgExt().

Referenced by getTableRow().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

HTMLFormField::$mClass = '' [protected]

Definition at line 898 of file HTMLForm.php.

HTMLFormField::$mDefault [protected]

Definition at line 899 of file HTMLForm.php.

HTMLFormField::$mFilterCallback [protected]

Definition at line 893 of file HTMLForm.php.

HTMLFormField::$mID [protected]

Definition at line 897 of file HTMLForm.php.

HTMLFormField::$mLabel [protected]

Definition at line 896 of file HTMLForm.php.

HTMLFormField::$mName [protected]

Definition at line 894 of file HTMLForm.php.

HTMLFormField::$mParams

Definition at line 895 of file HTMLForm.php.

HTMLFormField::$mParent

Definition at line 904 of file HTMLForm.php.

HTMLFormField::$mValidationCallback [protected]

Definition at line 892 of file HTMLForm.php.


The documentation for this class was generated from the following file: