Skip to content

Commit 173ea0d

Browse files
authored
Merge pull request #70 from bibips/add-hook-displaymainmenu
2 parents d49c1d1 + ff78da0 commit 173ea0d

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-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: 10 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

@@ -136,7 +136,10 @@ public function installDb()
136136
`label` VARCHAR( 128 ) NOT NULL ,
137137
`link` VARCHAR( 128 ) NOT NULL ,
138138
INDEX ( `id_linksmenutop` , `id_lang`, `id_shop`)
139-
) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8mb4;');
139+
) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8mb4;') &&
140+
Db::getInstance()->execute('
141+
INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook` (`name`, `title`, `description`) VALUES
142+
(\'actionMainMenuModifier\', \'Modify main menu view data\', \'This hook allows to alter main menu data\');');
140143
}
141144

142145
public function uninstall($delete_params = true)
@@ -1489,8 +1492,12 @@ public function getWidgetVariables($hookName, array $configuration)
14891492

14901493
public function renderWidget($hookName, array $configuration)
14911494
{
1495+
$menu = $this->getWidgetVariables($hookName, $configuration);
1496+
1497+
Hook::exec('actionMainMenuModifier', ['menu' => &$menu]);
1498+
14921499
$this->smarty->assign([
1493-
'menu' => $this->getWidgetVariables($hookName, $configuration),
1500+
'menu' => $menu,
14941501
]);
14951502

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

upgrade/upgrade-2.3.5.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 license@prestashop.com so we can send you a copy immediately.
15+
*
16+
* @author PrestaShop SA <contact@prestashop.com>
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+
}

0 commit comments

Comments
 (0)