Manual:Hooks/EditFormPreloadText
From MediaWiki.org
| EditFormPreloadText | |
|---|---|
| Available from version 1.7.0 Called when edit page for new article is shown |
|
*Define function: |
function fnMyHook(&$text, &$title) { ... }
|
*Attach hook: |
$wgHooks['EditFormPreloadText'][] = 'fnMyHook'; |
| Called from: | 1.7+ - EditPage.php: EditPage::edit() |
*For more information about attaching hooks, see Manual:Hooks.
*For examples of extensions using this hook, see Category:EditFormPreloadText extensions.
[edit] Details
- $text: text to prefill edit form with
- $title: title of new page (Title Object)
[edit] Example
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;
}

