MediaWiki master
MediaWiki\Parser\Parsoid\Config\PageConfigFactory Class Reference

Helper class used by MediaWiki to create Parsoid PageConfig objects. More...

Inherits Wikimedia\Parsoid\Config\PageConfigFactory.

Collaboration diagram for MediaWiki\Parser\Parsoid\Config\PageConfigFactory:

Public Member Functions

 __construct (private readonly RevisionStore $revisionStore, private readonly SlotRoleRegistry $slotRoleRegistry, private readonly LanguageFactory $languageFactory,)
 create (PageIdentity $pageId, ?UserIdentity $user=null, $revision=null, ?string $unused=null, ?Bcp47Code $pageLanguageOverride=null, bool $ensureAccessibleContent=false)
 Create a new PageConfig.
 createFromParserOptions (ParserOptions $parserOptions, PageIdentity $pageId, $revision=null, ?Bcp47Code $pageLanguageOverride=null, bool $ensureAccessibleContent=false, bool $checkAuthority=false)
 Create a new PageConfig.

Detailed Description

Helper class used by MediaWiki to create Parsoid PageConfig objects.

Since
1.39
Access: internal

Definition at line 32 of file PageConfigFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\Parsoid\Config\PageConfigFactory::__construct ( private readonly RevisionStore $revisionStore,
private readonly SlotRoleRegistry $slotRoleRegistry,
private readonly LanguageFactory $languageFactory )

Definition at line 33 of file PageConfigFactory.php.

Member Function Documentation

◆ create()

MediaWiki\Parser\Parsoid\Config\PageConfigFactory::create ( PageIdentity $pageId,
?UserIdentity $user = null,
$revision = null,
?string $unused = null,
?Bcp47Code $pageLanguageOverride = null,
bool $ensureAccessibleContent = false )

Create a new PageConfig.

Note that Parsoid isn't supposed to use the user context by design; all user-specific processing is expected to be introduced as a post-parse transform. The $user parameter is therefore usually null, especially in background job parsing, although there are corner cases during extension processing where a non-null $user could affect the output.

Parameters
PageIdentity$pageIdThe page represented by the PageConfig.
?UserIdentity$userUser who is doing rendering (for parsing options).
int | RevisionRecord | null$revisionRevision id or a revision record
?string$unused
?Bcp47Code$pageLanguageOverride
bool$ensureAccessibleContentIf true, ensures that we can get content from the newly constructed pageConfig's RevisionRecord and throws a RevisionAccessException if not.
Returns
\Wikimedia\Parsoid\Config\PageConfig
Exceptions
RevisionAccessException
Deprecated
since 1.45; use ::createFromParserOptions() instead

Definition at line 61 of file PageConfigFactory.php.

References wfDeprecated().

◆ createFromParserOptions()

MediaWiki\Parser\Parsoid\Config\PageConfigFactory::createFromParserOptions ( ParserOptions $parserOptions,
PageIdentity $pageId,
$revision = null,
?Bcp47Code $pageLanguageOverride = null,
bool $ensureAccessibleContent = false,
bool $checkAuthority = false )

Create a new PageConfig.

Note that Parsoid isn't supposed to use the user context by design; all user-specific processing is expected to be introduced as a post-parse transform. The $user parameter is therefore usually null, especially in background job parsing, although there are corner cases during extension processing where a non-null $user could affect the output.

The page language comes from the ParserOptions, as in Parser::getTargetLanguage(): the target language if it is set, else the user language for an interface message, else the page language of the title. To override the page language, set the target language in the ParserOptions before you call this method. This method does not change the ParserOptions.

Parameters
ParserOptions$parserOptions(See note above about user identity in the parser options.) Set the 'useParsoid' option. Since 1.47, a call without 'useParsoid' set is deprecated.
PageIdentity$pageIdThe page represented by the PageConfig.
int | RevisionRecord | null$revisionRevision id or a revision record
?Bcp47Code$pageLanguageOverrideDeprecated since 1.47; set the target language in $parserOptions instead.
bool$ensureAccessibleContentIf true, ensures that we can get content from the newly constructed pageConfig's RevisionRecord and throws a RevisionAccessException if not.
bool$checkAuthority
Returns
\Wikimedia\Parsoid\Config\PageConfig
Exceptions
RevisionAccessException

Definition at line 121 of file PageConfigFactory.php.


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