MediaWiki REL1_37
PreferencesFormOOUI Class Reference

Form to edit user preferences. More...

Inheritance diagram for PreferencesFormOOUI:
Collaboration diagram for PreferencesFormOOUI:

Public Member Functions

 areOptionsEditable ()
 
 filterDataForSubmit ( $data)
 Separate multi-option preferences into multiple preferences, since we have to store them separately.
 
 getBody ()
 Get the whole body of the form.
 
 getButtons ()
 
 getExtraSuccessRedirectParameters ()
 Get extra parameters for the query string when redirecting after successful save.
 
 getLegend ( $key)
 Get the "<legend>" for a given section key.
 
 getModifiedUser ()
 
 getPreferenceSections ()
 Get the keys of each top level preference section.
 
 isPrivateInfoEditable ()
 
 setModifiedUser ( $user)
 
 setOptionsEditable ( $optionsEditable)
 
 setPrivateInfoEditable ( $editable)
 Whether the.
 
 wrapForm ( $html)
 
- Public Member Functions inherited from OOUIHTMLForm
 __construct ( $descriptor, $context=null, $messagePrefix='')
 
 getErrorsOrWarnings ( $elements, $elementsType)
 
 getHeaderText ( $section=null)
 Get header text.
 
- Public Member Functions inherited from HTMLForm
 addButton ( $data)
 Add a button to the form.
 
 addFields ( $descriptor)
 Add fields to the form.
 
 addFooterText ( $msg, $section=null)
 Add footer text, inside the form.
 
 addHeaderText ( $msg, $section=null)
 Add HTML to the header, inside the form.
 
 addHiddenField ( $name, $value, array $attribs=[])
 Add a hidden field to the output.
 
 addHiddenFields (array $fields)
 Add an array of hidden fields to the output.
 
 addPostText ( $msg)
 Add text to the end of the display.
 
 addPreText ( $msg)
 Add HTML to introductory message.
 
 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.
 
 displaySection ( $fields, $sectionName='', $fieldsetIDPrefix='', &$hasUserVisibleFields=false)
 
 formatErrors ( $errors)
 Format a stack of error messages into a single HTML string.
 
 getAction ()
 Get the value for the action attribute of the form.
 
 getDisplayFormat ()
 Getter for displayFormat.
 
 getField ( $fieldname)
 
 getFooterText ( $section=null)
 Get footer text.
 
 getHiddenFields ()
 Get the hidden fields that should go inside the form.
 
 getHTML ( $submitResult)
 Returns the raw HTML generated by the form.
 
 getMethod ()
 
 getPreText ()
 Get the introductory message HTML.
 
 getSubmitText ()
 Get the text for the submit button, either customised or a default.
 
 getTitle ()
 
 hasField ( $fieldname)
 
 loadData ()
 Construct the form fields from the Descriptor array.
 
 needsJSForHtml5FormValidation ()
 Whether this form, with its current fields, requires the user agent to have JavaScript enabled for the client-side HTML5 form validation to work correctly.
 
 prepareForm ()
 Prepare form for submission.
 
 setAction ( $action)
 Set the value for the action attribute of the form.
 
 setAutocomplete ( $autocomplete)
 Set the value for the autocomplete attribute of the form.
 
 setCancelTarget ( $target)
 Sets the target where the user is redirected to after clicking cancel.
 
 setCollapsibleOptions ( $collapsedByDefault=false)
 Enable collapsible mode, and set whether the form is collapsed by default.
 
 setDisplayFormat ( $format)
 Set format in which to display the form.
 
 setFooterText ( $msg, $section=null)
 Set footer text, inside the form.
 
 setFormIdentifier ( $ident)
 Set an internal identifier for this form.
 
 setHeaderText ( $msg, $section=null)
 Set header text, inside the form.
 
 setId ( $id)
 
 setIntro ( $msg)
 Set the introductory message, overwriting any existing message.
 
 setMessagePrefix ( $p)
 Set the prefix for various default messages.
 
 setMethod ( $method='post')
 Set the method used to submit the form.
 
 setName ( $name)
 
 setPostText ( $msg)
 Set text at the end of the display.
 
 setPreText ( $msg)
 Set the introductory message HTML, overwriting any existing message.
 
 setSubmitCallback ( $cb)
 Set a callback to a function to do something with the form once it's been successfully validated.
 
 setSubmitDestructive ()
 Identify that the submit button in the form has a destructive action.
 
 setSubmitID ( $t)
 Set the id for the submit button.
 
 setSubmitName ( $name)
 
 setSubmitText ( $t)
 Set the text for the submit button.
 
 setSubmitTextMsg ( $msg)
 Set the text for the submit button to a message.
 
 setSubmitTooltip ( $name)
 
 setTableId ( $id)
 Set the id of the \<table\> or outermost \<div\> element.
 
 setTitle ( $t)
 Set the title for form submission.
 
 setTokenSalt ( $salt)
 Set the salt for the edit token.
 
 setValidationErrorMessage ( $msg)
 Set a message to display on a validation error.
 
 setWrapperAttributes ( $attributes)
 For internal use only.
 
 setWrapperLegend ( $legend)
 Prompt the whole form to be wrapped in a "<fieldset>", with this text as its "<legend>" element.
 
 setWrapperLegendMsg ( $msg)
 Prompt the whole form to be wrapped in a "<fieldset>", with this message as its "<legend>" element.
 
 show ()
 The here's-one-I-made-earlier option: do the submission if posted, or display the form with or without funky validation errors.
 
 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.
 
 showCancel ( $show=true)
 Show a cancel button (or prevent it).
 
 suppressDefaultSubmit ( $suppressSubmit=true)
 Stop a default submit button being shown for this form.
 
 suppressReset ( $suppressReset=true)
 Stop a reset button being shown for this form.
 
 tryAuthorizedSubmit ()
 Try submitting, with edit token check first.
 
 trySubmit ()
 Validate all the fields, and call the submission callback function if everything is kosher.
 
 wasSubmitted ()
 Test whether the form was considered to have been submitted or not, i.e.
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getAuthority ()
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens.
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Protected Member Functions

 wrapFieldSetSection ( $legend, $section, $attributes, $isRoot)
 Wraps the given $section into an user-visible fieldset.
Stability: stable
to override
Parameters
string$legendLegend text for the fieldset
string$sectionThe section content in plain Html
array$attributesAdditional attributes for the fieldset
bool$isRootSection is at the root of the tree
Returns
string The fieldset's Html
Returns
OOUI\PanelLayout

 
- Protected Member Functions inherited from OOUIHTMLForm
 formatFormHeader ()
 
 formatSection (array $fieldsHtml, $sectionName, $anyFieldHasLabel)
 Put a form section together from the individual fields' HTML, merging it and wrapping.
 
- Protected Member Functions inherited from HTMLForm
 getCancelTargetURL ()
 
 getFormAttributes ()
 Get HTML attributes for the <form> tag.
 
 getMessage ( $value)
 Turns a *-message parameter (which could be a MessageSpecifier, or a message name, or a name + parameters array) into a Message.
 

Protected Attributes

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

Private Attributes

User null $modifiedUser
 
bool $optionsEditable = true
 
bool $privateInfoEditable = true
 

Additional Inherited Members

- Static Public Member Functions inherited from OOUIHTMLForm
static loadInputFromParameters ( $fieldname, $descriptor, HTMLForm $parent=null)
 Initialise a new Object for the field.
 
- Static Public Member Functions inherited from HTMLForm
static factory ( $displayFormat,... $arguments)
 Construct a HTMLForm object for given display type.
 
static getClassFromDescriptor ( $fieldname, &$descriptor)
 Get the HTMLFormField subclass for this descriptor.
 
- Public Attributes inherited from HTMLForm
 $mFieldData
 
- Static Public Attributes inherited from HTMLForm
static string[] $typeMappings
 A mapping of 'type' inputs onto standard HTMLFormField subclasses.
 

Detailed Description

Form to edit user preferences.

Since
1.32

Definition at line 26 of file PreferencesFormOOUI.php.

Member Function Documentation

◆ areOptionsEditable()

PreferencesFormOOUI::areOptionsEditable ( )
Returns
bool

Definition at line 75 of file PreferencesFormOOUI.php.

Referenced by getButtons().

◆ filterDataForSubmit()

PreferencesFormOOUI::filterDataForSubmit (   $data)

Separate multi-option preferences into multiple preferences, since we have to store them separately.

Parameters
array$data
Returns
array

Reimplemented from HTMLForm.

Definition at line 140 of file PreferencesFormOOUI.php.

◆ getBody()

PreferencesFormOOUI::getBody ( )

Get the whole body of the form.

Returns
string

Reimplemented from OOUIHTMLForm.

Definition at line 168 of file PreferencesFormOOUI.php.

References $content, $header, HTMLForm\displaySection(), OOUIHTMLForm\formatFormHeader(), HTMLForm\getFooterText(), OOUIHTMLForm\getHeaderText(), getLegend(), and wfDebug().

◆ getButtons()

PreferencesFormOOUI::getButtons ( )
Returns
string

Reimplemented from OOUIHTMLForm.

Definition at line 109 of file PreferencesFormOOUI.php.

References $t, areOptionsEditable(), getTitle(), isPrivateInfoEditable(), and ContextSource\msg().

◆ getExtraSuccessRedirectParameters()

PreferencesFormOOUI::getExtraSuccessRedirectParameters ( )

Get extra parameters for the query string when redirecting after successful save.

Returns
array

Definition at line 92 of file PreferencesFormOOUI.php.

Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\submitForm().

◆ getLegend()

PreferencesFormOOUI::getLegend (   $key)

Get the "<legend>" for a given section key.

Normally this is the prefs-$key message but we'll allow extensions to override it.

Parameters
string$key
Returns
string

Reimplemented from HTMLForm.

Definition at line 228 of file PreferencesFormOOUI.php.

Referenced by getBody().

◆ getModifiedUser()

PreferencesFormOOUI::getModifiedUser ( )

◆ getPreferenceSections()

PreferencesFormOOUI::getPreferenceSections ( )

Get the keys of each top level preference section.

Returns
string[] List of section keys

Definition at line 238 of file PreferencesFormOOUI.php.

◆ isPrivateInfoEditable()

PreferencesFormOOUI::isPrivateInfoEditable ( )
Returns
bool

Definition at line 60 of file PreferencesFormOOUI.php.

Referenced by getButtons().

◆ setModifiedUser()

PreferencesFormOOUI::setModifiedUser (   $user)
Parameters
User$user

Definition at line 42 of file PreferencesFormOOUI.php.

◆ setOptionsEditable()

PreferencesFormOOUI::setOptionsEditable (   $optionsEditable)
Parameters
bool$optionsEditable

Definition at line 82 of file PreferencesFormOOUI.php.

◆ setPrivateInfoEditable()

PreferencesFormOOUI::setPrivateInfoEditable (   $editable)

Whether the.

Parameters
bool$editable

Definition at line 68 of file PreferencesFormOOUI.php.

◆ wrapFieldSetSection()

PreferencesFormOOUI::wrapFieldSetSection (   $legend,
  $section,
  $attributes,
  $isRoot 
)
protected

Wraps the given $section into an user-visible fieldset.

Stability: stable
to override
Parameters
string$legendLegend text for the fieldset
string$sectionThe section content in plain Html
array$attributesAdditional attributes for the fieldset
bool$isRootSection is at the root of the tree
Returns
string The fieldset's Html
Returns
OOUI\PanelLayout

Returns
OOUI\PanelLayout

Reimplemented from OOUIHTMLForm.

Definition at line 155 of file PreferencesFormOOUI.php.

◆ wrapForm()

PreferencesFormOOUI::wrapForm (   $html)
Parameters
string$html
Returns
string

Reimplemented from OOUIHTMLForm.

Definition at line 100 of file PreferencesFormOOUI.php.

Member Data Documentation

◆ $modifiedUser

User null PreferencesFormOOUI::$modifiedUser
private

Definition at line 31 of file PreferencesFormOOUI.php.

◆ $mSubSectionBeforeFields

bool PreferencesFormOOUI::$mSubSectionBeforeFields = false
protected

Override default value from HTMLForm.

Definition at line 28 of file PreferencesFormOOUI.php.

◆ $optionsEditable

bool PreferencesFormOOUI::$optionsEditable = true
private

Definition at line 37 of file PreferencesFormOOUI.php.

◆ $privateInfoEditable

bool PreferencesFormOOUI::$privateInfoEditable = true
private

Definition at line 34 of file PreferencesFormOOUI.php.


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