Handbuch:$wgParser
Diese Funktion wurde in der Version 1.39.0 vollständig entfernt. |
Globales Objekt: $wgParser | |
---|---|
Parserobjekt | |
Veraltet in: | 1.32.0 |
Entfernt in: | 1.39.0 |
Klasse: | Parser |
Located in: | Parser.php |
Beschreibung
The Parser object is responsible for parsing the tags and wikitext contained in wiki pages. Parser extensions hooks are also registered in the Parser object.
Verwende stattdessen
MediaWikiServices::getInstance()->getParser()
(phab:T160811).Mode of Operation
$wgParser
is called in includes/Setup.php
with the following code:
$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
StubObject is defined in includes/StubObject.php
.
wgParserConf is defined in includes/DefaultSettings.php
with the following code:
$wgParserConf = array('class' => 'Parser',);
Ersatz
MediaWiki Version: | ≥ 1.32 |
New code should use dependency injection instead.
The parser is now available in the service locator under the Parser
service.
Existing code that has not yet been changed to use dependency injection can call the service locator directly:
public function render() {
$parser = \MediaWiki\MediaWikiServices::getInstance()->getParser();
$text = $parser->parse(
...
)->getText();
}