MediaWiki master
MediaWiki\ShadowPage\ShadowPageLoader Class Reference

A service which loads shadow content, which is content that is displayed on a nonexistent page with a valid can-exist title. More...

Public Member Functions

 __construct (private ObjectFactory $objectFactory, private array $coreSpecs, private array $extensionSpecs)
 
 existsForLink (LinkTarget $link)
 Check if a link should be shown as existing, due to the existence of shadow content at that location.
 
 get (PageReference $title)
 Try to get a ShadowPage for the given title.
 
 getExtensionProvider (string $className)
 Get an extension provider with a given class name, or throw if no such provider exists.
 
 getMessageProvider ()
 Get the MessageProvider instance.
 

Public Attributes

const CORE_SPECS
 

Detailed Description

A service which loads shadow content, which is content that is displayed on a nonexistent page with a valid can-exist title.

For example, pages in the MediaWiki namespace show the default message text.

A container and factory for ShadowPageProvider instances.

Since
1.47

Definition at line 19 of file ShadowPageLoader.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\ShadowPage\ShadowPageLoader::__construct ( private ObjectFactory $objectFactory,
private array $coreSpecs,
private array $extensionSpecs )
Parameters
ObjectFactory$objectFactory
array$coreSpecsShould be self::CORE_SPECS except while testing
array$extensionSpecsArray of associative arrays. The keys "class", "factory", "args", "services" and "optional_services" are passed down to ObjectFactory. The following additional keys are recognised:
  • namespace: If present, only titles with this namespace will be given to the provider.

Definition at line 60 of file ShadowPageLoader.php.

Member Function Documentation

◆ existsForLink()

MediaWiki\ShadowPage\ShadowPageLoader::existsForLink ( LinkTarget $link)

Check if a link should be shown as existing, due to the existence of shadow content at that location.

Definition at line 83 of file ShadowPageLoader.php.

◆ get()

MediaWiki\ShadowPage\ShadowPageLoader::get ( PageReference $title)

Try to get a ShadowPage for the given title.

Definition at line 70 of file ShadowPageLoader.php.

Referenced by MediaWiki\Parser\Parser\defaultFetchTemplate().

◆ getExtensionProvider()

MediaWiki\ShadowPage\ShadowPageLoader::getExtensionProvider ( string $className)

Get an extension provider with a given class name, or throw if no such provider exists.

To get a core provider, use the relevant accessor such as getMessageProvider().

Definition at line 114 of file ShadowPageLoader.php.

◆ getMessageProvider()

MediaWiki\ShadowPage\ShadowPageLoader::getMessageProvider ( )

Get the MessageProvider instance.

Definition at line 95 of file ShadowPageLoader.php.

References NS_MEDIAWIKI.

Member Data Documentation

◆ CORE_SPECS

const MediaWiki\ShadowPage\ShadowPageLoader::CORE_SPECS
Initial value:
= [
[
'namespace' => NS_MEDIAWIKI,
'class' => MessageProvider::class,
'services' => [
'MessageCache',
'ContentLanguage',
'SlotRoleRegistry',
'ContentHandlerFactory',
]
]
]
const NS_MEDIAWIKI
Definition Defines.php:59

Definition at line 20 of file ShadowPageLoader.php.


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