mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Merge "Allow hook implementations to modify params"
This commit is contained in:
commit
4bd4410b7b
|
@ -24,8 +24,9 @@ interface VisualEditorApiVisualEditorEditPreSaveHook {
|
|||
* @param ProperPageIdentity $page The page identity of the title used in the save attempt.
|
||||
* @param UserIdentity $user User associated with the save attempt.
|
||||
* @param string $wikitext The wikitext used in the save attempt.
|
||||
* @param array $params The params passed by the client in the API request. See
|
||||
* ApiVisualEditorEdit::getAllowedParams()
|
||||
* @param array &$params The params passed by the client in the API request. See
|
||||
* ApiVisualEditorEdit::getAllowedParams(). Note that these params are then passed on to ApiEditPage, so
|
||||
* the array is modifiable in case the hook implementer needs to adjust any of the parameters.
|
||||
* @param array $pluginData Associative array containing additional data specified by plugins, where the keys of
|
||||
* the array are plugin names, and the value are arbitrary data. Plugins are expected to be in a one-to-one
|
||||
* correlation with hook handlers and can be specified via the 'plugins' and 'data-*' parameters of the API.
|
||||
|
@ -44,7 +45,7 @@ interface VisualEditorApiVisualEditorEditPreSaveHook {
|
|||
ProperPageIdentity $page,
|
||||
UserIdentity $user,
|
||||
string $wikitext,
|
||||
array $params,
|
||||
array &$params,
|
||||
array $pluginData,
|
||||
array &$apiResponse
|
||||
);
|
||||
|
|
|
@ -40,7 +40,7 @@ class VisualEditorHookRunner implements
|
|||
ProperPageIdentity $page,
|
||||
UserIdentity $user,
|
||||
string $wikitext,
|
||||
array $params,
|
||||
array &$params,
|
||||
array $pluginData,
|
||||
array &$apiResponse
|
||||
) {
|
||||
|
@ -48,7 +48,7 @@ class VisualEditorHookRunner implements
|
|||
$page,
|
||||
$user,
|
||||
$wikitext,
|
||||
$params,
|
||||
&$params,
|
||||
$pluginData,
|
||||
&$apiResponse
|
||||
], [ 'abortable' => true ] );
|
||||
|
|
|
@ -26,11 +26,12 @@ class VisualEditorHookRunnerTest extends MediaWikiUnitTestCase {
|
|||
$runner = new VisualEditorHookRunner( $container );
|
||||
|
||||
$apiResponse = [];
|
||||
$params = [];
|
||||
$result = $runner->onVisualEditorApiVisualEditorEditPreSave(
|
||||
PageIdentityValue::localIdentity( 0, 0, 'test' ),
|
||||
UserIdentityValue::newAnonymous( '' ),
|
||||
'',
|
||||
[],
|
||||
$params,
|
||||
[],
|
||||
$apiResponse
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue