MediaWiki  master
EditAction.php
Go to the documentation of this file.
1 <?php
28 class EditAction extends FormlessAction {
29 
30  public function getName() {
31  return 'edit';
32  }
33 
34  public function onView() {
35  return null;
36  }
37 
38  public function show() {
40 
41  $out = $this->getOutput();
42  $out->setRobotPolicy( 'noindex,nofollow' );
43 
44  // The editor should always see the latest content when starting their edit.
45  // Also to ensure cookie blocks can be set (T152462).
46  $out->enableClientCache( false );
47 
48  if ( $this->getContext()->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
49  $out->addModuleStyles( [
50  'mediawiki.ui.input',
51  'mediawiki.ui.checkbox',
52  ] );
53  }
54 
55  $article = $this->getArticle();
56  if ( $this->getHookRunner()->onCustomEditor( $article, $this->getUser() ) ) {
57  $editor = new EditPage( $article );
58  $editor->setContextTitle( $this->getTitle() );
59  $editor->edit();
60  }
61  }
62 
63  public function doesWrites() {
64  return true;
65  }
66 }
FormlessAction
An action which just does something, without showing a form first.
Definition: FormlessAction.php:28
EditAction\doesWrites
doesWrites()
Indicates whether this action may perform database writes.
Definition: EditAction.php:63
EditAction\getName
getName()
Return the name of the action this object responds to.
Definition: EditAction.php:30
Action\getContext
getContext()
Get the IContextSource in use here.
Definition: Action.php:213
Action\getArticle
getArticle()
Get a Article object.
Definition: Action.php:287
Action\$article
Article $article
Definition: Action.php:57
Action\getUser
getUser()
Shortcut to get the User being used for this instance.
Definition: Action.php:247
EditAction\show
show()
The main action entry point.
Definition: EditAction.php:38
Action\getTitle
getTitle()
Shortcut to get the Title object from the page.
Definition: Action.php:297
EditPage
The edit page/HTML interface (split from Article) The actual database and text munging is still in Ar...
Definition: EditPage.php:53
Action\getHookRunner
getHookRunner()
Definition: Action.php:327
EditAction\onView
onView()
Show something on GET request.
Definition: EditAction.php:34
Action\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: Action.php:237
Action\useTransactionalTimeLimit
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition: Action.php:525
EditAction
Page edition handler (action=edit)
Definition: EditAction.php:28