Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Hooks\WikibaseRepoHookRunner Class Reference

Partial implementation of a hook runner for WikibaseRepo. More...

+ Inheritance diagram for Wikibase\Repo\Hooks\WikibaseRepoHookRunner:
+ Collaboration diagram for Wikibase\Repo\Hooks\WikibaseRepoHookRunner:

Public Member Functions

 __construct (HookContainer $container)
 
 onEditFilterMergedContent (IContextSource $context, Content $content, Status $status, $summary, User $user, $minoredit, string $slotRole=SlotRecord::MAIN)
 
See also
EditFilterMergedContentHook::onEditFilterMergedContent()
Parameters
IContextSource$context
Content$contentContent of the edit box
Status$statusStatus object to represent errors, etc.
string$summaryEdit summary for page
User$userUser whois performing the edit
bool$minoreditWhether the edit was marked as minor by the user.
string$slotRoleThis extra parameter is not part of the core hook interface, but is passed in by Wikibase and read by AbuseFilter; see T288885.
Returns
bool|void False or no return value with not $status->isOK() to abort the edit and show the edit form, true to continue. But because multiple triggers of this hook may have different behavior in different version (T273354), you'd better return false and set $status->value to EditPage::AS_HOOK_ERROR_EXPECTED or any other customized value.

 
 onGetEntityByLinkedTitleLookup (EntityByLinkedTitleLookup &$lookup)
 Allows extensions to add custom EntityByLinkedTitleLookup services.
 
 onGetEntityContentModelForTitle (Title $title, string &$contentModel)
 Called to determine what the entity content model of the Title is.
 
 onWikibaseChangeNotification (Change $change)
 Triggered from ChangeNotifier via a HookChangeTransmitter to notify any listeners of changes to entities.
 
 onWikibaseContentModelMapping (array &$map)
 Called by () WikibaseRepo::getContentModelMappings() to allow additional mappings between Entity types and content model identifiers to be defined.
 
 onWikibaseRepoControllers (array &$controllerDefinitions)
 
 onWikibaseRepoDataTypes (array &$dataTypeDefinitions)
 Called when constructing the top-level WikibaseRepo factory May be used to define additional data types.
 
 onWikibaseRepoEntityTypes (array &$entityTypeDefinitions)
 Called when constructing the top-level WikibaseRepo factory.
 
 onWikibaseRepoOnParserOutputUpdaterConstruction (StatementDataUpdater $statementUpdater, array &$entityUpdaters)
 Allows extensions to register extra EntityParserOutputUpdater implementations.
 
 onWikibaseRepoOpenApiDocFragments (OpenApiDocFragmentJoiner $joiner)
 
 onWikibaseRepoSearchableEntityScopesMessages (array &$messages)
 Hook handler method for the 'WikibaseRepoSearchableEntityScopesMessages' hook.
Parameters
array&$messagesA dictionary mapping entity types (lexeme, property) to the message key of the translation for the entity name.
See also
ScopedTypeaheadCodexModule

 
 onWikibaseRepoSearchableEntityScopes (array &$searchableEntityScopes)
 Hook handler method for the 'WikibaseRepoSearchableEntityScopes' hook.
Parameters
array&$searchableEntityScopesA dictionary mapping entity types (lexeme, property) to the namespaceId of the associated entity namespace

 
 onWikibaseTextForSearchIndex (EntityContent $entityContent, string &$text)
 Called by EntityContent::getTextForSearchIndex() to allow extra text to be passed to the search engine for indexing.If the hook function returns false, no text at all will be passed to the search index.
Parameters
EntityContent$entityContentEntityContent to be indexed.
string&$textThe text to pass to the index (to be modified).
Returns
bool|void

 
 onWikibaseRepoEntityNamespaces (array &$entityNamespaces)
 Called in the default 'entitySources' setting to allow additional mappings between Entity types and namespace IDs to be defined.Only used if no custom entity sources are defined.
Parameters
array&$entityNamespacesAn associative array mapping Entity types to namespace ids.

 

Private Attributes

HookContainer $hookContainer
 

Detailed Description

Partial implementation of a hook runner for WikibaseRepo.

Full implementation will be addressed in T338452

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::__construct ( HookContainer $container)

Member Function Documentation

◆ onEditFilterMergedContent()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onEditFilterMergedContent ( IContextSource $context,
Content $content,
Status $status,
$summary,
User $user,
$minoredit,
string $slotRole = SlotRecord::MAIN )

See also
EditFilterMergedContentHook::onEditFilterMergedContent()
Parameters
IContextSource$context
Content$contentContent of the edit box
Status$statusStatus object to represent errors, etc.
string$summaryEdit summary for page
User$userUser whois performing the edit
bool$minoreditWhether the edit was marked as minor by the user.
string$slotRoleThis extra parameter is not part of the core hook interface, but is passed in by Wikibase and read by AbuseFilter; see T288885.
Returns
bool|void False or no return value with not $status->isOK() to abort the edit and show the edit form, true to continue. But because multiple triggers of this hook may have different behavior in different version (T273354), you'd better return false and set $status->value to EditPage::AS_HOOK_ERROR_EXPECTED or any other customized value.

Implements Wikibase\Repo\Hooks\WikibaseEditFilterMergedContentHook.

◆ onGetEntityByLinkedTitleLookup()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onGetEntityByLinkedTitleLookup ( EntityByLinkedTitleLookup & $lookup)

Allows extensions to add custom EntityByLinkedTitleLookup services.

Parameters
EntityByLinkedTitleLookup&$lookup

Implements Wikibase\Repo\Hooks\GetEntityByLinkedTitleLookupHook.

◆ onGetEntityContentModelForTitle()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onGetEntityContentModelForTitle ( Title $title,
string & $contentModel )

Called to determine what the entity content model of the Title is.

Extensions can override it so entity content model does not equal page content model.

Parameters
Title$titleTitle object for the page.
string&$contentModelContent model for the page. Extensions can override this.

Implements Wikibase\DataAccess\Hooks\GetEntityContentModelForTitleHook.

◆ onWikibaseChangeNotification()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseChangeNotification ( Change $change)

Triggered from ChangeNotifier via a HookChangeTransmitter to notify any listeners of changes to entities.

For performance reasons, does not include statement, description and alias diffs (see T113468, T163465).

Parameters
Change$changeThe Change object representing the change.

Implements Wikibase\Repo\Hooks\WikibaseChangeNotificationHook.

◆ onWikibaseContentModelMapping()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseContentModelMapping ( array & $map)

Called by () WikibaseRepo::getContentModelMappings() to allow additional mappings between Entity types and content model identifiers to be defined.

This hook runs during early initialization; its handlers must obey the () MediaWikiServicesHook rules, i.e. not declare any service dependencies nor access any unsafe services dynamically.

Parameters
string[]&$mapAn associative array mapping Entity types to content model ids.

Warning: This hook runs as part of an early initialization service (WikibaseRepo.ContentModelMappings, see service wiring and the warning there).

Implements Wikibase\Repo\Hooks\WikibaseContentModelMappingHook.

◆ onWikibaseRepoControllers()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseRepoControllers ( array & $controllerDefinitions)
Parameters
array<string,array<string,callable>>&$controllerDefinitions

Implements Wikibase\Repo\Hooks\WikibaseRepoControllersHook.

◆ onWikibaseRepoDataTypes()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseRepoDataTypes ( array & $dataTypeDefinitions)

Called when constructing the top-level WikibaseRepo factory May be used to define additional data types.

See also WikibaseClientDataTypesHook.

Hook handlers may add additional definitions. See datatypes documentation for details.

Parameters
array[]&$dataTypeDefinitionsthe array of data type definitions, as defined by WikibaseRepo.datatypes.php.

Implements Wikibase\Repo\Hooks\WikibaseRepoDataTypesHook.

◆ onWikibaseRepoEntityNamespaces()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseRepoEntityNamespaces ( array & $entityNamespaces)

Called in the default 'entitySources' setting to allow additional mappings between Entity types and namespace IDs to be defined.Only used if no custom entity sources are defined.

Parameters
array&$entityNamespacesAn associative array mapping Entity types to namespace ids.

Implements Wikibase\Repo\Hooks\WikibaseRepoEntityNamespacesHook.

◆ onWikibaseRepoEntityTypes()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseRepoEntityTypes ( array & $entityTypeDefinitions)

Called when constructing the top-level WikibaseRepo factory.

May be used to define additional entity types. See also WikibaseClientDataTypesHook.

Hook handlers may add additional definitions. See entitytypes documentation for details.

This hook runs during early initialization; its handlers must obey the () MediaWikiServicesHook rules, i.e. not declare any service dependencies nor access any unsafe services dynamically.

Parameters
array[]&$entityTypeDefinitionsThe array of entity type definitions, as defined by WikibaseLib.entitytypes.php.

Warning: This hook runs as part of an early initialization service (WikibaseRepo.EntityTypeDefinitions, see service wiring and the warning there).

Implements Wikibase\Repo\Hooks\WikibaseRepoEntityTypesHook.

◆ onWikibaseRepoOnParserOutputUpdaterConstruction()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseRepoOnParserOutputUpdaterConstruction ( StatementDataUpdater $statementUpdater,
array & $entityUpdaters )

Allows extensions to register extra EntityParserOutputUpdater implementations.

Parameters
StatementDataUpdater$statementUpdater
EntityParserOutputUpdater[]&$entityUpdaters

Implements Wikibase\Repo\Hooks\WikibaseRepoOnParserOutputUpdaterConstructionHook.

◆ onWikibaseRepoOpenApiDocFragments()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseRepoOpenApiDocFragments ( OpenApiDocFragmentJoiner $joiner)

◆ onWikibaseRepoSearchableEntityScopes()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseRepoSearchableEntityScopes ( array & $searchableEntityScopes)

Hook handler method for the 'WikibaseRepoSearchableEntityScopes' hook.

Parameters
array&$searchableEntityScopesA dictionary mapping entity types (lexeme, property) to the namespaceId of the associated entity namespace

Implements Wikibase\Repo\Hooks\WikibaseRepoSearchableEntityScopesHook.

◆ onWikibaseRepoSearchableEntityScopesMessages()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseRepoSearchableEntityScopesMessages ( array & $messages)

Hook handler method for the 'WikibaseRepoSearchableEntityScopesMessages' hook.

Parameters
array&$messagesA dictionary mapping entity types (lexeme, property) to the message key of the translation for the entity name.
See also
ScopedTypeaheadCodexModule

Implements Wikibase\Repo\Hooks\WikibaseRepoSearchableEntityScopesMessagesHook.

◆ onWikibaseTextForSearchIndex()

Wikibase\Repo\Hooks\WikibaseRepoHookRunner::onWikibaseTextForSearchIndex ( EntityContent $entityContent,
string & $text )

Called by EntityContent::getTextForSearchIndex() to allow extra text to be passed to the search engine for indexing.If the hook function returns false, no text at all will be passed to the search index.

Parameters
EntityContent$entityContentEntityContent to be indexed.
string&$textThe text to pass to the index (to be modified).
Returns
bool|void

Implements Wikibase\Repo\Hooks\WikibaseTextForSearchIndexHook.

Member Data Documentation

◆ $hookContainer

HookContainer Wikibase\Repo\Hooks\WikibaseRepoHookRunner::$hookContainer
private

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