Debian Codegraph @

extensions/VisualEditor/includes/VisualEditorHookRunner.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\VisualEditor;
4
5 /**
6 * VisualEditorHookRunner
7 *
8 * @file
9 * @ingroup Extensions
10 * @copyright 2011-2021 VisualEditor Team and others; see AUTHORS.txt
11 * @license MIT
12 */
13
14 use MediaWiki\HookContainer\HookContainer;
15 use MediaWiki\Output\OutputPage;
16 use MediaWiki\Page\ProperPageIdentity;
17 use MediaWiki\User\UserIdentity;
18 use Skin;
19
20 class VisualEditorHookRunner implements
21 VisualEditorApiVisualEditorEditPreSaveHook,
22 VisualEditorApiVisualEditorEditPostSaveHook,
23 VisualEditorBeforeEditorHook
24 {
25
26 private HookContainer $hookContainer;
27
28 public function __construct( HookContainer $hookContainer ) {
29 $this->hookContainer = $hookContainer;
30 }
31
32 /** @inheritDoc */
33 public function onVisualEditorApiVisualEditorEditPreSave(
34 ProperPageIdentity $page,
35 UserIdentity $user,
36 string $wikitext,
37 array &$params,
38 array $pluginData,
39 array &$apiResponse
40 ) {
41 return $this->hookContainer->run( 'VisualEditorApiVisualEditorEditPreSave', [
42 $page,
43 $user,
44 $wikitext,
45 &$params,
46 $pluginData,
47 &$apiResponse
48 ], [ 'abortable' => true ] );
49 }
50
51 /** @inheritDoc */
52 public function onVisualEditorApiVisualEditorEditPostSave(
53 ProperPageIdentity $page,
54 UserIdentity $user,
55 string $wikitext,
56 array $params,
57 array $pluginData,
58 array $saveResult,
59 array &$apiResponse
60 ): void {
61 $this->hookContainer->run( 'VisualEditorApiVisualEditorEditPostSave', [
62 $page,
63 $user,
64 $wikitext,
65 $params,
66 $pluginData,
67 $saveResult,
68 &$apiResponse
69 ], [ 'abortable' => false ] );
70 }
71
72 /** @inheritDoc */
73 public function onVisualEditorBeforeEditor(
74 OutputPage $output,
75 Skin $skin
76 ): bool {
77 return $this->hookContainer->run( 'VisualEditorBeforeEditor', [
78 $output,
79 $skin
80 ], [ 'abortable' => true ] );
81 }
82 }