mediawiki-extensions-Visual.../includes/ServiceWiring.php
Derick Alangi b029fd8ede Introduce VisualEditorParsoidClientFactory
This patch introduces a factory service for creating VE Parsoid
clients.

NOTE: This patch also injects a GlobalIdGenerator to the client
 and avoids usage of deprecated UIDGenerator class.

Change-Id: I787c0afb227308aab56770d14d62e08eb0084a6c
2022-09-06 12:47:43 +01:00

43 lines
1.2 KiB
PHP

<?php
/**
* ServiceWiring files for VisualEditor.
*
* @file
* @ingroup Extensions
* @copyright 2011-2021 VisualEditor Team and others; see AUTHORS.txt
* @license MIT
*/
namespace MediaWiki\Extension\VisualEditor;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\MediaWikiServices;
return [
VisualEditorHookRunner::SERVICE_NAME => static function ( MediaWikiServices $services ): VisualEditorHookRunner {
return new VisualEditorHookRunner( $services->getHookContainer() );
},
VisualEditorParsoidClientFactory::SERVICE_NAME => static function (
MediaWikiServices $services
): VisualEditorParsoidClientFactory {
$isPrivateWiki = !$services->getPermissionManager()->isEveryoneAllowed( 'read' );
return new VisualEditorParsoidClientFactory(
new ServiceOptions(
VisualEditorParsoidClientFactory::CONSTRUCTOR_OPTIONS,
$services->getMainConfig(),
[
VisualEditorParsoidClientFactory::ENABLE_COOKIE_FORWARDING => $isPrivateWiki
]
),
$services->getParsoidSiteConfig(),
$services->getParsoidPageConfigFactory(),
$services->getParsoidDataAccess(),
$services->getGlobalIdGenerator(),
$services->getHttpRequestFactory()
);
},
];