34 parent::__construct(
'ResetTokens' );
52 if ( !isset( $this->tokensList ) ) {
54 [
'preference' =>
'watchlisttoken',
'label-message' =>
'resettokens-watchlist-token' ],
56 $this->
getHookRunner()->onSpecialResetTokensTokens( $tokens );
58 $hiddenPrefs = $this->
getConfig()->get(
'HiddenPrefs' );
59 $tokens = array_filter( $tokens,
static function ( $tok ) use ( $hiddenPrefs ) {
60 return !in_array( $tok[
'preference'], $hiddenPrefs );
63 $this->tokensList = $tokens;
74 parent::execute(
$par );
81 Html::successBox(
'$1' ),
97 foreach ( $tokens as $tok ) {
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',
141 if ( $formData[
'tokens'] ) {
143 foreach ( $formData[
'tokens'] as $tokenPref ) {
144 $user->resetTokenFromOption( $tokenPref );
146 $user->saveSettings();
Special page which uses an HTMLForm to handle processing.
string null $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,... $params)
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.