MediaWiki REL1_39
MediaWiki\Permissions\GrantsLocalization Class Reference

This separate service is needed because the ::getGrantsLink method requires a LinkRenderer and if we tried to inject a LinkRenderer into the GrantsInfo service, it would result in recursive service instantiation for sessions using the BotPasswordSessionProvider, as a result of injecting the LinkRenderer when trying to use a GrantsInfo method that doesn't even need it. More...

Public Member Functions

 __construct (GrantsInfo $grantsInfo, LinkRenderer $linkRenderer, LanguageFactory $languageFactory, Language $contentLanguage)
 
 getGrantDescription (string $grant, $lang=null)
 Fetch the description of the grant.
 
 getGrantDescriptions (array $grants, $lang=null)
 Fetch the descriptions for the grants.
 
 getGrantsLink (string $grant, $lang=null)
 Generate a link to Special:ListGrants for a particular grant name.
 
 getGrantsWikiText ( $grantsFilter, $lang=null)
 Generate wikitext to display a list of grants.
 

Detailed Description

This separate service is needed because the ::getGrantsLink method requires a LinkRenderer and if we tried to inject a LinkRenderer into the GrantsInfo service, it would result in recursive service instantiation for sessions using the BotPasswordSessionProvider, as a result of injecting the LinkRenderer when trying to use a GrantsInfo method that doesn't even need it.

Since
1.38

Definition at line 37 of file GrantsLocalization.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Permissions\GrantsLocalization::__construct ( GrantsInfo $grantsInfo,
LinkRenderer $linkRenderer,
LanguageFactory $languageFactory,
Language $contentLanguage )
Parameters
GrantsInfo$grantsInfo
LinkRenderer$linkRenderer
LanguageFactory$languageFactory
Language$contentLanguage

Definition at line 56 of file GrantsLocalization.php.

Member Function Documentation

◆ getGrantDescription()

MediaWiki\Permissions\GrantsLocalization::getGrantDescription ( string $grant,
$lang = null )

Fetch the description of the grant.

Parameters
string$grant
Language | string | null$lang
Returns
string Grant description

Definition at line 74 of file GrantsLocalization.php.

References $lang.

◆ getGrantDescriptions()

MediaWiki\Permissions\GrantsLocalization::getGrantDescriptions ( array $grants,
$lang = null )

Fetch the descriptions for the grants.

Parameters
string[]$grants
Language | string | null$lang
Returns
string[] Corresponding grant descriptions

Definition at line 107 of file GrantsLocalization.php.

References $lang.

◆ getGrantsLink()

MediaWiki\Permissions\GrantsLocalization::getGrantsLink ( string $grant,
$lang = null )

Generate a link to Special:ListGrants for a particular grant name.

This should be used to link end users to a full description of what rights they are giving when they authorize a grant.

Parameters
string$grantthe grant name
Language | string | null$lang
Returns
string (proto-relative) HTML link

Definition at line 126 of file GrantsLocalization.php.

◆ getGrantsWikiText()

MediaWiki\Permissions\GrantsLocalization::getGrantsWikiText ( $grantsFilter,
$lang = null )

Generate wikitext to display a list of grants.

Parameters
string[] | null$grantsFilterIf non-null, only display these grants.
Language | string | null$lang
Returns
string Wikitext

Definition at line 139 of file GrantsLocalization.php.

References $lang.


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