Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Specials\SpecialModifyEntity Class Reference

Abstract special page for modifying Wikibase entity. More...

+ Inheritance diagram for Wikibase\Repo\Specials\SpecialModifyEntity:
+ Collaboration diagram for Wikibase\Repo\Specials\SpecialModifyEntity:

Public Member Functions

 __construct ( $title, SpecialPageCopyrightView $copyrightView, SummaryFormatter $summaryFormatter, EntityTitleLookup $entityTitleLookup, MediawikiEditEntityFactory $editEntityFactory)
 
 doesWrites ()
 
 execute ( $subPage)
 
- Public Member Functions inherited from Wikibase\Repo\Specials\SpecialWikibaseRepoPage
 __construct ( $title, $restriction, SpecialPageCopyrightView $copyrightView, SummaryFormatter $summaryFormatter, EntityTitleLookup $entityTitleLookup, MediawikiEditEntityFactory $editEntityFactory)
 
- Public Member Functions inherited from Wikibase\Repo\Specials\SpecialWikibasePage
 __construct ( $name='', $restriction='', $listed=true)
 
 getDescription ()
 
 setHeaders ()
 

Protected Member Functions

 getEntityId ()
 Returns the ID of the Entity being modified.
 
 getBaseRevision ()
 Returns the base revision.
 
 getLatestRevision ()
 Returns the current revision.
 
 getEntityForModification ()
 Returns the EntityDocument that is to be modified by code in this class (or subclasses).
 
 getEntityForDisplay ()
 Returns the EntityDocument that is to be shown by code in this class (or subclasses).
 
 processArguments ( $subPage)
 Prepares the arguments.
 
 getForm (EntityDocument $entity=null)
 Return the HTML form.
 
 getFormElements (EntityDocument $entity=null)
 
 validateInput ()
 Validates form input.
 
 isModificationRequested ()
 Whether the current request is a request for modification (as opposed to a request for showing the input form).
 
 modifyEntity (EntityDocument $entity)
 Modifies the entity.
 
 applyChangeOp (ChangeOp $changeOp, EntityDocument $entity, Summary $summary=null)
 Applies the given ChangeOp to the given Entity.
 
- Protected Member Functions inherited from Wikibase\Repo\Specials\SpecialWikibaseRepoPage
 prepareEditEntity (EntityId $id=null, $baseRev=0)
 
 getEditEntity ()
 Returns the EditEntity interactor.
 
 parseEntityId ( $rawId)
 Parses an entity id.
 
 parseItemId ( $rawId)
 Parses an item id.
 
 getEntityTitle (EntityId $id)
 
 saveEntity (EntityDocument $entity, FormatableSummary $summary, $token, $flags=EDIT_UPDATE)
 Saves the entity using the given summary.
 
 getCopyrightHTML ( $saveMessageKey=null)
 
- Protected Member Functions inherited from Wikibase\Repo\Specials\SpecialWikibasePage
 getGroupName ()
 
 checkBlocked ()
 Checks if user is blocked, and if blocked throws a UserBlocked.
 
 showErrorHTML ( $error)
 

Private Member Functions

 handleStatus (Status $status, EntityDocument $entity)
 
 setForm (EntityDocument $entity=null)
 Building the HTML form for modifying an entity.
 

Private Attributes

 $entityForModification = null
 
 $entityId
 

Additional Inherited Members

- Protected Attributes inherited from Wikibase\Repo\Specials\SpecialWikibaseRepoPage
 $summaryFormatter
 
- Protected Attributes inherited from Wikibase\Repo\Specials\SpecialWikibasePage
 $stringNormalizer
 

Detailed Description

Abstract special page for modifying Wikibase entity.

Author
Bene* < benes.nosp@m.tar..nosp@m.wikim.nosp@m.edia.nosp@m.@goog.nosp@m.lema.nosp@m.il.co.nosp@m.m >
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Specials\SpecialModifyEntity::__construct (   $title,
SpecialPageCopyrightView  $copyrightView,
SummaryFormatter  $summaryFormatter,
EntityTitleLookup  $entityTitleLookup,
MediawikiEditEntityFactory  $editEntityFactory 
)
Parameters
string$titleThe title of the special page
SpecialPageCopyrightView$copyrightView
SummaryFormatter$summaryFormatter
EntityTitleLookup$entityTitleLookup
MediawikiEditEntityFactory$editEntityFactory

Member Function Documentation

◆ applyChangeOp()

Wikibase\Repo\Specials\SpecialModifyEntity::applyChangeOp ( ChangeOp  $changeOp,
EntityDocument  $entity,
Summary  $summary = null 
)
protected

Applies the given ChangeOp to the given Entity.

If validation fails, a ChangeOpValidationException is thrown.

Parameters
ChangeOp$changeOp
EntityDocument$entity
Summary | null$summaryThe summary object to update with information about the change.
Exceptions
ChangeOpException

◆ doesWrites()

◆ execute()

Wikibase\Repo\Specials\SpecialModifyEntity::execute (   $subPage)
See also
SpecialWikibasePage::execute
Parameters
string | null$subPage

Reimplemented from Wikibase\Repo\Specials\SpecialWikibasePage.

◆ getBaseRevision()

Wikibase\Repo\Specials\SpecialModifyEntity::getBaseRevision ( )
protected

Returns the base revision.

If no base revision ID was passed to prepareEditEntity(), this returns the latest revision.

Exceptions
UserInputException
Returns
EntityRevision

◆ getEntityForDisplay()

Wikibase\Repo\Specials\SpecialModifyEntity::getEntityForDisplay ( )
protected

Returns the EntityDocument that is to be shown by code in this class (or subclasses).

The returns null if no entity ID was specified in the request.

Exceptions
MessageException
UserInputException
Returns
EntityDocument|null

◆ getEntityForModification()

Wikibase\Repo\Specials\SpecialModifyEntity::getEntityForModification ( )
protected

Returns the EntityDocument that is to be modified by code in this class (or subclasses).

The first call to this method calls getBaseRevision().

Exceptions
MessageException
UserInputException
Returns
EntityDocument

◆ getEntityId()

Wikibase\Repo\Specials\SpecialModifyEntity::getEntityId ( )
protected

Returns the ID of the Entity being modified.

Returns null if no entity ID was specified in the request.

Note
The return value is undefined before prepareArguments() has been called.
Returns
null|EntityId

◆ getForm()

Wikibase\Repo\Specials\SpecialModifyEntity::getForm ( EntityDocument  $entity = null)
abstractprotected

Return the HTML form.

Parameters
EntityDocument | null$entity
Returns
HTMLForm

Reimplemented in Wikibase\Repo\Specials\SpecialModifyTerm, Wikibase\Repo\Specials\SpecialSetLabelDescriptionAliases, and Wikibase\Repo\Specials\SpecialSetSiteLink.

◆ getFormElements()

Wikibase\Repo\Specials\SpecialModifyEntity::getFormElements ( EntityDocument  $entity = null)
protected
Parameters
EntityDocument | null$entity
Returns
array

◆ getLatestRevision()

Wikibase\Repo\Specials\SpecialModifyEntity::getLatestRevision ( )
protected

Returns the current revision.

Exceptions
UserInputException
Returns
null|EntityRevision

◆ handleStatus()

Wikibase\Repo\Specials\SpecialModifyEntity::handleStatus ( Status  $status,
EntityDocument  $entity 
)
private

◆ isModificationRequested()

Wikibase\Repo\Specials\SpecialModifyEntity::isModificationRequested ( )
protected

Whether the current request is a request for modification (as opposed to a request for showing the input form).

If this method returns false, the entity should not be updated and the user should be presented with an input form. Only if it returns true, and validateInput() also returns true, the entity should be updated in the storage backend.

Undefined before processArguments() was called.

Returns
bool

◆ modifyEntity()

Wikibase\Repo\Specials\SpecialModifyEntity::modifyEntity ( EntityDocument  $entity)
abstractprotected

Modifies the entity.

Parameters
EntityDocument$entity
Returns
Summary|bool

Reimplemented in Wikibase\Repo\Specials\SpecialModifyTerm, Wikibase\Repo\Specials\SpecialSetLabelDescriptionAliases, and Wikibase\Repo\Specials\SpecialSetSiteLink.

◆ processArguments()

Wikibase\Repo\Specials\SpecialModifyEntity::processArguments (   $subPage)
protected

◆ setForm()

Wikibase\Repo\Specials\SpecialModifyEntity::setForm ( EntityDocument  $entity = null)
private

Building the HTML form for modifying an entity.

Parameters
EntityDocument | null$entity

◆ validateInput()

Wikibase\Repo\Specials\SpecialModifyEntity::validateInput ( )
protected

Validates form input.

The default implementation does nothing. Subclasses should override this to detect otherwise incomplete or erroneous input.

If this method returns false, the entity should not be updated and the user should be presented with an input form. Only if it returns true, and isModificationRequested() also returns true, the entity should be updated in the storage backend.

Exceptions
UserInputExceptionif any of the provided input is invalid. If the input is merely incomplete, no exception should be raised.
Returns
bool true if all input needed for modification has been supplied. false if the input is valid but incomplete, or if the input is invalid and showErrorHTML() has already been called to notify the user of the problem. The preferred way of indicating invalid input is however to throw a UserInputException.

Reimplemented in Wikibase\Repo\Specials\SpecialModifyTerm, Wikibase\Repo\Specials\SpecialSetAliases, Wikibase\Repo\Specials\SpecialSetDescription, Wikibase\Repo\Specials\SpecialSetLabel, Wikibase\Repo\Specials\SpecialSetLabelDescriptionAliases, and Wikibase\Repo\Specials\SpecialSetSiteLink.

Member Data Documentation

◆ $entityForModification

Wikibase\Repo\Specials\SpecialModifyEntity::$entityForModification = null
private

◆ $entityId

Wikibase\Repo\Specials\SpecialModifyEntity::$entityId
private

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