Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Content\ItemContent Class Reference

Content object for articles representing Wikibase items. More...

+ Inheritance diagram for Wikibase\Repo\Content\ItemContent:
+ Collaboration diagram for Wikibase\Repo\Content\ItemContent:

Public Member Functions

 __construct (EntityHolder $itemHolder=null, EntityRedirect $entityRedirect=null, Title $redirectTitle=null)
 Do not use to construct new stuff from outside of this class, use the static newFoobar methods.
 
 getRedirectTarget ()
 
 getEntityRedirect ()
 
 getItem ()
 
 getEntity ()
 
 getEntityHolder ()
 
 getTextForSearchIndex ()
 
Returns
string A string representing the content in a way useful for building a full text search index.

 
 isEmpty ()
 
 getEntityPageProperties ()
 
- Public Member Functions inherited from Wikibase\Repo\Content\EntityContent
 isValid ()
 
 isCountable ( $hasLinks=null)
 
 getEntityId ()
 
 getTextForFilters ()
 
 getWikitextForTransclusion ()
 
 getTextForSummary ( $maxLength=250)
 Returns a textual representation of the content suitable for use in edit summaries and log messages.
 
 getNativeData ()
 
 getSize ()
 returns the content's nominal size in bogo-bytes.
 
 equals (Content $that=null)
 Both contents will be considered equal if they have the same ID and equal Entity data.
 
 getDiff (EntityContent $toContent)
 Returns a diff between this EntityContent and the given EntityContent.
 
 getPatchedCopy (EntityContentDiff $patch)
 Returns a patched copy of this Content object.
 
 copy ()
 

Static Public Member Functions

static newFromItem (Item $item)
 Create a new ItemContent object for the provided Item.
 
static newFromRedirect (EntityRedirect $redirect, Title $redirectTitle)
 Create a new ItemContent object representing a redirect to the given item ID.
 

Public Attributes

const CONTENT_MODEL_ID = 'wikibase-item'
 
- Public Attributes inherited from Wikibase\Repo\Content\EntityContent
const EDIT_IGNORE_CONSTRAINTS = 1024
 Flag for use with EntityHandler::validateSave(), indicating that no pre-save validation should be applied.
 

Protected Member Functions

 getIgnoreKeysForFilters ()
 Get the keys within this Contents Entity JSON that should be removed for text passed to edit filters.
 
- Protected Member Functions inherited from Wikibase\Repo\Content\EntityContent
 getRedirectText ()
 

Private Attributes

 $itemHolder
 
 $redirect
 
 $redirectTitle
 

Detailed Description

Content object for articles representing Wikibase items.

Author
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\ItemHandler getContentHandler()

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Content\ItemContent::__construct ( EntityHolder $itemHolder = null,
EntityRedirect $entityRedirect = null,
Title $redirectTitle = null )

Do not use to construct new stuff from outside of this class, use the static newFoobar methods.

In other words: treat as protected (which it was, but now cannot be since we derive from Content).

Parameters
EntityHolder | null$itemHolder
EntityRedirect | null$entityRedirect
Title | null$redirectTitleTitle of the redirect target.

Member Function Documentation

◆ getEntity()

Wikibase\Repo\Content\ItemContent::getEntity ( )
See also
EntityContent::getEntity
Note
This method cannot be called on redirects (targets will never be resolved)
Returns
Item

Reimplemented from Wikibase\Repo\Content\EntityContent.

◆ getEntityHolder()

Wikibase\Repo\Content\ItemContent::getEntityHolder ( )
See also
EntityContent::getEntityHolder
Returns
EntityHolder|null

Reimplemented from Wikibase\Repo\Content\EntityContent.

◆ getEntityPageProperties()

Wikibase\Repo\Content\ItemContent::getEntityPageProperties ( )
See also
EntityContent::getEntityPageProperties

Records the number of statements in the 'wb-claims' key and the number of sitelinks in the 'wb-sitelinks' key.

Returns
array A map from property names to property values.

Reimplemented from Wikibase\Repo\Content\EntityContent.

◆ getEntityRedirect()

Wikibase\Repo\Content\ItemContent::getEntityRedirect ( )
See also
EntityContent::getEntityRedirect
Returns
null|EntityRedirect

Reimplemented from Wikibase\Repo\Content\EntityContent.

◆ getIgnoreKeysForFilters()

Wikibase\Repo\Content\ItemContent::getIgnoreKeysForFilters ( )
protected

Get the keys within this Contents Entity JSON that should be removed for text passed to edit filters.

Returns
string[] Keys to ignore

Reimplemented from Wikibase\Repo\Content\EntityContent.

◆ getItem()

Wikibase\Repo\Content\ItemContent::getItem ( )
Note
This method cannot be called on redirects (targets will never be resolved)
Returns
Item

◆ getRedirectTarget()

Wikibase\Repo\Content\ItemContent::getRedirectTarget ( )
See also
Content::getRedirectTarget
Returns
Title|null

◆ getTextForSearchIndex()

Wikibase\Repo\Content\ItemContent::getTextForSearchIndex ( )

Returns
string A string representing the content in a way useful for building a full text search index.

Reimplemented from Wikibase\Repo\Content\EntityContent.

◆ isEmpty()

Wikibase\Repo\Content\ItemContent::isEmpty ( )
See also
EntityContent::isEmpty
Returns
bool True if this is not a redirect and the item is empty.

Reimplemented from Wikibase\Repo\Content\EntityContent.

◆ newFromItem()

static Wikibase\Repo\Content\ItemContent::newFromItem ( Item $item)
static

Create a new ItemContent object for the provided Item.

Parameters
Item$item
Returns
self

◆ newFromRedirect()

static Wikibase\Repo\Content\ItemContent::newFromRedirect ( EntityRedirect $redirect,
Title $redirectTitle )
static

Create a new ItemContent object representing a redirect to the given item ID.

Parameters
EntityRedirect$redirect
Title$redirectTitleTitle of the redirect target.
Returns
self

Member Data Documentation

◆ $itemHolder

Wikibase\Repo\Content\ItemContent::$itemHolder
private

◆ $redirect

Wikibase\Repo\Content\ItemContent::$redirect
private

◆ $redirectTitle

Wikibase\Repo\Content\ItemContent::$redirectTitle
private

◆ CONTENT_MODEL_ID

const Wikibase\Repo\Content\ItemContent::CONTENT_MODEL_ID = 'wikibase-item'

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