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)
 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 )

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
ParserOptions$parserOptions(See note above about user identity in the parser options.)
PageIdentity$pageIdThe page represented by the PageConfig.
int | RevisionRecord | null$revisionRevision id or a revision record
?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

Definition at line 105 of file PageConfigFactory.php.


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