mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 22:13:34 +00:00
f36572432b
This isolates this extension from knowledge about the constructor signature of the helper classes. Constructore signatures are not stable interfaces. Needed-By: Ie430acd0753880d88370bb9f22bb40a0f9ded917 Depends-On: I10af85b2da96568cfffd03867d1cb299645fb371 Change-Id: If1914dbfbefc3501b4d4cef4beb1fae307c36455
42 lines
1.1 KiB
PHP
42 lines
1.1 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\Logger\LoggerFactory;
|
|
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->getHttpRequestFactory(),
|
|
LoggerFactory::getInstance( 'VisualEditor' ),
|
|
$services->getPageRestHelperFactory()
|
|
);
|
|
},
|
|
];
|