Page MenuHomePhabricator

getAllowedParams() and friends should have hooks
Closed, ResolvedPublic

Description

...so extensions can add parameters cleanly. One generic hook that passes a reference to the module is probably best.


Version: 1.14.x
Severity: enhancement

Details

Reference
bz15359

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:19 PM
bzimport set Reference to bz15359.

Created attachment 5225
Implement ApiParams Hook

Basic implementation of an ApiParams hook. All uses calling getAllowedParams() have been updated to calling getFinalParams instead, which gives the hook a chance to play with the paramters (add/remove) as needed.

attachment diff.patch ignored as obsolete

(In reply to comment #1)

Created an attachment (id=5225) [details]
Implement ApiParams Hook

Basic implementation of an ApiParams hook. All uses calling getAllowedParams()
have been updated to calling getFinalParams instead, which gives the hook a
chance to play with the paramters (add/remove) as needed.

Stuff that's wrong with the patch:

  • wfRunHooks() expects an array as its second argument
  • $params should be passed as a reference
  • hooks.txt needs to be updated
  • You probably want other hooks in functions like getParamDescriptions() too (that's what I meant by "and friends")

Created attachment 5297
Improved patch

Improved stuff here and there and added a hook for getParamDescription() too

Attached: