| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Content\Hook; |
| 4 | |
| 5 | use MediaWiki\Content\Content; |
| 6 | |
| 7 | /** |
| 8 | * This is a hook handler interface, see docs/Hooks.md. |
| 9 | * Use the hook name "ConvertContent" to register handlers implementing this interface. |
| 10 | * |
| 11 | * @stable to implement |
| 12 | * @ingroup Hooks |
| 13 | */ |
| 14 | interface ConvertContentHook { |
| 15 | /** |
| 16 | * This hook is called by AbstractContent::convert when a conversion to another content model |
| 17 | * is requested. Handler functions that modify $result should generally return false to disable |
| 18 | * further attempts at conversion. |
| 19 | * |
| 20 | * @since 1.35 |
| 21 | * |
| 22 | * @param Content $content Content object to be converted |
| 23 | * @param string $toModel ID of the content model to convert to |
| 24 | * @param bool $lossy Whether lossy conversion is allowed |
| 25 | * @param Content|false &$result Output parameter, in case the handler function wants to |
| 26 | * provide a converted Content object. Note that $result->getContentModel() must return |
| 27 | * $toModel. |
| 28 | * @return bool|void True or no return value to continue or false to abort |
| 29 | */ |
| 30 | public function onConvertContent( $content, $toModel, $lossy, &$result ); |
| 31 | } |