Commit graph

2 commits

Author SHA1 Message Date
Kosta Harlan 9241add01e Allow hook implementations to modify params
This is needed because the $params array is then passed on to
ApiEditPage, so if the hook implementer wants to alter the data used
with the edit, it needs to be able to modify the $params.

See I494d72a42d9103c28c4d44077cfe0f1269fc7b00 for an example where
GrowthExperiments would like to modify the 'tags' parameter for an
edit.

Depends-On: Idd052281898f99e4f13f241d5633294b59b29329
Bug: T304747
Change-Id: Ia4842a1593028f5fa145de167ccf9b72efa81351
2022-03-29 11:31:30 +00:00
Kosta Harlan b973ff3ee3 Introduce VisualEditorApiVisualEditorPreSaveHook
What:

Add a hook that runs before a save attempt is made in
ApiVisualEditorEdit. The hook receives the same data available in
ApiVisualEditorEdit, and implementations of the hook can modify the API
response.

Why:

VE plugins may send additional data when saving an edit, and extensions
might want to prevent the save from taking place based on that
additional data.

See for example the AddLink plugin in Ic8225933c9, where the save is
blocked if link suggestions don't exist in the database at save time.

Bug: T283109
Change-Id: I6b81ea318f52ec47661086d85b5cc242a3fcd0e4
2021-08-18 09:39:00 +02:00