MediaWiki  1.28.0
OOUIHTMLForm Class Reference

Compact stacked vertical format for forms, implemented using OOUI widgets. More...

Inheritance diagram for OOUIHTMLForm:
Collaboration diagram for OOUIHTMLForm:

Public Member Functions

 __construct ($descriptor, $context=null, $messagePrefix= '')
 
 getBody ()
 
 getButtons ()
 
 getErrorsOrWarnings ($elements, $elementsType)
 
 getHeaderText ($section=null)
 
 wrapForm ($html)
 
- Public Member Functions inherited from HTMLForm
 __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...
 
 getErrorsOrWarnings ($elements, $elementsType)
 Returns a formatted list of errors or warnings from the given elements. More...
 
 getField ($fieldname)
 
 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...
 
 hasField ($fieldname)
 
 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...
 
 setCancelTarget ($target)
 Sets the target where the user is redirected to after clicking cancel. More...
 
 setDisplayFormat ($format)
 Set format in which to display the form. More...
 
 setFooterText ($msg, $section=null)
 Set footer text, inside the form. More...
 
 setFormIdentifier ($ident)
 Set an internal identifier for this 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...
 
 showCancel ($show=true)
 Show a cancel button (or prevent it). 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 loadInputFromParameters ($fieldname, $descriptor, HTMLForm $parent=null)
 
- Static Public Member Functions inherited from HTMLForm
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...
 

Protected Member Functions

 formatSection (array $fieldsHtml, $sectionName, $anyFieldHasLabel)
 Put a form section together from the individual fields' HTML, merging it and wrapping. More...
 
 wrapFieldSetSection ($legend, $section, $attributes)
 
- Protected Member Functions inherited from HTMLForm
 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...
 

Protected Attributes

string $displayFormat = 'ooui'
 Symbolic display format name. More...
 
- Protected Attributes inherited from HTMLForm
array $availableDisplayFormats
 Available formats in which to display the form. More...
 
array $availableSubclassDisplayFormats
 Available formats in which to display the form. More...
 
string $displayFormat = 'table'
 Format in which to display form. More...
 
bool string $mAction = false
 Form action URL. More...
 
bool string $mAutocomplete = false
 Form attribute autocomplete. More...
 
 $mButtons = []
 
 $mCancelTarget
 
 $mFieldTree
 
HTMLFormField[] $mFlatFields
 
 $mFooter = ''
 
 $mFormIdentifier
 
 $mHeader = ''
 
 $mHiddenFields = []
 
 $mId
 
 $mMessagePrefix
 
 $mMethod = 'post'
 
 $mName
 
 $mPost = ''
 
 $mPre = ''
 
 $mSectionFooters = []
 
 $mSectionHeaders = []
 
 $mShowCancel = false
 
 $mShowReset = false
 
 $mShowSubmit = true
 
 $mSubmitCallback
 
 $mSubmitFlags = [ 'primary', 'progressive' ]
 
 $mSubmitID
 
 $mSubmitName
 
 $mSubmitText
 
 $mSubmitTooltip
 
 $mSubSectionBeforeFields = true
 If true, sections that contain both fields and subsections will render their subsections before their fields. More...
 
 $mTableId = ''
 
 $mTitle
 
string array $mTokenSalt = ''
 Salt for the edit token. More...
 
 $mUseMultipart = false
 
 $mValidationErrorMessage
 
 $mWasSubmitted = false
 
 $mWrapperLegend = false
 

Private Attributes

 $oouiErrors
 
 $oouiWarnings
 

Additional Inherited Members

- Public Attributes inherited from HTMLForm
static $mFieldData
 
- Static Public Attributes inherited from HTMLForm
static $typeMappings
 

Detailed Description

Compact stacked vertical format for forms, implemented using OOUI widgets.

Definition at line 27 of file OOUIHTMLForm.php.

Constructor & Destructor Documentation

OOUIHTMLForm::__construct (   $descriptor,
  $context = null,
  $messagePrefix = '' 
)

Definition at line 31 of file OOUIHTMLForm.php.

References ContextSource\$context, and ContextSource\getOutput().

Member Function Documentation

OOUIHTMLForm::formatSection ( array  $fieldsHtml,
  $sectionName,
  $anyFieldHasLabel 
)
protected

Put a form section together from the individual fields' HTML, merging it and wrapping.

Parameters
OOUI[] $fieldsHtml
string$sectionName
bool$anyFieldHasLabelUnused
Returns
string HTML

Definition at line 175 of file OOUIHTMLForm.php.

References HTMLForm\$mWrapperLegend, and Sanitizer\escapeId().

OOUIHTMLForm::getBody ( )

Definition at line 242 of file OOUIHTMLForm.php.

OOUIHTMLForm::getErrorsOrWarnings (   $elements,
  $elementsType 
)
Parameters
string | array | Status$elements
string$elementsType
Returns
string

Definition at line 193 of file OOUIHTMLForm.php.

References as, and HTMLForm\getMessage().

OOUIHTMLForm::getHeaderText (   $section = null)

Definition at line 233 of file OOUIHTMLForm.php.

References $section.

static OOUIHTMLForm::loadInputFromParameters (   $fieldname,
  $descriptor,
HTMLForm  $parent = null 
)
static

Definition at line 43 of file OOUIHTMLForm.php.

OOUIHTMLForm::wrapFieldSetSection (   $legend,
  $section,
  $attributes 
)
protected

Definition at line 145 of file OOUIHTMLForm.php.

References $section.

OOUIHTMLForm::wrapForm (   $html)

Definition at line 276 of file OOUIHTMLForm.php.

References $html, and HTMLForm\getFormAttributes().

Member Data Documentation

string OOUIHTMLForm::$displayFormat = 'ooui'
protected

Symbolic display format name.

Definition at line 41 of file OOUIHTMLForm.php.

OOUIHTMLForm::$oouiErrors
private

Definition at line 28 of file OOUIHTMLForm.php.

OOUIHTMLForm::$oouiWarnings
private

Definition at line 29 of file OOUIHTMLForm.php.


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