MediaWiki
REL1_40
UnwatchAction.php
Go to the documentation of this file.
1
<?php
23
use
MediaWiki\Watchlist\WatchlistManager
;
24
30
class
UnwatchAction
extends
WatchAction
{
31
33
private
$watchlistManager;
34
41
public
function
__construct
(
42
Article
$article,
43
IContextSource
$context,
44
WatchlistManager
$watchlistManager,
45
WatchedItemStore
$watchedItemStore
46
) {
47
parent::__construct( $article, $context, $watchlistManager, $watchedItemStore );
48
$this->watchlistManager = $watchlistManager;
49
}
50
51
public
function
getName
() {
52
return
'unwatch'
;
53
}
54
55
public
function
onSubmit
( $data ) {
56
$this->watchlistManager->removeWatch(
57
$this->
getAuthority
(),
58
$this->
getTitle
()
59
);
60
61
return
true
;
62
}
63
64
protected
function
getFormFields
() {
65
return
[
66
'intro'
=> [
67
'type'
=>
'info'
,
68
'raw'
=>
true
,
69
'default'
=> $this->
msg
(
'confirm-unwatch-top'
)->parse()
70
]
71
];
72
}
73
74
protected
function
alterForm
(
HTMLForm
$form ) {
75
parent::alterForm( $form );
76
$form->
setWrapperLegendMsg
(
'removewatch'
);
77
$form->
setSubmitTextMsg
(
'confirm-unwatch-button'
);
78
}
79
80
public
function
onSuccess
() {
81
$msgKey = $this->
getTitle
()->isTalkPage() ?
'removedwatchtext-talk'
:
'removedwatchtext'
;
82
$this->
getOutput
()->addWikiMsg( $msgKey, $this->
getTitle
()->getPrefixedText() );
83
}
84
85
public
function
doesWrites
() {
86
return
true
;
87
}
88
}
getAuthority
getAuthority()
getTitle
getTitle()
Definition
RevisionSearchResultTrait.php:82
Action\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition
Action.php:151
Action\msg
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Definition
Action.php:233
Article
Legacy class representing an editable page and handling UI for some page actions.
Definition
Article.php:56
HTMLForm
Object handling generic submission, CSRF protection, layout and other logic for UI forms in a reusabl...
Definition
HTMLForm.php:153
HTMLForm\setSubmitTextMsg
setSubmitTextMsg( $msg)
Set the text for the submit button to a message.
Definition
HTMLForm.php:1636
HTMLForm\setWrapperLegendMsg
setWrapperLegendMsg( $msg)
Prompt the whole form to be wrapped in a "<fieldset>", with this message as its "<legend>" element.
Definition
HTMLForm.php:1841
MediaWiki\Watchlist\WatchlistManager
WatchlistManager service.
Definition
WatchlistManager.php:50
UnwatchAction
Page removal from a user's watchlist.
Definition
UnwatchAction.php:30
UnwatchAction\onSubmit
onSubmit( $data)
Process the form on POST submission.
Definition
UnwatchAction.php:55
UnwatchAction\getFormFields
getFormFields()
Get an HTMLForm descriptor array.
Definition
UnwatchAction.php:64
UnwatchAction\__construct
__construct(Article $article, IContextSource $context, WatchlistManager $watchlistManager, WatchedItemStore $watchedItemStore)
Definition
UnwatchAction.php:41
UnwatchAction\doesWrites
doesWrites()
Definition
UnwatchAction.php:85
UnwatchAction\getName
getName()
Return the name of the action this object responds to.
Definition
UnwatchAction.php:51
UnwatchAction\onSuccess
onSuccess()
Show one of 8 possible success messages.
Definition
UnwatchAction.php:80
UnwatchAction\alterForm
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
Definition
UnwatchAction.php:74
WatchAction
Page addition to a user's watchlist.
Definition
WatchAction.php:32
WatchedItemStore
Storage layer class for WatchedItems.
Definition
WatchedItemStore.php:28
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition
IContextSource.php:60
includes
actions
UnwatchAction.php
Generated on Thu Jun 27 2024 14:02:11 for MediaWiki by
1.10.0