Skip to content

Commit c81a1af

Browse files
authored
Merge pull request #84 from PrestaShop/dev
Release 2.3.5
2 parents d6c0dfd + 1d8e881 commit c81a1af

File tree

3 files changed

+46
-4
lines changed

3 files changed

+46
-4
lines changed

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module>
33
<name>ps_mainmenu</name>
44
<displayName><![CDATA[Main menu]]></displayName>
5-
<version><![CDATA[2.3.4]]></version>
5+
<version><![CDATA[2.3.5]]></version>
66
<description><![CDATA[Adds a new menu to the top of your e-commerce website.]]></description>
77
<author><![CDATA[PrestaShop]]></author>
88
<tab><![CDATA[front_office_features]]></tab>

ps_mainmenu.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __construct()
6969
{
7070
$this->name = 'ps_mainmenu';
7171
$this->tab = 'front_office_features';
72-
$this->version = '2.3.4';
72+
$this->version = '2.3.5';
7373
$this->author = 'PrestaShop';
7474
$this->imageFiles = null;
7575

@@ -100,6 +100,7 @@ public function install($delete_params = true)
100100
!$this->registerHook('actionObjectProductDeleteAfter') ||
101101
!$this->registerHook('actionObjectProductAddAfter') ||
102102
!$this->registerHook('actionCategoryUpdate') ||
103+
!$this->registerHook('actionMetaPageSave') ||
103104
!$this->registerHook('actionShopDataDuplication') ||
104105
!$this->registerHook('displayTop')) {
105106
return false;
@@ -136,7 +137,10 @@ public function installDb()
136137
`label` VARCHAR( 128 ) NOT NULL ,
137138
`link` VARCHAR( 128 ) NOT NULL ,
138139
INDEX ( `id_linksmenutop` , `id_lang`, `id_shop`)
139-
) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8mb4;');
140+
) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8mb4;') &&
141+
Db::getInstance()->execute('
142+
INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook` (`name`, `title`, `description`) VALUES
143+
(\'actionMainMenuModifier\', \'Modify main menu view data\', \'This hook allows to alter main menu data\');');
140144
}
141145

142146
public function uninstall($delete_params = true)
@@ -987,6 +991,11 @@ public function hookActionCategoryUpdate($params)
987991
$this->clearMenuCache();
988992
}
989993

994+
public function hookActionMetaPageSave($params)
995+
{
996+
$this->clearMenuCache();
997+
}
998+
990999
protected function getCacheDirectory()
9911000
{
9921001
$dir = _PS_CACHE_DIR_ . 'ps_mainmenu';
@@ -1489,8 +1498,12 @@ public function getWidgetVariables($hookName, array $configuration)
14891498

14901499
public function renderWidget($hookName, array $configuration)
14911500
{
1501+
$menu = $this->getWidgetVariables($hookName, $configuration);
1502+
1503+
Hook::exec('actionMainMenuModifier', ['menu' => &$menu]);
1504+
14921505
$this->smarty->assign([
1493-
'menu' => $this->getWidgetVariables($hookName, $configuration),
1506+
'menu' => $menu,
14941507
]);
14951508

14961509
return $this->fetch('module:ps_mainmenu/ps_mainmenu.tpl');

upgrade/upgrade-2.3.5.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright since 2007 PrestaShop SA and Contributors
4+
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
5+
*
6+
* NOTICE OF LICENSE
7+
*
8+
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
9+
* that is bundled with this package in the file LICENSE.md.
10+
* It is also available through the world-wide-web at this URL:
11+
* https://opensource.org/licenses/AFL-3.0
12+
* If you did not receive a copy of the license and are unable to
13+
* obtain it through the world-wide-web, please send an email
14+
* to [email protected] so we can send you a copy immediately.
15+
*
16+
* @author PrestaShop SA <[email protected]>
17+
* @copyright Since 2007 PrestaShop SA and Contributors
18+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
19+
*/
20+
if (!defined('_PS_VERSION_')) {
21+
exit;
22+
}
23+
24+
function upgrade_module_2_3_5($module)
25+
{
26+
return Db::getInstance()->execute('INSERT IGNORE INTO `' . _DB_PREFIX_ . "hook` (`name`, `title`, `description`) VALUES
27+
('actionMainMenuModifier', 'Modify main menu view data', 'This hook allows to alter main menu data')")
28+
&& $module->registerHook('actionMetaPageSave');
29+
}

0 commit comments

Comments
 (0)