This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » eZ Publish 5 Platform » Call a (legacy) module in controller...

Call a (legacy) module in controller (to make a redirection depending on its results)

Call a (legacy) module in controller (to make a redirection depending on its results)

Monday 08 December 2014 4:32:44 pm - 2 replies


I use a (legacy) module displaying a form and I need to add a redirection depending on results calculated by this module.
As I am using module fallback inside the template:

 {{ render( url( 'ez_legacy', {'module_uri': '/myFormModule/myAction'} ) ) }}

as described in documentation ( I can't make a redirection in it.


So I would like to call this module in my controller (not in template) and redirect when myFormModule finds errors.
I've tried by using this on my controller :

public function myAction(){
    return $this->getLegacyKernel()->runCallback(
        function ()
            return eZFunctionHandler::execute(

But it doesn't work and I have 2 informations to guide by :

  • my page displaying "The controller must return a response (null given). Did you forget to add a return statement somewhere in your controller?"
  • and errors.log containing:
[ ~~~~~~~ ] eZModuleFunctionInfo::loadDefinition:
Missing function definition file for module: myFormModule
[ ~~~~~~~ ] eZFunctionHandler::execute:
Cannot execute function 'myAction' in module 'myFormModule', no valid data


Do you have any idea ?

Do I need to use this or something else ?

$module = eZModule::findModule( 'myFormModule' );

Modified on Monday 08 December 2014 4:34:28 pm by Nicolas Cordonnier

Thursday 08 January 2015 10:01:58 am

It would seem that there was a cache issue, resolved by a cleaning cache.

Friday 11 September 2015 5:56:28 am

You must create, the function definition file, which should contains the method you try to execute, this is way the log error log says: "Missing function definition file for module: myFormModule"


1. Below this path create two files



$FunctionList = array();
$FunctionList['myAction'] = array('name'=>'myAction',
'operation_types' => array( 'read' ),
'call_method' => array( 'class' => 'myFormModuleFunctionCollection',
'include_file' => 'extension/app/modules/myformmodule/functioncollection.php',
'method' => 'myAction' ),
'parameter_type' => 'standard',
'parameters' =>array());


class myFormModuleFunctionCollection
function myAction()
// Your logic staff here
$response = array( 'result' => $_POST );
return $response;

Modified on Friday 11 September 2015 6:04:28 am by Diego Amaya


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from