| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Content\Hook; |
| 4 | |
| 5 | use MediaWiki\Title\Title; |
| 6 | |
| 7 | /** |
| 8 | * This is a hook handler interface, see docs/Hooks.md. |
| 9 | * Use the hook name "ContentModelCanBeUsedOn" to register handlers implementing this interface. |
| 10 | * |
| 11 | * @stable to implement |
| 12 | * @ingroup Hooks |
| 13 | */ |
| 14 | interface ContentModelCanBeUsedOnHook { |
| 15 | /** |
| 16 | * Use this hook to determine whether a content model can be used on a given page. |
| 17 | * This is especially useful to prevent some content models from being used in a |
| 18 | * certain location. |
| 19 | * |
| 20 | * @since 1.35 |
| 21 | * |
| 22 | * @param string $contentModel Content model ID |
| 23 | * @param Title $title |
| 24 | * @param bool &$ok Whether it is OK to use $contentModel on $title. |
| 25 | * Handler functions that modify $ok should generally return false to prevent |
| 26 | * the remaining hooks from further modifying $ok. |
| 27 | * @return bool|void True or no return value to continue or false to abort |
| 28 | */ |
| 29 | public function onContentModelCanBeUsedOn( $contentModel, $title, &$ok ); |
| 30 | } |