// Fix AdminTranslationsController::addNewTabs()
This commit is contained in:
@@ -581,24 +581,28 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
if (preg_match('#^translations\/'.$iso_code.'\/tabs.php#Ui', $file['filename'], $matches) && Validate::isLanguageIsoCode($iso_code))
|
if (preg_match('#^translations\/'.$iso_code.'\/tabs.php#Ui', $file['filename'], $matches) && Validate::isLanguageIsoCode($iso_code))
|
||||||
{
|
{
|
||||||
// Include array width new translations tabs
|
// Include array width new translations tabs
|
||||||
$tabs = array();
|
$_TABS = array();
|
||||||
if (Tools::file_exists_cache(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']))
|
clearstatcache();
|
||||||
$tabs = include_once(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']);
|
if (file_exists(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']))
|
||||||
|
include_once(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']);
|
||||||
foreach ($tabs as $class_name => $translations)
|
|
||||||
|
if (count($_TABS))
|
||||||
{
|
{
|
||||||
// Get instance of this tab by class name
|
foreach ($_TABS as $class_name => $translations)
|
||||||
$tab = Tab::getInstanceFromClassName($class_name);
|
|
||||||
//Check if class name exists
|
|
||||||
if (isset($tab->class_name) && !empty($tab->class_name))
|
|
||||||
{
|
{
|
||||||
$id_lang = Language::getIdByIso($iso_code);
|
// Get instance of this tab by class name
|
||||||
$tab->name[(int)$id_lang] = $translations;
|
$tab = Tab::getInstanceFromClassName($class_name);
|
||||||
|
//Check if class name exists
|
||||||
|
if (isset($tab->class_name) && !empty($tab->class_name))
|
||||||
|
{
|
||||||
|
$id_lang = Language::getIdByIso($iso_code);
|
||||||
|
$tab->name[(int)$id_lang] = $translations;
|
||||||
|
|
||||||
if (!Validate::isGenericName($tab->name[(int)$id_lang]))
|
if (!Validate::isGenericName($tab->name[(int)$id_lang]))
|
||||||
$errors[] = sprintf(Tools::displayError('Tab "%s" is not valid'), $tab->name[(int)$id_lang]);
|
$errors[] = sprintf(Tools::displayError('Tab "%s" is not valid'), $tab->name[(int)$id_lang]);
|
||||||
else
|
else
|
||||||
$tab->update();
|
$tab->update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user