Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Actions\EditEntityAction Class Reference

Handles the edit action for Wikibase entities. More...

+ Inheritance diagram for Wikibase\Repo\Actions\EditEntityAction:
+ Collaboration diagram for Wikibase\Repo\Actions\EditEntityAction:

Public Member Functions

 __construct (Article $article, IContextSource $context, private readonly FormatterFactory $formatterFactory, protected readonly PermissionManager $permissionManager, private readonly RevisionLookup $revisionLookup, private readonly AnonymousEditWarningBuilder $anonymousEditWarningBuilder, private readonly EntityDiffVisualizerFactory $entityDiffVisualizerFactory, private readonly SummaryFormatter $summaryFormatter)
 
 getName ()
 
 show ()
 
 requiresUnblock ()
 
 requiresWrite ()
 

Public Attributes

const SPEC
 ObjectFactory specification for this class, to be returned by EntityHandler::getActionOverrides() implementations.
 

Protected Member Functions

 showPermissionError (string $action)
 Show an error page if the user is not allowed to perform the given action.
 
 loadRevisions ()
 Loads the revisions specified by the web request and returns them as a three element array wrapped in a Status object.
 
 getEntityContent (RevisionRecord $revision)
 Helper function to "fix" the return type of RevisionRecord::getContent() because we know it will be EntityContent.
 
 showUndoErrorPage (StatusValue $status)
 Output an error page showing the given status.
 
 makeSummary (string $actionName, RevisionRecord $revision, string $userSummary)
 
- Protected Member Functions inherited from Wikibase\Repo\Actions\ViewEntityAction
 getDescription ()
 

Private Member Functions

 getStatus (WebRequest $req, RevisionRecord $latestRevision)
 
 getTitleText ()
 Used for overriding the page HTML title with the label, if available, or else the id.
 
 getCancelLink ()
 Returns a cancel link back to viewing the entity's page.
 
 showDiffStyle ()
 Add style sheets and supporting JS for diff display.
 
 getSummaryInput (string $labelText, int $autoSummaryLength)
 Generate standard summary input and label (wgSummary), compatible to \MediaWiki\EditPage\EditPage.
 
 displayUndoDiff (EntityContentDiff $diff)
 
 getEditButton ()
 
 showConfirmationForm (int $autoSummaryLength, int $undidRevision=0)
 Shows a form that can be used to confirm the requested undo/restore action.
 

Detailed Description

Handles the edit action for Wikibase entities.

This shows the forms for the undo and restore operations if requested. Otherwise it will just show the normal entity view.

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Jens Ohlig
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Actions\EditEntityAction::__construct ( Article $article,
IContextSource $context,
private readonly FormatterFactory $formatterFactory,
protected readonly PermissionManager $permissionManager,
private readonly RevisionLookup $revisionLookup,
private readonly AnonymousEditWarningBuilder $anonymousEditWarningBuilder,
private readonly EntityDiffVisualizerFactory $entityDiffVisualizerFactory,
private readonly SummaryFormatter $summaryFormatter )

Member Function Documentation

◆ displayUndoDiff()

Wikibase\Repo\Actions\EditEntityAction::displayUndoDiff ( EntityContentDiff $diff)
private

◆ getCancelLink()

Wikibase\Repo\Actions\EditEntityAction::getCancelLink ( )
private

Returns a cancel link back to viewing the entity's page.

◆ getEditButton()

Wikibase\Repo\Actions\EditEntityAction::getEditButton ( )
private
Returns
string HTML

◆ getEntityContent()

Wikibase\Repo\Actions\EditEntityAction::getEntityContent ( RevisionRecord $revision)
protected

Helper function to "fix" the return type of RevisionRecord::getContent() because we know it will be EntityContent.

◆ getName()

Wikibase\Repo\Actions\EditEntityAction::getName ( )

◆ getStatus()

Wikibase\Repo\Actions\EditEntityAction::getStatus ( WebRequest $req,
RevisionRecord $latestRevision )
private

◆ getSummaryInput()

Wikibase\Repo\Actions\EditEntityAction::getSummaryInput ( string $labelText,
int $autoSummaryLength )
private

Generate standard summary input and label (wgSummary), compatible to \MediaWiki\EditPage\EditPage.

Parameters
string$labelTextThe html to place inside the label
int$autoSummaryLength
Returns
string HTML

◆ getTitleText()

Wikibase\Repo\Actions\EditEntityAction::getTitleText ( )
private

Used for overriding the page HTML title with the label, if available, or else the id.

This is passed via parser output and output page to save overhead on view / edit actions.

◆ loadRevisions()

Wikibase\Repo\Actions\EditEntityAction::loadRevisions ( )
protected

Loads the revisions specified by the web request and returns them as a three element array wrapped in a Status object.

If any error arises, it will be reported using the status object.

Returns
Status<RevisionRecord[]> A Status object containing an array with three revision record objects, [ $olderRevision, $newerRevision, $latestRevision ]. -return Status<array{0:RevisionRecord,1:RevisionRecord,2:RevisionRecord}>

◆ makeSummary()

Wikibase\Repo\Actions\EditEntityAction::makeSummary ( string $actionName,
RevisionRecord $revision,
string $userSummary )
protected

◆ requiresUnblock()

Wikibase\Repo\Actions\EditEntityAction::requiresUnblock ( )
See also
Action::requiresUnblock
Returns
bool Always true.

Reimplemented from Wikibase\Repo\Actions\ViewEntityAction.

◆ requiresWrite()

Wikibase\Repo\Actions\EditEntityAction::requiresWrite ( )
See also
Action::requiresWrite
Returns
bool Always true.

Reimplemented from Wikibase\Repo\Actions\ViewEntityAction.

◆ show()

Wikibase\Repo\Actions\EditEntityAction::show ( )
See also
FormlessAction::show

Calls parent show() action to just display the entity, unless an undo action is requested.

Reimplemented from Wikibase\Repo\Actions\ViewEntityAction.

Reimplemented in Wikibase\Repo\Actions\SubmitEntityAction.

◆ showConfirmationForm()

Wikibase\Repo\Actions\EditEntityAction::showConfirmationForm ( int $autoSummaryLength,
int $undidRevision = 0 )
private

Shows a form that can be used to confirm the requested undo/restore action.

◆ showDiffStyle()

Wikibase\Repo\Actions\EditEntityAction::showDiffStyle ( )
private

Add style sheets and supporting JS for diff display.

◆ showPermissionError()

Wikibase\Repo\Actions\EditEntityAction::showPermissionError ( string $action)
protected

Show an error page if the user is not allowed to perform the given action.

Parameters
string$actionThe action to check
Returns
bool true if there were permission errors

◆ showUndoErrorPage()

Wikibase\Repo\Actions\EditEntityAction::showUndoErrorPage ( StatusValue $status)
protected

Output an error page showing the given status.

Member Data Documentation

◆ SPEC

const Wikibase\Repo\Actions\EditEntityAction::SPEC
Initial value:
= [
'class' => self::class,
'services' => [
'FormatterFactory',
'PermissionManager',
'RevisionLookup',
'WikibaseRepo.AnonymousEditWarningBuilder',
'WikibaseRepo.EntityDiffVisualizerFactory',
'WikibaseRepo.SummaryFormatter',
],
]

ObjectFactory specification for this class, to be returned by EntityHandler::getActionOverrides() implementations.


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