[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/htmlform/ -> HTMLFormField.php (summary)

The parent class to generate form fields.  Any field type should be a subclass of this.

File Size: 893 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 29 functions

  msg()
  getNearestFieldByName()
  isHiddenRecurse()
  isHidden()
  cancelSubmit()
  validate()
  filter()
  needsLabel()
  setShowEmptyLabel()
  loadDataFromRequest()
  __construct()
  getTableRow()
  getDiv()
  getRaw()
  getHelpTextHtmlTable()
  getHelpTextHtmlDiv()
  getHelpTextHtmlRaw()
  getHelpText()
  getErrorsAndErrorClass()
  getLabel()
  getLabelHtml()
  getDefault()
  getTooltipAndAccessKey()
  getAttributes()
  lookupOptionsKeys()
  forceToStringRecursive()
  getOptions()
  flattenOptions()
  formatErrors()

Functions
Functions that are not part of a class:

msg()   X-Ref
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().

return: Message

getNearestFieldByName( $alldata, $name )   X-Ref
Fetch a field value from $alldata for the closest field matching a given
name.

This is complex because it needs to 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. Keeping in mind
that $name itself might be referencing an array.

param: array $alldata
param: string $name
return: string

isHiddenRecurse( array $alldata, array $params )   X-Ref
Helper function for isHidden to handle recursive data structures.

param: array $alldata
param: array $params
return: bool

isHidden( $alldata )   X-Ref
Test whether this field is supposed to be hidden, based on the values of
the other form fields.

param: array $alldata The data collected from the form
return: bool

cancelSubmit( $value, $alldata )   X-Ref
Override this function if the control can somehow trigger a form
submission that shouldn't actually submit the HTMLForm.

param: string|array $value The value the field was submitted with
param: array $alldata The data collected from the form
return: bool True to cancel the submission

validate( $value, $alldata )   X-Ref
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

param: string|array $value The value the field was submitted with
param: array $alldata The data collected from the form
return: bool|string True on success, or String error to display, or

filter( $value, $alldata )   X-Ref
No description

needsLabel()   X-Ref
Should this field have a label, or is there no input element with the
appropriate id for the label to point to?

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

setShowEmptyLabel( $show )   X-Ref
Tell the field whether to generate a separate label element if its label
is blank.

param: bool $show Set to false to not generate a label.
return: void

loadDataFromRequest( $request )   X-Ref
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.

param: WebRequest $request
return: string The value

__construct( $params )   X-Ref
Initialise the object

param: array $params Associative Array. See HTMLForm doc for syntax.

getTableRow( $value )   X-Ref
Get the complete table row for the input, including help text,
labels, and whatever.

param: string $value The value to set the input to.
return: string Complete HTML table row.

getDiv( $value )   X-Ref
Get the complete div for the input, including help text,
labels, and whatever.

param: string $value The value to set the input to.
return: string Complete HTML table row.

getRaw( $value )   X-Ref
Get the complete raw fields for the input, including help text,
labels, and whatever.

param: string $value The value to set the input to.
return: string Complete HTML table row.

getHelpTextHtmlTable( $helptext )   X-Ref
Generate help text HTML in table format

param: string|null $helptext
return: string

getHelpTextHtmlDiv( $helptext )   X-Ref
Generate help text HTML in div format

param: string|null $helptext
return: string

getHelpTextHtmlRaw( $helptext )   X-Ref
Generate help text HTML formatted for raw output

param: string|null $helptext
return: string

getHelpText()   X-Ref
Determine the help text to display

return: string

getErrorsAndErrorClass( $value )   X-Ref
Determine form errors to display and their classes

param: string $value The value of the input
return: array

getLabel()   X-Ref
No description

getLabelHtml( $cellAttributes = array()   X-Ref
No description

getDefault()   X-Ref
No description

getTooltipAndAccessKey()   X-Ref
Returns the attributes required for the tooltip and accesskey.

return: array Attributes

getAttributes( array $list )   X-Ref
Returns the given attributes from the parameters

param: array $list List of attributes to get
return: array Attributes

lookupOptionsKeys( $options )   X-Ref
Given an array of msg-key => value mappings, returns an array with keys
being the message texts. It also forces values to strings.

param: array $options
return: array

forceToStringRecursive( $array )   X-Ref
Recursively forces values in an array to strings, because issues arise
with integer 0 as a value.

param: array $array
return: array

getOptions()   X-Ref
Fetch the array of options from the field's parameters. In order, this
checks 'options-messages', 'options', then 'options-message'.

return: array|null Options array

flattenOptions( $options )   X-Ref
flatten an array of options to a single array, for instance,
a set of "<options>" inside "<optgroups>".

param: array $options Associative Array with values either Strings or Arrays
return: array Flattened input

formatErrors( $errors )   X-Ref
Formats one or more errors as accepted by field validation-callback.

param: string|Message|array $errors Array of strings or Message instances
return: string HTML



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1