Abstract content object for articles representing Wikibase entities.
More...
|
const | EDIT_IGNORE_CONSTRAINTS = 1024 |
| Flag for use with prepareSave(), indicating that no pre-save validation should be applied.
|
|
Abstract content object for articles representing Wikibase entities.
For more information on the relationship between entities and wiki pages, see docs/entity-storage.wiki.
- Copyright
- GPL-2.0-or-later
- Author
- Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
-
Daniel Kinzler
-
Bene* < benes.nosp@m.tar..nosp@m.wikim.nosp@m.edia.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >
@method \Wikibase\Repo\Content\EntityHandler getContentHandler()
◆ applyEntityPageProperties()
Wikibase\Repo\Content\EntityContent::applyEntityPageProperties |
( |
ParserOutput |
$output | ) |
|
|
private |
Registers any properties returned by getEntityPageProperties() in $output.
- Parameters
-
◆ applyValidators()
Wikibase\Repo\Content\EntityContent::applyValidators |
( |
array |
$validators | ) |
|
|
private |
Apply the given validators.
- Parameters
-
EntityValidator[] | $validators | |
- Returns
- Status
◆ copy()
Wikibase\Repo\Content\EntityContent::copy |
( |
| ) |
|
- See also
- Content::copy
- Returns
- self
◆ equals()
Wikibase\Repo\Content\EntityContent::equals |
( |
Content |
$that = null | ) |
|
Both contents will be considered equal if they have the same ID and equal Entity data.
If one of the contents is considered "new", then matching IDs is not a criteria for them to be considered equal.
- See also
- Content::equals
- Parameters
-
- Returns
- bool
◆ getDiff()
Wikibase\Repo\Content\EntityContent::getDiff |
( |
EntityContent |
$toContent | ) |
|
Returns a diff between this EntityContent and the given EntityContent.
- Parameters
-
- Returns
- EntityContentDiff
◆ getEntity()
Wikibase\Repo\Content\EntityContent::getEntity |
( |
| ) |
|
|
abstract |
Returns the entity contained by this entity content.
Deriving classes typically have a more specific get method as for greater clarity and type hinting.
- Exceptions
-
MWException | when it's a redirect (targets will never be resolved) |
LogicException | if the content object is empty and does not contain an entity. |
- Returns
- EntityDocument
Reimplemented in Wikibase\Repo\Content\ItemContent, and Wikibase\Repo\Content\PropertyContent.
◆ getEntityHolder()
Wikibase\Repo\Content\EntityContent::getEntityHolder |
( |
| ) |
|
|
abstractprotected |
◆ getEntityId()
Wikibase\Repo\Content\EntityContent::getEntityId |
( |
| ) |
|
- Exceptions
-
RuntimeException | if the content object is empty or no entity ID is set |
- Returns
- EntityId
◆ getEntityPageProperties()
Wikibase\Repo\Content\EntityContent::getEntityPageProperties |
( |
| ) |
|
◆ getEntityRedirect()
Wikibase\Repo\Content\EntityContent::getEntityRedirect |
( |
| ) |
|
Returns the EntityRedirect represented by this EntityContent, or null if this EntityContent is not a redirect.
- Note
- This default implementation will fail if isRedirect() is true. Subclasses that support redirects must override getEntityRedirect().
- Exceptions
-
- Returns
- EntityRedirect|null
Reimplemented in Wikibase\Repo\Content\ItemContent.
◆ getEntityRevision()
Wikibase\Repo\Content\EntityContent::getEntityRevision |
( |
|
$revisionId = null | ) |
|
|
private |
- Parameters
-
- Returns
- EntityRevision
◆ getIgnoreKeysForFilters()
Wikibase\Repo\Content\EntityContent::getIgnoreKeysForFilters |
( |
| ) |
|
|
abstractprotected |
◆ getNativeData()
Wikibase\Repo\Content\EntityContent::getNativeData |
( |
| ) |
|
- See also
- Content::getNativeData
- Note
- Avoid relying on this method! It bypasses EntityContentCodec, and does not make any guarantees about the structure of the array returned.
- Returns
- array|EntityDocument An undefined data structure representing the content. This is not guaranteed to conform to any serialization structure used in the database or externally.
◆ getParserOutput()
Wikibase\Repo\Content\EntityContent::getParserOutput |
( |
Title |
$title, |
|
|
|
$revisionId = null , |
|
|
ParserOptions |
$options = null , |
|
|
|
$generateHtml = true |
|
) |
| |
Returns a ParserOutput object containing the HTML.
- Note
- this calls ParserOutput::recordOption( 'userlang' ) to split the cache by user language, and ParserOutput::recordOption( 'wb' ) to split the cache on EntityHandler::PARSER_VERSION.
- See also
- Content::getParserOutput
- Parameters
-
Title | $title | |
int | null | $revisionId | |
ParserOptions | null | $options | |
bool | $generateHtml | |
- Returns
- ParserOutput
◆ getParserOutputForRedirect()
Wikibase\Repo\Content\EntityContent::getParserOutputForRedirect |
( |
|
$generateHtml | ) |
|
|
protected |
- Note
- Will fail if this EntityContent does not represent a redirect.
- Parameters
-
- Returns
- ParserOutput
◆ getParserOutputFromEntityView()
Wikibase\Repo\Content\EntityContent::getParserOutputFromEntityView |
( |
|
$revisionId, |
|
|
ParserOptions |
$options, |
|
|
|
$generateHtml = true |
|
) |
| |
|
protected |
◆ getPatchedCopy()
Returns a patched copy of this Content object.
- Parameters
-
- Exceptions
-
- Returns
- self
◆ getPatchedRedirect()
Wikibase\Repo\Content\EntityContent::getPatchedRedirect |
( |
Diff |
$redirectPatch | ) |
|
|
private |
- Parameters
-
- Returns
- EntityRedirect|null
◆ getRedirectData()
Wikibase\Repo\Content\EntityContent::getRedirectData |
( |
| ) |
|
|
private |
Returns an array structure for the redirect represented by this EntityContent, if any.
- Note
- This may or may not be consistent with what EntityContentCodec does. It it intended to be used primarily for diffing.
◆ getRedirectText()
Wikibase\Repo\Content\EntityContent::getRedirectText |
( |
| ) |
|
|
protected |
- Returns
- string Returns the string representation of the redirect represented by this EntityContent (if any).
- Note
- Will fail if this EntityContent is not a redirect.
◆ getSize()
Wikibase\Repo\Content\EntityContent::getSize |
( |
| ) |
|
returns the content's nominal size in bogo-bytes.
- Returns
- int
◆ getTextForFilters()
Wikibase\Repo\Content\EntityContent::getTextForFilters |
( |
| ) |
|
- Returns
- string A string representing the content in a way useful for content filtering as performed by extensions like AbuseFilter.
◆ getTextForSearchIndex()
Wikibase\Repo\Content\EntityContent::getTextForSearchIndex |
( |
| ) |
|
◆ getTextForSummary()
Wikibase\Repo\Content\EntityContent::getTextForSummary |
( |
|
$maxLength = 250 | ) |
|
Returns a textual representation of the content suitable for use in edit summaries and log messages.
- Parameters
-
int | $maxLength | maximum length of the summary text |
- Returns
- string
◆ getValidUserLanguage()
Wikibase\Repo\Content\EntityContent::getValidUserLanguage |
( |
Language |
$language | ) |
|
|
private |
◆ getWikitextForTransclusion()
Wikibase\Repo\Content\EntityContent::getWikitextForTransclusion |
( |
| ) |
|
- Returns
- string The wikitext to include when another page includes this content, or false if the content is not includable in a wikitext page.
◆ isCountable()
Wikibase\Repo\Content\EntityContent::isCountable |
( |
|
$hasLinks = null | ) |
|
- See also
- EntityContent::isCountable
- Parameters
-
- Returns
- bool True if this is not a redirect and the item is not empty.
◆ isEmpty()
Wikibase\Repo\Content\EntityContent::isEmpty |
( |
| ) |
|
◆ isValid()
Wikibase\Repo\Content\EntityContent::isValid |
( |
| ) |
|
- See also
- Content::isValid()
- Returns
- bool True if this content object is valid for saving. False if there is no entity, or the entity does not have an ID set.
Reimplemented in Wikibase\Repo\Content\PropertyContent.
◆ makeEmptyEntity()
Wikibase\Repo\Content\EntityContent::makeEmptyEntity |
( |
| ) |
|
|
private |
◆ prepareSave()
Wikibase\Repo\Content\EntityContent::prepareSave |
( |
WikiPage |
$page, |
|
|
|
$flags, |
|
|
|
$baseRevId, |
|
|
User |
$user |
|
) |
| |
- See also
- Content::prepareSave
- Parameters
-
WikiPage | $page | |
int | $flags | |
int | $baseRevId | |
User | $user | |
- Returns
- Status
◆ EDIT_IGNORE_CONSTRAINTS
const Wikibase\Repo\Content\EntityContent::EDIT_IGNORE_CONSTRAINTS = 1024 |
Flag for use with prepareSave(), indicating that no pre-save validation should be applied.
Can be passed in via EditEntity::attemptSave, EntityStore::saveEntity, as well as WikiPage::doEditContent()
- Note
- : must not collide with the EDIT_XXX flags defined by MediaWiki core in Defines.php.
The documentation for this class was generated from the following file: