Here's the function I use in my Image/Video Gallery module (modules/nc_gallery/nc_gallery.php):
public function hookDisplayAdminProductsExtra($params)
{
if (isset($params['id_product']) && (int)$params['id_product']) {
$controller = new AdminNCGalleryGalleriesController();
$this->context->smarty->assign('form', $controller->renderProductForm((int)$params['id_product']));
return $this->display(__FILE__, 'views/templates/admin/tab.tpl');
}
}
And a simplified version of the renderProductForm function that displays a multi-language text field on the configuration page (modules/nc_gallery/controllers/admin/AdminNCGalleryGalleriesController.php):
public function renderProductForm($id_product) { if ((int)$id_product <= 0) { return; } $fields_value = []; $product_tab = null; $id_product_tab = (int)NCGalleryProductTab::getTabForProduct((int)$id_product); if ($id_product_tab) { $product_tab = new NCGalleryProductTab((int)$id_product_tab); $fields_value['nc_gallery_name'] = []; foreach (Language::getLanguages(false) as $language) { if (is_array($product_tab->name) && isset($product_tab->name[(int)$language['id_lang']]) && $product_tab->name[(int)$language['id_lang']] != '') { $fields_value['nc_gallery_name'][(int)$language['id_lang']] = $product_tab->name[$language['id_lang']]; } else { $fields_value['nc_gallery_name'][(int)$language['id_lang']] = Configuration::get('NC_GALLERY_DEFAULT_TAB_TITLE', (int)$language['id_lang']); } } } else { foreach (Language::getLanguages(false) as $language) { $fields_value['nc_gallery_name'][(int)$language['id_lang']] = Configuration::get('NC_GALLERY_DEFAULT_TAB_TITLE', (int)$language['id_lang']); } } $this->fields_form = [ 'input' => [ [ 'type' => 'text', 'label' => $this->l('Title'), 'name' => 'nc_gallery_name', 'hint' => $this->l('The tab text displayed on the product page'), 'required' => true, 'lang' => true, 'class' => 'form-control', ], ], ]; $this->fields_form = [['form' => $this->fields_form]]; $helper = new HelperForm($this); $this->setHelperDisplay($helper); $helper->languages = Language::getLanguages(); $helper->default_form_language = (int)Configuration::get('PS_LANG_DEFAULT'); $helper->fields_value = $fields_value; $helper->submit_action = $this->submit_action; $helper->tpl_vars = $this->getTemplateFormVars(); return $helper->generateForm($this->fields_form); }
And in modules/nc_gallery/views/templates/admin/tab.tpl:
<input type="hidden" name="submitted_tabs[]" value="nc_gallery" /> {$form}
I hope this helps.