Manual:$wgArticle
Bu özellik, 1.23.0[1] sürümünde tamamen kaldırıldı. |
Küresel nesnesi: $wgArticle | |
---|---|
Başlık nesnesine karşılık gelen madde nesnesi (veya Maddenin alt nesnesi) | |
Parametreler: | $title |
Kullanımdan kaldırıldı: | 1.19.0 |
Kaldırıldı: | 1.23.0[1] |
Sınıf: | Article |
Konum: | Article.php , CategoryPage.php, ImagePage.php |
Details
The Article object encapsulates access to the "page" table of the database. The object represents an article, and maintains state such as text (in Wikitext format), flags, etc.
The CategoryPage and ImagePage objects are child objects of the Article object, and are used specifically for Category pages and Image pages.
Replacement
Use the Context object to get what you need.
Since 1.19, Context objects have a getWikiPage()
to access the corresponding WikiPage
object.
Where you get this context object from depends on where your code is running.
Many major classes extend ContextSource
, which means you can just do $someObject->getContext()
to get the context and $someObject->getWikiPage()
for the WikiPage
object.
As of this writing that includes ApiBase
, CategoryViewer
, ChangesList
, DerivativeContext
, DifferenceEngine
, HTMLForm
, ImportReporter
, IndexPager
, OutputPage
, RevisionListBase
, Skin
.
Some other classes support getContext()
which don't have ContextSource
as a parent class, such as SpecialPage
(So if you're writing a SpecialPage
, you can often do $this->getContext()
to get the context).
If you need to use a method which is in Article
but not WikiPage
and have a context object, say $context
, you can use Article::newFromTitle( $context->getTitle(), $context );
, please also note the following things:
- The displayed revision's ID is accessible through
OutputPage->getRevisionId()
orSkin->getRevisionId()
and the fact that this is the current revision of the page can be accessed throughSkin->isRevisionCurrent()
(instead ofArticle->isCurrent()
)
- The text of the latest revision of the current page (not necessarily of the displayed revision) is accessible through
WikiPage->getRawText()
; depending on what you useArticle->getContent()
for, you may prefer this one.
Sample Code
Use $article->getPage()->getContent()->getNativeData()
to replace this.