Line 41: | Line 41: | ||
<code>$responseHandler->setReturnData( "Details information" );</code> | <code>$responseHandler->setReturnData( "Details information" );</code> | ||
− | on success you only have to return true. If you want to add a message that FlexForm should | + | on success you only have to return true. If you want to add a message that FlexForm should show, then you can do the following : |
<code>$responseHandler->setReturnType( HandleResponse::TYPE_SUCCESS);</code> | <code>$responseHandler->setReturnType( HandleResponse::TYPE_SUCCESS);</code> |
Revision as of 07:32, 27 May 2022
FFAfterFormHandling hook
When FlexForm
- is initiated with an extension
- is finished processing a submit and just before it will set notifications and return to the user
it (FlexForm) will first search for the extension in the extension folder. If it cannot find it, the FFAfterFormHandling Hook will run.
Allowing people to do additional actions with the information submitted by the Form.
function | public static function onFFAfterFormHandling( string $external, array $flexFormFields, HandleResponse &$responseHandler ) { ... }
|
hook | $wgHooks['FFAfterFormHandling'][] = 'MyExtensionHooks::onFFAfterFormHandling';
|
called from | FlexForm/src/Processors/Request/External.php. Method: runHook
|
The string $external will hold the name of the extension that was assigned to the form.
The array $flexFormFields
will be available and hold all submitted Form elements as name->value.
responseHandler function :
on error :
$responseHandler->setReturnType( HandleResponse::TYPE_ERROR );
$responseHandler->setReturnStatus( "Your general error info" );
$responseHandler->setReturnData( "Details information" );
on success you only have to return true. If you want to add a message that FlexForm should show, then you can do the following :
$responseHandler->setReturnType( HandleResponse::TYPE_SUCCESS);
$responseHandler->setReturnData( "Success information" );
Always return true;