| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | /** |
| 6 | * This is a hook handler interface, see docs/Hooks.md. |
| 7 | * Use the hook name "ParserOptionsRegister" to register handlers implementing this interface. |
| 8 | * |
| 9 | * @stable to implement |
| 10 | * @ingroup Hooks |
| 11 | */ |
| 12 | interface ParserOptionsRegisterHook { |
| 13 | /** |
| 14 | * Use this hook to register additional parser options. Note that if you |
| 15 | * change the default value for an option, all existing parser cache entries will |
| 16 | * be invalid. To avoid bugs, you'll need to handle that somehow (e.g. with the |
| 17 | * RejectParserCacheValue hook) because MediaWiki won't do it for you. |
| 18 | * |
| 19 | * @since 1.35 |
| 20 | * |
| 21 | * @param array &$defaults Set the default value for your option here |
| 22 | * @param array &$inCacheKey To fragment the parser cache on your option, set a truthy value |
| 23 | * in this array, with the key being the option name. |
| 24 | * @param array &$lazyLoad To lazy-initialize your option, set it null in $defaults and set a |
| 25 | * callable in this array, with the key being the option name. The callable is passed |
| 26 | * the ParserOptions object and the option name. |
| 27 | * @return bool|void True or no return value to continue or false to abort |
| 28 | */ |
| 29 | public function onParserOptionsRegister( &$defaults, &$inCacheKey, &$lazyLoad ); |
| 30 | } |