MediaWiki
1.27.1
|
Object handling generic submission, CSRF protection, layout and other logic for UI forms. More...
Public Member Functions | |
__construct ($descriptor, $context=null, $messagePrefix= '') | |
Build a new HTMLForm from an array of field attributes. More... | |
addButton ($data) | |
Add a button to the form. More... | |
addFooterText ($msg, $section=null) | |
Add footer text, inside the form. More... | |
addHeaderText ($msg, $section=null) | |
Add HTML to the header, inside the form. More... | |
addHiddenField ($name, $value, array $attribs=[]) | |
Add a hidden field to the output. More... | |
addHiddenFields (array $fields) | |
Add an array of hidden fields to the output. More... | |
addPostText ($msg) | |
Add text to the end of the display. More... | |
addPreText ($msg) | |
Add HTML to introductory message. More... | |
displayForm ($submitResult) | |
Display the form (sending to the context's OutputPage object), with an appropriate error message or stack of messages, and any validation errors, etc. More... | |
displaySection ($fields, $sectionName= '', $fieldsetIDPrefix= '', &$hasUserVisibleFields=false) | |
filterDataForSubmit ($data) | |
Overload this if you want to apply special filtration routines to the form as a whole, after it's submitted but before it's processed. More... | |
formatErrors ($errors) | |
Format a stack of error messages into a single HTML string. More... | |
getAction () | |
Get the value for the action attribute of the form. More... | |
getBody () | |
Get the whole body of the form. More... | |
getButtons () | |
Get the submit and (potentially) reset buttons. More... | |
getDisplayFormat () | |
Getter for displayFormat. More... | |
getErrors ($errors) | |
Format and display an error message stack. More... | |
getFooterText ($section=null) | |
Get footer text. More... | |
getHeaderText ($section=null) | |
Get header text. More... | |
getHiddenFields () | |
Get the hidden fields that should go inside the form. More... | |
getHTML ($submitResult) | |
Returns the raw HTML generated by the form. More... | |
getLegend ($key) | |
Get a string to go in the "<legend>" of a section fieldset. More... | |
getMethod () | |
getSubmitText () | |
Get the text for the submit button, either customised or a default. More... | |
getTitle () | |
Get the title. More... | |
isVForm () | |
Test if displayFormat is 'vform'. More... | |
loadData () | |
Construct the form fields from the Descriptor array. More... | |
prepareForm () | |
Prepare form for submission. More... | |
setAction ($action) | |
Set the value for the action attribute of the form. More... | |
setAutocomplete ($autocomplete) | |
Set the value for the autocomplete attribute of the form. More... | |
setDisplayFormat ($format) | |
Set format in which to display the form. More... | |
setFooterText ($msg, $section=null) | |
Set footer text, inside the form. More... | |
setHeaderText ($msg, $section=null) | |
Set header text, inside the form. More... | |
setId ($id) | |
setIntro ($msg) | |
Set the introductory message, overwriting any existing message. More... | |
setMessagePrefix ($p) | |
Set the prefix for various default messages. More... | |
setMethod ($method= 'post') | |
Set the method used to submit the form. More... | |
setName ($name) | |
setPostText ($msg) | |
Set text at the end of the display. More... | |
setPreText ($msg) | |
Set the introductory message HTML, overwriting any existing message. More... | |
setSubmitCallback ($cb) | |
Set a callback to a function to do something with the form once it's been successfully validated. More... | |
setSubmitDestructive () | |
Identify that the submit button in the form has a destructive action. More... | |
setSubmitID ($t) | |
Set the id for the submit button. More... | |
setSubmitName ($name) | |
setSubmitProgressive () | |
Identify that the submit button in the form has a progressive action. More... | |
setSubmitText ($t) | |
Set the text for the submit button. More... | |
setSubmitTextMsg ($msg) | |
Set the text for the submit button to a message. More... | |
setSubmitTooltip ($name) | |
setTableId ($id) | |
Set the id of the \<table\> or outermost \<div\> element. More... | |
setTitle ($t) | |
Set the title for form submission. More... | |
setTokenSalt ($salt) | |
Set the salt for the edit token. More... | |
setValidationErrorMessage ($msg) | |
Set a message to display on a validation error. More... | |
setWrapperLegend ($legend) | |
Prompt the whole form to be wrapped in a "<fieldset>", with this text as its "<legend>" element. More... | |
setWrapperLegendMsg ($msg) | |
Prompt the whole form to be wrapped in a "<fieldset>", with this message as its "<legend>" element. More... | |
show () | |
The here's-one-I-made-earlier option: do the submission if posted, or display the form with or without funky validation errors. More... | |
showAlways () | |
Same as self::show with the difference, that the form will be added to the output, no matter, if the validation was good or not. More... | |
suppressDefaultSubmit ($suppressSubmit=true) | |
Stop a default submit button being shown for this form. More... | |
suppressReset ($suppressReset=true) | |
Stop a reset button being shown for this form. More... | |
tryAuthorizedSubmit () | |
Try submitting, with edit token check first. More... | |
trySubmit () | |
Validate all the fields, and call the submission callback function if everything is kosher. More... | |
wasSubmitted () | |
Test whether the form was considered to have been submitted or not, i.e. More... | |
wrapForm ($html) | |
Wrap the form innards in an actual "<form>" element. More... | |
Public Member Functions inherited from ContextSource | |
canUseWikiPage () | |
Check whether a WikiPage object can be get with getWikiPage(). More... | |
exportSession () | |
Export the resolved user IP, HTTP headers, user ID, and session ID. More... | |
getConfig () | |
Get the Config object. More... | |
getContext () | |
Get the base IContextSource object. More... | |
getLanguage () | |
Get the Language object. More... | |
getOutput () | |
Get the OutputPage object. More... | |
getRequest () | |
Get the WebRequest object. More... | |
getSkin () | |
Get the Skin object. More... | |
getStats () | |
Get the Stats object. More... | |
getTiming () | |
Get the Timing object. More... | |
getTitle () | |
Get the Title object. More... | |
getUser () | |
Get the User object. More... | |
getWikiPage () | |
Get the WikiPage object. More... | |
msg () | |
Get a Message object with context set Parameters are the same as wfMessage() More... | |
setContext (IContextSource $context) | |
Set the IContextSource object. More... | |
Static Public Member Functions | |
static | factory ($displayFormat) |
Construct a HTMLForm object for given display type. More... | |
static | getClassFromDescriptor ($fieldname, &$descriptor) |
Get the HTMLFormField subclass for this descriptor. More... | |
static | loadInputFromParameters ($fieldname, $descriptor, HTMLForm $parent=null) |
Initialise a new Object for the field. More... | |
Public Attributes | |
static | $mFieldData |
Static Public Attributes | |
static | $typeMappings |
Protected Member Functions | |
formatSection (array $fieldsHtml, $sectionName, $anyFieldHasLabel) | |
Put a form section together from the individual fields' HTML, merging it and wrapping. More... | |
getFormAttributes () | |
Get HTML attributes for the <form> tag. 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... | |
wrapFieldSetSection ($legend, $section, $attributes) | |
Wraps the given $section into an user-visible fieldset. More... | |
Object handling generic submission, CSRF protection, layout and other logic for UI forms.
in a reusable manner.
In order to generate the form, the HTMLForm object takes an array structure detailing the form fields available. Each element of the array is a basic property-list, including the type of field, the label it is to be given in the form, callbacks for validation and 'filtering', and other pertinent information.
Field types are implemented as subclasses of the generic HTMLFormField object, and typically implement at least getInputHTML, which generates the HTML for the input field to be placed in the table.
You can find extensive documentation on the www.mediawiki.org wiki:
The constructor input is an associative array of $fieldname => $info, where $info is an Associative Array with any of the following:
'class' – the subclass of HTMLFormField that will be used to create the object. NOT the CSS class! 'type' – roughly translates into the <select> type attribute. if 'class' is not specified, this is used as a map through HTMLForm::$typeMappings to get the class name. 'default' – default value when the form is displayed 'id' – HTML id attribute 'cssclass' – CSS class 'csshelpclass' – CSS class used to style help text 'dir' – Direction of the element. 'options' – associative array mapping labels to values. Some field types support multi-level arrays. 'options-messages' – associative array mapping message keys to values. Some field types support multi-level arrays. 'options-message' – message key or object to be parsed to extract the list of options (like 'ipbreason-dropdown'). 'label-message' – message key or object for a message to use as the label. can be an array of msg key and then parameters to the message. 'label' – alternatively, a raw text message. Overridden by label-message 'help' – message text for a message to use as a help text. 'help-message' – message key or object for a message to use as a help text. can be an array of msg key and then parameters to the message. Overwrites 'help-messages' and 'help'. 'help-messages' – array of message keys/objects. As above, each item can be an array of msg key and then parameters. Overwrites 'help'. 'required' – passed through to the object, indicating that it is a required field. 'size' – the length of text fields 'filter-callback' – a function name to give you the chance to massage the inputted value before it's processed.
Since 1.20, you can chain mutators to ease the form generation:
Definition at line 123 of file HTMLForm.php.
HTMLForm::__construct | ( | $descriptor, | |
$context = null , |
|||
$messagePrefix = '' |
|||
) |
Build a new HTMLForm from an array of field attributes.
array | $descriptor | Array of Field constructs, as described above |
IContextSource | $context | Available since 1.18, will become compulsory in 1.18. Obviates the need to call $form->setTitle() |
string | $messagePrefix | A prefix to go in front of default messages |
Definition at line 291 of file HTMLForm.php.
References ContextSource\$context, $section, as, ContextSource\getConfig(), and ContextSource\setContext().
HTMLForm::addButton | ( | $data | ) |
Add a button to the form.
array | $data | Data to define the button:
|
Definition at line 899 of file HTMLForm.php.
References $args.
Referenced by SpecialBotPasswords\alterForm().
HTMLForm::addFooterText | ( | $msg, | |
$section = null |
|||
) |
Add footer text, inside the form.
string | $msg | Complete text of message to display |
string | null | $section | The section to add the footer text to |
Definition at line 769 of file HTMLForm.php.
References $section.
Referenced by UploadForm\__construct().
HTMLForm::addHeaderText | ( | $msg, | |
$section = null |
|||
) |
Add HTML to the header, inside the form.
string | $msg | Additional HTML to display in header |
string | null | $section | The section to add the header to |
Definition at line 714 of file HTMLForm.php.
References $section.
Referenced by SpecialBlock\alterForm(), SpecialChangeEmail\alterForm(), and UploadForm\getDescriptionSection().
HTMLForm::addHiddenField | ( | $name, | |
$value, | |||
array | $attribs = [] |
||
) |
Add a hidden field to the output.
string | $name | Field name. This will be used exactly as entered |
string | $value | Field value |
array | $attribs |
Definition at line 851 of file HTMLForm.php.
References $attribs, $name, and $value.
Referenced by RevertAction\alterForm().
HTMLForm::addHiddenFields | ( | array | $fields | ) |
Add an array of hidden fields to the output.
array | $fields | Associative array of fields to add; mapping names to their values |
Definition at line 868 of file HTMLForm.php.
References $name, $value, and as.
Referenced by SpecialChangeEmail\alterForm(), and SpecialPasswordReset\alterForm().
HTMLForm::addPostText | ( | $msg | ) |
Add text to the end of the display.
string | $msg | Complete text of message to display |
Definition at line 823 of file HTMLForm.php.
HTMLForm::addPreText | ( | $msg | ) |
Add HTML to introductory message.
string | $msg | Complete HTML of message to display |
Definition at line 700 of file HTMLForm.php.
Referenced by SpecialBotPasswords\alterForm().
HTMLForm::displayForm | ( | $submitResult | ) |
Display the form (sending to the context's OutputPage object), with an appropriate error message or stack of messages, and any validation errors, etc.
bool | string | array | Status | $submitResult | Output from HTMLForm::trySubmit() |
Definition at line 957 of file HTMLForm.php.
References getHTML(), and ContextSource\getOutput().
Referenced by show(), and showAlways().
HTMLForm::displaySection | ( | $fields, | |
$sectionName = '' , |
|||
$fieldsetIDPrefix = '' , |
|||
& | $hasUserVisibleFields = false |
||
) |
array[]|HTMLFormField[] | $fields Array of fields (either arrays or objects). | |
string | $sectionName | ID attribute of the "<table>" tag for this section, ignored if empty. |
string | $fieldsetIDPrefix | ID prefix for the "<fieldset>" tag of each subsection, ignored if empty. |
bool | &$hasUserVisibleFields | Whether the section had user-visible fields. |
LogicException | When called on uninitialized field data, e.g. When HTMLForm::displayForm was called without calling HTMLForm::prepareForm first. |
Definition at line 1476 of file HTMLForm.php.
References $displayFormat, $html, $key, $retval, $section, $value, as, Sanitizer\escapeId(), formatSection(), getDisplayFormat(), getFooterText(), getHeaderText(), getLegend(), and wrapFieldSetSection().
Referenced by EditWatchlistNormalHTMLForm\getBody(), getBody(), and PreferencesForm\getBody().
|
static |
Construct a HTMLForm object for given display type.
May return a HTMLForm subclass.
string | $displayFormat | |
mixed | $arguments,... | Additional arguments to pass to the constructor. |
Definition at line 264 of file HTMLForm.php.
Referenced by SpecialExport\execute(), SpecialBlockList\execute(), SpecialPagesWithProp\execute(), SpecialComparePages\execute(), LinkSearchPage\execute(), FileDuplicateSearchPage\execute(), AuthManagerSpecialPage\getAuthForm(), LoginSignupSpecialPage\getAuthForm(), FormSpecialPage\getForm(), WithoutInterwikiPage\getPageHeader(), SpecialExpandTemplates\makeForm(), SpecialAllPages\outputHTMLForm(), EmailConfirmation\showRequestForm(), and SpecialUploadStash\showUploads().
HTMLForm::filterDataForSubmit | ( | $data | ) |
Overload this if you want to apply special filtration routines to the form as a whole, after it's submitted but before it's processed.
array | $data |
Definition at line 1648 of file HTMLForm.php.
Referenced by trySubmit().
HTMLForm::formatErrors | ( | $errors | ) |
Format a stack of error messages into a single HTML string.
array | $errors | Array of message keys/values |
Definition at line 1197 of file HTMLForm.php.
References as, getMessage(), and Html\rawElement().
Referenced by SpecialBlock\alterForm(), and getErrors().
|
protected |
Put a form section together from the individual fields' HTML, merging it and wrapping.
array | $fieldsHtml | |
string | $sectionName | |
bool | $anyFieldHasLabel |
Definition at line 1567 of file HTMLForm.php.
References $attribs, $html, Sanitizer\escapeId(), getDisplayFormat(), and Html\rawElement().
Referenced by displaySection().
HTMLForm::getAction | ( | ) |
Get the value for the action attribute of the form.
Definition at line 1687 of file HTMLForm.php.
References $mAction, ContextSource\getConfig(), getMethod(), getTitle(), and wfScript().
Referenced by getFormAttributes().
HTMLForm::getBody | ( | ) |
Get the whole body of the form.
Definition at line 1161 of file HTMLForm.php.
References displaySection().
Referenced by getHTML().
HTMLForm::getButtons | ( | ) |
Get the submit and (potentially) reset buttons.
Definition at line 1067 of file HTMLForm.php.
References $attribs, $mSubmitID, $mSubmitName, array(), as, Html\element(), ContextSource\getConfig(), getMessage(), ContextSource\getRequest(), getSubmitText(), ContextSource\msg(), Html\rawElement(), Xml\submitButton(), text, and Linker\tooltipAndAccesskeyAttribs().
Referenced by getHTML().
|
static |
Get the HTMLFormField subclass for this descriptor.
The descriptor can be passed either 'class' which is the name of a HTMLFormField subclass, or a shorter 'type' which is an alias. This makes sure the 'class' is always set, and also is returned by this function for ease.
string | $fieldname | Name of the field |
array | $descriptor | Input Descriptor, as described above |
MWException |
Definition at line 421 of file HTMLForm.php.
HTMLForm::getDisplayFormat | ( | ) |
Getter for displayFormat.
Definition at line 390 of file HTMLForm.php.
References $displayFormat.
Referenced by displaySection(), formatSection(), and HTMLCheckField\getLabel().
HTMLForm::getErrors | ( | $errors | ) |
Format and display an error message stack.
string | array | Status | $errors |
Definition at line 1172 of file HTMLForm.php.
References formatErrors(), ContextSource\getOutput(), and Html\rawElement().
Referenced by getHTML().
HTMLForm::getFooterText | ( | $section = null | ) |
Get footer text.
string | null | $section | The section to get the footer text for |
Definition at line 808 of file HTMLForm.php.
References $mFooter, and $section.
Referenced by displaySection(), and getHTML().
|
protected |
Get HTML attributes for the <form>
tag.
Definition at line 991 of file HTMLForm.php.
References $attribs, $mAutocomplete, $mId, $mName, getAction(), and getMethod().
Referenced by OOUIHTMLForm\wrapForm(), and wrapForm().
HTMLForm::getHeaderText | ( | $section = null | ) |
Get header text.
string | null | $section | The section to get the header text for |
Definition at line 753 of file HTMLForm.php.
References $mHeader, and $section.
Referenced by displaySection(), and getHTML().
HTMLForm::getHiddenFields | ( | ) |
Get the hidden fields that should go inside the form.
Definition at line 1039 of file HTMLForm.php.
References $attribs, $html, $value, as, ContextSource\getConfig(), getMethod(), getTitle(), ContextSource\getUser(), Html\hidden(), and list.
Referenced by getHTML().
HTMLForm::getHTML | ( | $submitResult | ) |
Returns the raw HTML generated by the form.
bool | string | array | Status | $submitResult | Output from HTMLForm::trySubmit() |
Definition at line 968 of file HTMLForm.php.
References $html, $mPost, getBody(), getButtons(), getErrors(), getFooterText(), getHeaderText(), getHiddenFields(), ContextSource\getOutput(), and wrapForm().
Referenced by displayForm().
HTMLForm::getLegend | ( | $key | ) |
Get a string to go in the "<legend>" of a section fieldset.
Override this if you want something more complicated.
string | $key |
Definition at line 1660 of file HTMLForm.php.
References ContextSource\msg().
Referenced by displaySection().
|
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 1728 of file HTMLForm.php.
References $value, and Message\newFromSpecifier().
Referenced by formatErrors(), OOUIHTMLForm\getButtons(), getButtons(), and OOUIHTMLForm\getErrors().
HTMLForm::getMethod | ( | ) |
Definition at line 1444 of file HTMLForm.php.
References $mMethod.
Referenced by getAction(), getFormAttributes(), getHiddenFields(), and tryAuthorizedSubmit().
HTMLForm::getSubmitText | ( | ) |
Get the text for the submit button, either customised or a default.
Definition at line 1263 of file HTMLForm.php.
References ContextSource\msg().
Referenced by OOUIHTMLForm\getButtons(), VFormHTMLForm\getButtons(), and getButtons().
HTMLForm::getTitle | ( | ) |
Get the title.
Implements IContextSource.
Definition at line 1422 of file HTMLForm.php.
References $mTitle, and ContextSource\getContext().
Referenced by UploadForm\__construct(), getAction(), and getHiddenFields().
HTMLForm::isVForm | ( | ) |
Test if displayFormat is 'vform'.
Definition at line 400 of file HTMLForm.php.
References wfDeprecated().
HTMLForm::loadData | ( | ) |
Construct the form fields from the Descriptor array.
Definition at line 1603 of file HTMLForm.php.
References $name, $request, $value, as, and ContextSource\getRequest().
Referenced by prepareForm().
|
static |
Initialise a new Object for the field.
string | $fieldname | Name of the field |
array | $descriptor | Input Descriptor, as described above |
HTMLForm | null | $parent | Parent instance of HTMLForm |
MWException |
Definition at line 449 of file HTMLForm.php.
Referenced by HTMLFormFieldCloner\createFieldsForKey(), ApiOptions\execute(), HTMLFormFieldCloner\getInputHTML(), HTMLFormFieldCloner\getInputHTMLForKey(), and Preferences\loadPreferenceValues().
HTMLForm::prepareForm | ( | ) |
Prepare form for submission.
MWException |
Definition at line 474 of file HTMLForm.php.
References loadData().
Referenced by show(), and showAlways().
HTMLForm::setAction | ( | $action | ) |
Set the value for the action attribute of the form.
When set to false (which is the default state), the set title is used.
string | bool | $action |
Definition at line 1674 of file HTMLForm.php.
HTMLForm::setAutocomplete | ( | $autocomplete | ) |
Set the value for the autocomplete attribute of the form.
When set to false (which is the default state), the attribute get not set.
string | bool | $autocomplete |
Definition at line 1716 of file HTMLForm.php.
HTMLForm::setDisplayFormat | ( | $format | ) |
Set format in which to display the form.
string | $format | The name of the format to use, must be one of $this->availableDisplayFormats |
MWException |
Definition at line 361 of file HTMLForm.php.
References ContextSource\getConfig().
HTMLForm::setFooterText | ( | $msg, | |
$section = null |
|||
) |
Set footer text, inside the form.
string | $msg | Complete text of message to display |
string | null | $section | The section to add the footer text to |
Definition at line 791 of file HTMLForm.php.
References $section.
HTMLForm::setHeaderText | ( | $msg, | |
$section = null |
|||
) |
Set header text, inside the form.
string | $msg | Complete HTML of header to display |
string | null | $section | The section to add the header to |
Definition at line 736 of file HTMLForm.php.
References $section.
Referenced by SpecialUnlockdb\alterForm(), SpecialLockdb\alterForm(), SpecialBlock\alterForm(), and SpecialPasswordReset\alterForm().
HTMLForm::setId | ( | $id | ) |
string | $id | DOM id for the form |
Definition at line 1339 of file HTMLForm.php.
Referenced by UploadForm\__construct(), SpecialChangeEmail\alterForm(), and SpecialBotPasswords\alterForm().
HTMLForm::setIntro | ( | $msg | ) |
Set the introductory message, overwriting any existing message.
string | $msg | Complete text of message to display |
Definition at line 673 of file HTMLForm.php.
References setPreText().
HTMLForm::setMessagePrefix | ( | $p | ) |
Set the prefix for various default messages.
string | $p |
Definition at line 1399 of file HTMLForm.php.
HTMLForm::setMethod | ( | $method = 'post' | ) |
Set the method used to submit the form.
string | $method |
Definition at line 1435 of file HTMLForm.php.
Referenced by SpecialChangeContentModel\alterForm(), and SpecialRedirect\alterForm().
HTMLForm::setName | ( | $name | ) |
string | $name | 'name' attribute for the form |
Definition at line 1349 of file HTMLForm.php.
References $name.
HTMLForm::setPostText | ( | $msg | ) |
Set text at the end of the display.
string | $msg | Complete text of message to display |
Definition at line 836 of file HTMLForm.php.
HTMLForm::setPreText | ( | $msg | ) |
Set the introductory message HTML, overwriting any existing message.
string | $msg | Complete HTML of message to display |
Definition at line 687 of file HTMLForm.php.
Referenced by setIntro().
HTMLForm::setSubmitCallback | ( | $cb | ) |
Set a callback to a function to do something with the form once it's been successfully validated.
callable | $cb | The function will be passed the output from HTMLForm::filterDataForSubmit and this HTMLForm object, and must return as documented for HTMLForm::trySubmit |
Definition at line 646 of file HTMLForm.php.
HTMLForm::setSubmitDestructive | ( | ) |
Identify that the submit button in the form has a destructive action.
Definition at line 1230 of file HTMLForm.php.
Referenced by SpecialBlock\alterForm().
HTMLForm::setSubmitID | ( | $t | ) |
Set the id for the submit button.
string | $t |
Definition at line 1297 of file HTMLForm.php.
References $t.
HTMLForm::setSubmitName | ( | $name | ) |
string | $name | Submit button name |
Definition at line 1272 of file HTMLForm.php.
References $name.
Referenced by UploadForm\__construct().
HTMLForm::setSubmitProgressive | ( | ) |
Identify that the submit button in the form has a progressive action.
Definition at line 1238 of file HTMLForm.php.
HTMLForm::setSubmitText | ( | $t | ) |
Set the text for the submit button.
string | $t | Plaintext |
Definition at line 1220 of file HTMLForm.php.
References $t.
Referenced by UploadForm\__construct(), and setSubmitTextMsg().
HTMLForm::setSubmitTextMsg | ( | $msg | ) |
Set the text for the submit button to a message.
Definition at line 1250 of file HTMLForm.php.
References ContextSource\msg(), and setSubmitText().
Referenced by SpecialChangeContentModel\alterForm(), UnwatchAction\alterForm(), WatchAction\alterForm(), SpecialUnlockdb\alterForm(), SpecialLockdb\alterForm(), RevertAction\alterForm(), PurgeAction\alterForm(), SpecialRandomInCategory\alterForm(), SpecialBlock\alterForm(), SpecialPageLanguage\alterForm(), SpecialChangeEmail\alterForm(), SpecialPasswordReset\alterForm(), SpecialResetTokens\alterForm(), and SpecialRedirect\alterForm().
HTMLForm::setSubmitTooltip | ( | $name | ) |
string | $name | Tooltip for the submit button |
Definition at line 1283 of file HTMLForm.php.
References $name.
Referenced by UploadForm\__construct().
HTMLForm::setTableId | ( | $id | ) |
Set the id of the \<table\> or outermost \<div\> element.
string | $id | New value of the id attribute, or "" to remove |
Definition at line 1328 of file HTMLForm.php.
Referenced by SpecialChangeEmail\alterForm(), and SpecialBotPasswords\alterForm().
HTMLForm::setTitle | ( | $t | ) |
HTMLForm::setTokenSalt | ( | $salt | ) |
Set the salt for the edit token.
Only useful when the method is "post".
string | array | $salt | Salt to use |
Definition at line 939 of file HTMLForm.php.
Referenced by WatchAction\alterForm(), and RevertAction\alterForm().
HTMLForm::setValidationErrorMessage | ( | $msg | ) |
Set a message to display on a validation error.
string | array | $msg | String or Array of valid inputs to wfMessage() (so each entry can be either a String or Array) |
Definition at line 660 of file HTMLForm.php.
HTMLForm::setWrapperLegend | ( | $legend | ) |
Prompt the whole form to be wrapped in a "<fieldset>", with this text as its "<legend>" element.
string | bool | $legend | If false, no wrapper or legend will be displayed. If true, a wrapper will be displayed, but no legend. If a string, a wrapper will be displayed with that string as a legend. The string will be escaped before being output (this doesn't support HTML). |
Definition at line 1366 of file HTMLForm.php.
Referenced by SpecialUnlockdb\alterForm(), SpecialLockdb\alterForm(), and setWrapperLegendMsg().
HTMLForm::setWrapperLegendMsg | ( | $msg | ) |
Prompt the whole form to be wrapped in a "<fieldset>", with this message as its "<legend>" element.
Definition at line 1381 of file HTMLForm.php.
References ContextSource\msg(), and setWrapperLegend().
Referenced by RevertAction\alterForm(), SpecialBlock\alterForm(), and SpecialBotPasswords\alterForm().
HTMLForm::show | ( | ) |
The here's-one-I-made-earlier option: do the submission if posted, or display the form with or without funky validation errors.
Definition at line 522 of file HTMLForm.php.
References displayForm(), prepareForm(), and tryAuthorizedSubmit().
HTMLForm::showAlways | ( | ) |
Same as self::show with the difference, that the form will be added to the output, no matter, if the validation was good or not.
Definition at line 540 of file HTMLForm.php.
References displayForm(), prepareForm(), and tryAuthorizedSubmit().
HTMLForm::suppressDefaultSubmit | ( | $suppressSubmit = true | ) |
Stop a default submit button being shown for this form.
This implies that an alternate submit method must be provided manually.
bool | $suppressSubmit | Set to false to re-enable the button again |
Definition at line 1313 of file HTMLForm.php.
Referenced by SpecialResetTokens\alterForm(), and SpecialBotPasswords\alterForm().
HTMLForm::suppressReset | ( | $suppressReset = true | ) |
Stop a reset button being shown for this form.
bool | $suppressReset | Set to false to re-enable the button again |
Definition at line 1633 of file HTMLForm.php.
HTMLForm::tryAuthorizedSubmit | ( | ) |
Try submitting, with edit token check first.
Definition at line 490 of file HTMLForm.php.
References getMethod(), ContextSource\getRequest(), ContextSource\getUser(), and trySubmit().
Referenced by show(), and showAlways().
HTMLForm::trySubmit | ( | ) |
Validate all the fields, and call the submission callback function if everything is kosher.
MWException |
Definition at line 561 of file HTMLForm.php.
References $mSubmitCallback, $res, as, and filterDataForSubmit().
Referenced by tryAuthorizedSubmit().
HTMLForm::wasSubmitted | ( | ) |
Test whether the form was considered to have been submitted or not, i.e.
whether the last call to tryAuthorizedSubmit or trySubmit returned non-false.
This will return false until HTMLForm::tryAuthorizedSubmit or HTMLForm::trySubmit is called.
Definition at line 632 of file HTMLForm.php.
References $mWasSubmitted.
|
protected |
Wraps the given $section into an user-visible fieldset.
string | $legend | Legend text for the fieldset |
string | $section | The section content in plain Html |
array | $attributes | Additional attributes for the fieldset |
Definition at line 1456 of file HTMLForm.php.
References $section, and Xml\fieldset().
Referenced by displaySection().
HTMLForm::wrapForm | ( | $html | ) |
Wrap the form innards in an actual "<form>" element.
string | $html | HTML contents to wrap. |
Definition at line 1021 of file HTMLForm.php.
References $html, Xml\fieldset(), getFormAttributes(), and Html\rawElement().
Referenced by getHTML().
|
protected |
Available formats in which to display the form.
Definition at line 241 of file HTMLForm.php.
|
protected |
Available formats in which to display the form.
Definition at line 252 of file HTMLForm.php.
Format in which to display form.
For viable options,
Definition at line 235 of file HTMLForm.php.
Referenced by displaySection(), and getDisplayFormat().
Form action URL.
false means we will use the URL to set Title
Definition at line 200 of file HTMLForm.php.
Referenced by getAction().
Form attribute autocomplete.
false does not set the attribute
Definition at line 207 of file HTMLForm.php.
Referenced by getFormAttributes().
|
protected |
Definition at line 211 of file HTMLForm.php.
HTMLForm::$mFieldData |
Definition at line 127 of file HTMLForm.php.
|
protected |
Definition at line 168 of file HTMLForm.php.
|
protected |
Definition at line 166 of file HTMLForm.php.
|
protected |
Definition at line 178 of file HTMLForm.php.
Referenced by getFooterText().
|
protected |
Definition at line 177 of file HTMLForm.php.
Referenced by getHeaderText().
|
protected |
Definition at line 210 of file HTMLForm.php.
|
protected |
Definition at line 182 of file HTMLForm.php.
Referenced by getFormAttributes().
|
protected |
Definition at line 163 of file HTMLForm.php.
|
protected |
Definition at line 192 of file HTMLForm.php.
Referenced by getMethod().
|
protected |
Definition at line 183 of file HTMLForm.php.
Referenced by getFormAttributes().
|
protected |
Definition at line 181 of file HTMLForm.php.
Referenced by getHTML().
|
protected |
Definition at line 176 of file HTMLForm.php.
|
protected |
Definition at line 180 of file HTMLForm.php.
|
protected |
Definition at line 179 of file HTMLForm.php.
|
protected |
Definition at line 169 of file HTMLForm.php.
|
protected |
Definition at line 170 of file HTMLForm.php.
|
protected |
Definition at line 173 of file HTMLForm.php.
Referenced by trySubmit().
|
protected |
Definition at line 171 of file HTMLForm.php.
Referenced by OOUIHTMLForm\getButtons().
|
protected |
Definition at line 186 of file HTMLForm.php.
Referenced by OOUIHTMLForm\getButtons(), VFormHTMLForm\getButtons(), and getButtons().
|
protected |
Definition at line 187 of file HTMLForm.php.
Referenced by OOUIHTMLForm\getButtons(), VFormHTMLForm\getButtons(), and getButtons().
|
protected |
Definition at line 188 of file HTMLForm.php.
|
protected |
Definition at line 189 of file HTMLForm.php.
|
protected |
If true, sections that contain both fields and subsections will render their subsections before their fields.
Subclasses may set this to false to render subsections after fields instead.
Definition at line 228 of file HTMLForm.php.
|
protected |
Definition at line 184 of file HTMLForm.php.
|
protected |
Definition at line 191 of file HTMLForm.php.
Referenced by getTitle().
Salt for the edit token.
Definition at line 219 of file HTMLForm.php.
|
protected |
Definition at line 209 of file HTMLForm.php.
|
protected |
Definition at line 174 of file HTMLForm.php.
|
protected |
Definition at line 193 of file HTMLForm.php.
Referenced by wasSubmitted().
|
protected |
Definition at line 213 of file HTMLForm.php.
Referenced by OOUIHTMLForm\formatSection().
|
static |
Definition at line 125 of file HTMLForm.php.
Referenced by AuthManagerSpecialPage\addTabIndex(), and AuthManagerSpecialPage\needsSubmitButton().