MediaWiki  1.23.0
HTMLSelectAndOtherField Class Reference

Double field with a dropdown list constructed from a system message in the format. More...

Inheritance diagram for HTMLSelectAndOtherField:
Collaboration diagram for HTMLSelectAndOtherField:

Public Member Functions

 __construct ( $params)
 Initialise the object. More...
 
 getInputHTML ( $value)
 This function must be implemented to return the HTML to generate the input object itself. More...
 
 getSize ()
 
 loadDataFromRequest ( $request)
 
 validate ( $value, $alldata)
 Override this function to add specific validation checks on the field input. More...
 
- Public Member Functions inherited from HTMLFormField
 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...
 
 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...
 
 getLabel ()
 
 getLabelHtml ( $cellAttributes=array())
 
 getOptions ()
 Fetch the array of options from the field's parameters. 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. More...
 
 msg ()
 Get a translated interface message. More...
 
 setShowEmptyLabel ( $show)
 Tell the field whether to generate a separate label element if its label is blank. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from HTMLFormField
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 inherited from HTMLFormField
 $mParams
 
HTMLForm $mParent
 
- Protected Member Functions inherited from HTMLFormField
 needsLabel ()
 Should this field have a label, or is there no input element with the appropriate id for the label to point to? More...
 
- Static Protected Member Functions inherited from HTMLFormField
static formatErrors ( $errors)
 Formats one or more errors as accepted by field validation-callback. More...
 
- Protected Attributes inherited from HTMLFormField
 $mClass = ''
 
 $mDefault
 
 $mFilterCallback
 
 $mID
 
 $mLabel
 
 $mName
 
 $mOptions = false
 
 $mOptionsLabelsNotFromMessage = false
 
bool $mShowEmptyLabels = true
 If true will generate an empty div element with no label. More...
 
 $mValidationCallback
 

Detailed Description

Double field with a dropdown list constructed from a system message in the format.

  • Optgroup header ** <option value>="">
  • New Optgroup header Plus a text field underneath for an additional reason. The 'value' of the field is "<select>: <extra reason>", or "<extra reason>" if nothing has been selected in the select dropdown.
    Todo:
    FIXME: If made 'required', only the text field should be compulsory.

Definition at line 13 of file HTMLSelectAndOtherField.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLSelectAndOtherField::__construct (   $params)

Initialise the object.

Parameters
array$paramsAssociative Array. See HTMLForm doc for syntax.
Since
1.22 The 'label' attribute no longer accepts raw HTML, use 'label-raw' instead
Exceptions
MWException

Reimplemented from HTMLFormField.

Definition at line 14 of file HTMLSelectAndOtherField.php.

References $params, HTMLFormField\flattenOptions(), HTMLFormField\getOptions(), and wfMessage().

Member Function Documentation

◆ getInputHTML()

HTMLSelectAndOtherField::getInputHTML (   $value)

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
string$valuethe value to set the input to; eg a default text for a text input.
Returns
string Valid HTML.

Reimplemented from HTMLSelectField.

Definition at line 35 of file HTMLSelectAndOtherField.php.

References HTMLFormField\$mClass, $value, array(), HTMLFormField\getAttributes(), getSize(), and Html\input().

◆ getSize()

HTMLSelectAndOtherField::getSize ( )

Definition at line 102 of file HTMLSelectAndOtherField.php.

Referenced by getInputHTML().

◆ loadDataFromRequest()

HTMLSelectAndOtherField::loadDataFromRequest (   $request)
Parameters
$requestWebRequest
Returns
Array("<overall message>","<select value>","<text field value>")

Reimplemented from HTMLFormField.

Definition at line 67 of file HTMLSelectAndOtherField.php.

References array(), as, HTMLFormField\getDefault(), and HTMLFormField\msg().

◆ validate()

HTMLSelectAndOtherField::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
string$valueThe value the field was submitted with
array$alldataThe data collected from the form
Returns
Mixed Bool true on success, or String error to display.

Reimplemented from HTMLSelectField.

Definition at line 106 of file HTMLSelectAndOtherField.php.

References $value, and HTMLFormField\msg().


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