Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -319,12 +319,16 @@ |
320 | 320 | &$resultArr : data in this array will be added to the API result |
321 | 321 | |
322 | 322 | 'APIGetAllowedParams': use this hook to modify a module's parameters. |
323 | | -&$module: Module object |
| 323 | +&$module: ApiBase Module object |
324 | 324 | &$params: Array of parameters |
325 | 325 | |
| 326 | +'APIGetDescription': use this hook to modify a module's description |
| 327 | +&$module: ApiBase Module object |
| 328 | +&$desc: Array of descriptions |
| 329 | + |
326 | 330 | 'APIGetParamDescription': use this hook to modify a module's parameter |
327 | 331 | descriptions. |
328 | | -&$module: Module object |
| 332 | +&$module: ApiBase Module object |
329 | 333 | &$desc: Array of parameter descriptions |
330 | 334 | |
331 | 335 | 'APIQueryAfterExecute': after calling the execute() method of an |
Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -184,6 +184,7 @@ |
185 | 185 | up as a redirect to the linked page on Special:Whatlinkshere. |
186 | 186 | * (bug 32609) API: Move captchaid/captchaword of action=edit from core |
187 | 187 | to Captcha extension(s) |
| 188 | +* Added 'ApiGetDescription' hook. |
188 | 189 | |
189 | 190 | === Languages updated in 1.19 === |
190 | 191 | |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -235,7 +235,7 @@ |
236 | 236 | public function makeHelpMsg() { |
237 | 237 | static $lnPrfx = "\n "; |
238 | 238 | |
239 | | - $msg = $this->getDescription(); |
| 239 | + $msg = $this->getFinalDescription(); |
240 | 240 | |
241 | 241 | if ( $msg !== false ) { |
242 | 242 | |
— | — | @@ -510,6 +510,7 @@ |
511 | 511 | /** |
512 | 512 | * Get final list of parameters, after hooks have had a chance to |
513 | 513 | * tweak it as needed. |
| 514 | + * |
514 | 515 | * @return array or false |
515 | 516 | */ |
516 | 517 | public function getFinalParams() { |
— | — | @@ -519,8 +520,9 @@ |
520 | 521 | } |
521 | 522 | |
522 | 523 | /** |
523 | | - * Get final description, after hooks have had a chance to tweak it as |
| 524 | + * Get final parameter descriptions, after hooks have had a chance to tweak it as |
524 | 525 | * needed. |
| 526 | + * |
525 | 527 | * @return array |
526 | 528 | */ |
527 | 529 | public function getFinalParamDescription() { |
— | — | @@ -530,6 +532,18 @@ |
531 | 533 | } |
532 | 534 | |
533 | 535 | /** |
| 536 | + * Get final module description, after hooks have had a chance to tweak it as |
| 537 | + * needed. |
| 538 | + * |
| 539 | + * @return array |
| 540 | + */ |
| 541 | + public function getFinalDescription() { |
| 542 | + $desc = $this->getDescription(); |
| 543 | + wfRunHooks( 'ApiGetDescription', array( &$this, &$desc ) ); |
| 544 | + return $desc; |
| 545 | + } |
| 546 | + |
| 547 | + /** |
534 | 548 | * This method mangles parameter name based on the prefix supplied to the constructor. |
535 | 549 | * Override this method to change parameter name during runtime |
536 | 550 | * @param $paramName string Parameter name |
Index: trunk/phase3/includes/api/ApiParamInfo.php |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | function getClassInfo( $obj ) { |
115 | 115 | $result = $this->getResult(); |
116 | 116 | $retval['classname'] = get_class( $obj ); |
117 | | - $retval['description'] = implode( "\n", (array)$obj->getDescription() ); |
| 117 | + $retval['description'] = implode( "\n", (array)$obj->getFinalDescription() ); |
118 | 118 | $examples = (array)$obj->getExamples(); |
119 | 119 | $retval['examples'] = implode( "\n", $examples ); |
120 | 120 | $retval['version'] = implode( "\n", (array)$obj->getVersion() ); |