Allow Cite to define the reference preview module instead

This provides backwards compatibility with Cite, if Cite has register
its own preview module for reference tooltips.

Bug: T355194
Change-Id: Iec6f3d4d6c5f765c151ae0dbba258049530e6bc0
This commit is contained in:
Jon Robson 2024-02-02 10:59:04 -08:00
parent 7172aae082
commit e9ac5dcf47

View file

@ -67,11 +67,17 @@ class PopupsHooks implements
* @return array
*/
public static function getCustomPopupTypes(): array {
$rl = MediaWikiServices::getInstance()->getService( 'ResourceLoader' );
// FIXME: If the module ext.cite.referencePreviews does not exist register reference previews.
// This code can be removed once T355194 is complete.
$others = $rl->getModule( 'ext.cite.referencePreviews' ) ?
[] : [
'ext.popups.referencePreviews'
];
return array_merge( ExtensionRegistry::getInstance()->getAttribute(
'PopupsPluginModules'
), [
'ext.popups.referencePreviews'
] );
), $others );
}
/**