Files
wyczarujprezent.pl/modules/anblog/upgrade/install-3.2.0.php
2025-07-03 20:56:08 +02:00

54 lines
1.2 KiB
PHP

<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_2_0($object)
{
$tabs = [
[
'class_name' => 'AdminAnblogSettings',
'parent' => 'AdminAnblogManagement',
'name' => 'Settings',
'active' => 1
],
];
$languages = Language::getLanguages();
foreach ($tabs as $tab) {
$_tab = new Tab();
$_tab->active = $tab['active'];
$_tab->class_name = $tab['class_name'];
$_tab->id_parent = Tab::getIdFromClassName($tab['parent']);
if (empty($_tab->id_parent)) {
$_tab->id_parent = 0;
}
$_tab->module = 'anblog';
foreach ($languages as $language) {
$_tab->name[$language['id_lang']] = $tab['name'];
}
$_tab->add();
}
$id_tab = Tab::getIdFromClassName('AdminAnblogDashboard');
if ($id_tab != 0) {
$tab = new Tab($id_tab);
$tab->delete();
}
return true;
}