Manual:Hooks/EditFormPreloadText
From MediaWiki.org
| EditFormPreloadText | |
|---|---|
| Available from version 1.7.0 Called when edit page for new article is shown |
|
Define function: |
public static function onEditFormPreloadText( &$text, &$title ) { ... }
|
Attach hook: |
$wgHooks['EditFormPreloadText'][] = 'MyExtensionHooks::onEditFormPreloadText'; |
| Called from: | EditPage.php |
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:EditFormPreloadText extensions.
Details [edit]
- $text: text to prefill edit form with
- $title: title of new page (Title Object)
Example [edit]
To prefill page text when creating "A_New_Page" with "please enter text for A New Page"
$wgHooks['EditFormPreloadText'][] = array('prefill');
function prefill(&$textbox, &$title) {
$title_str = $title->getText();
$textbox = "please enter text for $title_str";
return true;
}
