Manual:Hooks/UploadForm:BeforeProcessing

From Linux Web Expert

UploadForm:BeforeProcessing
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
Called just before the upload data, like wpUploadDescription, are processed, so extensions get a chance to manipulate them.
<translate> Define function:</translate>
public static function onUploadForm_BeforeProcessing( SpecialUpload $uploadFormObj ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UploadForm:BeforeProcessing": "MediaWiki\\Extension\\MyExtension\\Hooks::onUploadFormBeforeProcessing"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> specials/SpecialUpload.php
<translate> Interface:</translate> UploadForm_BeforeProcessingHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:UploadForm:BeforeProcessing extensions</tvar>.</translate>

Details

  • $uploadFormObj: current SpecialUpload object

The hook function must return true (or at least something which doesn't evaluate as false). Otherwise, nothing happens, without any message to the user (unless the hook function itself takes care of that).