$formId = (int) $params->get('formid', 1);
$rowid = (int) $params->get('row_id', 0);
$layout = $params->get('template', '');
$usersConfig = JComponentHelper::getParams('com_fabrik');
$usersConfig->set('rowid', $rowid);
$moduleclass_sfx = $params->get('moduleclass_sfx', '');
$moduleAjax = $params->get('formmodule_useajax', true);
$origView = $input->get('view');
$input->set('formid', $formId);
$input->set('view', 'form');
$controller = new FabrikControllerForm();
/*
 * For table views in category blog layouts when no layout specified in {} the blog layout
 * was being used to render the table - which was not found which gave a 500 error
 */
if ($layout !== '') {
    $input->set('layout', $layout);
}
// Display the view
$controller->isMambot = true;
$controller->set('cacheId', 'admin_module');
$origFormid = $input->getInt('formid');
$ajax = $input->get('ajax');
$input->set('formid', $params->get('formid'));
$input->set('ajax', $moduleAjax);
echo $controller->view();
// Reset the layout and view etc for when the component needs them
$input->set('formid', $origFormid);
$input->set('ajax', $ajax);
$input->set('layout', $origLayout);
$input->set('view', $origView);