Manual:Hooks/ParserSectionCreate
From MediaWiki.org
| ParserSectionCreate | |
|---|---|
| Available from version 1.19.0 (r92506) Called each time the parser creates a document section from wikitext. |
|
Define function: |
public static function onParserSectionCreate( $parser, $section, &$sectionContent, $showEditLinks ) { ... }
|
Attach hook: |
$wgHooks['ParserSectionCreate'][] = 'MyExtensionHooks::onParserSectionCreate'; |
| Called from: | Parser.php |
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:ParserSectionCreate extensions.
[edit] Details
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.
- $parser: the calling Parser instance
- $section: the section number, zero-based, but section 0 is usually empty
- &$sectionContent: ref to the content of the section. modify this.
- $showEditLinks: boolean describing whether this section has an edit link