Skip to content

hallowelt/mwstake-mediawiki-component-dynamicfiledispatcher

Repository files navigation

DynamicFileDispatcher component

Provides dynamic images from registered modeules.

Usage

Getting URL

/** @var DynamicFileDispatcherFactory $dynamicFileFactory */
$dynamicFileFactory = MediaWikiServices::getInstance()->getService(
    'MWStake.DynamicFileDispatcher.Factory'
);
// getUrl( string $moduleName, array $params )
$src = $dynamicFileFactory->getUrl( 'userprofileimage', $userImageParams );

Registering modules

Create a class implementing MWStake\MediaWiki\Component\DynamicFileDispatcher\IDynamicFileModule interface.

Register:

  • using Global var
  • using hook
// Using global var - OF spec
$mwsgMWStakeDynamicFileDispatcherModules['myModule'] = [
    'class' => 'MyModuleClass',
    'services' => [
       'A', 'B'
    ],
];

// Using hook
$wgHooks['MWStakeDynamicFileDispatcherRegisterModule'][] = function( &$modules ) {
    $modules['myModule'] = new MyModule();
};

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages