Add hook interfaces which were generated by a script which parses
hooks.txt and identifies caller namespaces and directories.
Hook interfaces are mostly placed in a Hook/ subdirectory
relative to the caller location. When there are callers in multiple
directories, a "primary" caller was manually selected. The exceptions to
this are:
* The source root, maintenance and tests, which use includes/Hook. Test
hooks need to be autoloadable in a non-test request so that
implementing test interfaces in a generic handler will not fail.
* resources uses includes/resourceloader/Hook
* The following third-level subdirectories had their hooks placed in
the parent ../Hook:
* includes/filerepo/file
* includes/search/searchwidgets
* includes/specials/forms
* includes/specials/helpers
* includes/specials/pagers
Parameters marked as legacy references in hooks.txt are passed
by value in the interfaces.
Bug: T240307
Change-Id: I6efe2e7dd1f0c6a3d0f4d100a4c34e41f8428720
28 lines
1 KiB
PHP
28 lines
1 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Hook;
|
|
|
|
/**
|
|
* @stable for implementation
|
|
* @ingroup Hooks
|
|
*/
|
|
interface ParserSectionCreateHook {
|
|
/**
|
|
* Called each time the parser creates a document section
|
|
* from wikitext. Use this to apply per-section modifications to HTML (like
|
|
* wrapping the section in a DIV). Caveat: DIVs are valid wikitext, and a DIV
|
|
* can begin in one section and end in another. Make sure your code can handle
|
|
* that case gracefully. See the EditSectionClearerLink extension for an example.
|
|
*
|
|
* @since 1.35
|
|
*
|
|
* @param ?mixed $parser the calling Parser instance
|
|
* @param ?mixed $section the section number, zero-based, but section 0 is usually empty
|
|
* @param ?mixed &$sectionContent ref to the content of the section. modify this.
|
|
* @param ?mixed $showEditLinks boolean describing whether this section has an edit link
|
|
* @return bool|void True or no return value to continue or false to abort
|
|
*/
|
|
public function onParserSectionCreate( $parser, $section, &$sectionContent,
|
|
$showEditLinks
|
|
);
|
|
}
|