/** * Get an instance of a ModuleFrontController * * @param string $controller The name of the controller, it must be declared in your module * * @return ModuleFrontController Instance of the controller */ public function getModuleFrontControllerInstance($controller) { // Check this controller is allowed if (!in_array($controller, $this->controllers)) { throw new PrestaShopException(sprintf('This controller %s is not declared in this module', Tools::safeOutput($controller))); } // Include the controller file require_once __DIR__ . '/controllers/front/' . $controller . '.php'; // Build dynamically the controller name $controller_name = $controller . 'ModuleFrontController'; // Instantiate controller $controller = new $controller_name(); // Return the controller return $controller; } public function weirdFunction() { $controller = $this->getModuleFrontControllerInstance('myFrontController'); return $controller->myOwnProcessInModuleFrontController(); }
Try somethings like that