34 parent::__construct(
'ResetTokens' );
52 if ( !isset( $this->tokensList ) ) {
54 [
'preference' =>
'watchlisttoken',
'label-message' =>
'resettokens-watchlist-token' ],
56 Hooks::run(
'SpecialResetTokensTokens', [ &
$tokens ] );
58 $hiddenPrefs = $this->
getConfig()->get(
'HiddenPrefs' );
59 $tokens = array_filter(
$tokens,
function ( $tok ) use ( $hiddenPrefs ) {
60 return !in_array( $tok[
'preference'], $hiddenPrefs );
74 parent::execute(
$par );
81 Html::successBox(
'$1' ),
98 $label = $this->
msg(
'resettokens-token-label' )
99 ->rawParams( $this->
msg( $tok[
'label-message'] )->parse() )
100 ->params( $user->getTokenFromOption( $tok[
'preference'] ) )
102 $tokensForForm[$label] = $tok[
'preference'];
106 'label-message' =>
'resettokens-tokens',
107 'type' =>
'multiselect',
108 'options' => $tokensForForm,
112 'label-message' =>
'resettokens-no-tokens',
131 $form->suppressDefaultSubmit();
140 if ( $formData[
'tokens'] ) {
142 foreach ( $formData[
'tokens'] as $tokenPref ) {
143 $user->resetTokenFromOption( $tokenPref );
145 $user->saveSettings();
Special page which uses an HTMLForm to handle processing.
string $par
The sub-page of the special page.
getOutput()
Get the OutputPage being used for this instance.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getUser()
Shortcut to get the User executing this instance.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
Let users reset tokens like the watchlist token.
requiresUnblock()
Whether this action cannot be executed by a blocked user.
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
doesWrites()
Indicates whether this special page may perform database writes.
getDisplayFormat()
Get display format for the form.
onSubmit(array $formData)
Process the form on POST submission.
alterForm(HTMLForm $form)
Suppress the submit button if there's nothing to do; provide additional message on it otherwise.
getTokensList()
Returns the token information list for this page after running the hook and filtering out disabled pr...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getFormFields()
Display appropriate message if there's nothing to do.
execute( $par)
Basic SpecialPage workflow: get a form, send it to the user; get some data back,.
isListed()
Whether this special page is listed in Special:SpecialPages.