Skip to content

Commit 5f4e463

Browse files
author
Jose Ortega
committed
Merge branch 'release/2.24.0'
2 parents 312fe91 + 0281410 commit 5f4e463

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2626
-274
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
rules: {
66
'vue/html-indent': [2, 4],
77
'vue/component-definition-name-casing': [2, 'kebab-case'],
8-
'vue/no-mutating-props': 1
8+
'vue/no-mutating-props': 1,
9+
'vue/multi-word-component-names': 1,
910
}
1011
}

Block/Adminhtml/Edit/Tab/Nodes.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Snowdog\Menu\Model\NodeTypeProvider;
1212
use Snowdog\Menu\Model\VueProvider;
1313

14+
/**
15+
* @api
16+
*/
1417
class Nodes extends Template implements TabInterface
1518
{
1619
const IMAGE_UPLOAD_URL = 'snowmenu/node/uploadimage';

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [2.24.0] - 2023-11-28
11+
### Added
12+
- Hyvä compatibility (DEV-101754)
13+
### Changed
14+
- Updated eslint version to `8.45.0` and `eslint-plugin-vue` to 9.15.1 (DEV-95002)
15+
### Fixed
16+
- Mobile nav sidebar (DEV-101802)
17+
- Category Child and CMS block nodes shouldn't have image fields (DEV-94387)
18+
- `custom_url` type node has empty `url_key` in GraphQl context (DEV-103670, [#302](https://github.com/SnowdogApps/magento2-menu/issues/302))
19+
- Added BINARY collation to load menus by identifier (DEV-103752)
20+
1021
## [2.23.1] - 2023-07-28
1122
### Fixed
1223
- Fixed issue with closing } missing

Model/GraphQl/Resolver/DataProvider/Node.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class Node
2020
const SUBMENU_TEMPLATE_FIELD = 'submenu_template';
2121
const URL_KEY = 'url_key';
2222

23+
const NODE_TYPE_CUSTOM_URL = 'custom_url';
24+
2325
/**
2426
* @var NodeRepositoryInterface
2527
*/
@@ -148,6 +150,8 @@ private function getUrlKey(NodeInterface $node): ?string
148150
}
149151
$currentModel = $this->loadedModels[$node->getType()][$node->getContent()];
150152
return $this->typeModel->getModelUrlKey($node->getType(), $currentModel);
153+
} elseif ($node->getType() == self::NODE_TYPE_CUSTOM_URL) {
154+
return $node->getContent();
151155
} else {
152156
return null;
153157
}

Model/Menu/NodeRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function getByIdentifier($identifier)
157157
$collection->addOrder('parent_id', AbstractCollection::SORT_ORDER_ASC);
158158
$collection->addOrder('position', AbstractCollection::SORT_ORDER_ASC);
159159
$collection->join(['menu' => 'snowmenu_menu'], 'main_table.menu_id = menu.menu_id', 'identifier');
160-
$collection->addFilter('identifier', $identifier);
160+
$collection->addFilter(new \Zend_Db_Expr('BINARY `identifier`'), $identifier);
161161

162162
return $collection->getItems();
163163
}

Model/MenuRepository.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use Snowdog\Menu\Model\ResourceModel\Menu\Collection;
1414
use Snowdog\Menu\Model\ResourceModel\Menu\CollectionFactory;
1515

16+
/**
17+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18+
*/
1619
class MenuRepository implements MenuRepositoryInterface
1720
{
1821
/** @var MenuFactory */
@@ -162,7 +165,7 @@ public function getList(SearchCriteriaInterface $criteria)
162165
public function get($identifier, $storeId)
163166
{
164167
$collection = $this->collectionFactory->create();
165-
$collection->addFilter('identifier', $identifier);
168+
$collection->addFilter(new \Zend_Db_Expr('BINARY `identifier`'), $identifier);
166169
$collection->addFilter('is_active', 1);
167170
$collection->join(['stores' => 'snowmenu_store'], 'main_table.menu_id = stores.menu_id', 'store_id');
168171
$collection->addFilter('store_id', $storeId);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Snowdog\Menu\Observer;
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
use Magento\Framework\Event\Observer;
9+
use Magento\Framework\Event\ObserverInterface;
10+
11+
class RegisterModuleForHyvaConfig implements ObserverInterface
12+
{
13+
private $componentRegistrar;
14+
15+
public function __construct(ComponentRegistrar $componentRegistrar)
16+
{
17+
$this->componentRegistrar = $componentRegistrar;
18+
}
19+
20+
public function execute(Observer $event)
21+
{
22+
$config = $event->getData('config');
23+
$extensions = $config->hasData('extensions') ? $config->getData('extensions') : [];
24+
25+
$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, 'Snowdog_Menu');
26+
27+
// Only use the path relative to the Magento base dir
28+
$extensions[] = ['src' => substr($path, strlen(BP) + 1)];
29+
30+
$config->setData('extensions', $extensions);
31+
}
32+
}

README.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1+
# Magento 2 Menu
2+
![Static Badge](https://img.shields.io/badge/compatible-compatible?style=for-the-badge&label=Hyv%C3%A4&labelColor=%230A144B&color=%230A23B9%20)
13
[![Packagist](https://img.shields.io/packagist/v/snowdog/module-menu?style=for-the-badge)](https://packagist.org/packages/snowdog/module-menu)
24
[![Packagist](https://img.shields.io/packagist/dt/snowdog/module-menu?style=for-the-badge)](https://packagist.org/packages/snowdog/module-menu)
35
[![Packagist](https://img.shields.io/packagist/dm/snowdog/module-menu?style=for-the-badge)](https://packagist.org/packages/snowdog/module-menu)
46

5-
# Magento 2 Menu
6-
Provides powerful menu editor to replace category based menus in Magento 2.
7-
8-
## Setup
9-
1. Create new menu in the admin area `Content > Elements > Menus`.
10-
2. Add new block to the layout, using the same ID as in the admin area.
11-
```xml
12-
<block name="block-name" class="Snowdog\Menu\Block\Menu">
13-
<arguments>
14-
<argument name="menu" xsi:type="string">menu-id</argument>
15-
</arguments>
16-
</block>
17-
```
18-
3. Use created block in the template
19-
```php
20-
<?= $block->getChildHtml('block-name') ?>
21-
```
22-
23-
### This module doesn't provide ready to use UI
24-
Out of the box this module is not compatible with any theme, but in the same time you can use it with any theme, although you need to take care of the styling on your own.
25-
26-
You can use themes or extensions build on top of this module if you are looking for something taht works out of the box:
27-
- [Snowdog Alpaca theme](https://github.com/SnowdogApps/magento2-alpaca-theme)
28-
- [RedChamps Luma theme support](https://github.com/redchamps/snowdog-menu-luma-support)
29-
- [Victor Seager's Luma theme support](https://github.com/vseager/magento2-snowdog-menu-luma)
30-
31-
## Docs
32-
Please check [wiki](https://github.com/SnowdogApps/magento2-menu/wiki) for more.
7+
**Magento 2 Menu** by [Snowdog](https://snow.dog) is a **powerful menu configurator** that empowers online merchants to create advanced menus, enhancing their customers' shopping experience and improving SEO.
8+
This module serves as a feature-rich replacement for the category-based top navigation found in Magento and Adobe Commerce. However, it offers much more versatility by enabling the creation of menus for various purposes and store views.
9+
10+
![snowdog-magento-2-menu-admin-configuartio](https://github.com/SnowdogApps/magento2-menu/assets/49198312/102b4d2a-7d06-48a4-9f99-37a17faae0f7)
11+
12+
13+
## Use Cases
14+
Here are some scenarios where Snowdog's Menu can be effectively used:
15+
* **Create Separate Header Menus for Mobile and Desktop:** Optimize navigation for customers on different devices by creating distinct header menus for mobile and desktop.
16+
* **Create Footer Menu:** Improve the management of footer links.
17+
* **Create Custom Menus for Specific Pages:** Whether you need to add a sidebar menu or change the header menu, Snowdog's module offers you the flexibility to create and customize menus for any page of a Magento store.
18+
19+
## Key Features
20+
* **Flexible Content:** Add various types of elements to menus, such as links, images, and CMS blocks.
21+
* **Product Catalog Integration:** Easily include links to categories and products in menus. Our handy tree selector makes it a breeze to pick the exact categories you want to showcase, or you can opt for category-based import to add a chunk of your catalog tree to the menu with a few clicks.
22+
* **Drag and Drop Editor:** The module offers a user-friendly drag and drop editor, making it effortless to configure multi-level menus exactly how you envision them. Arrange and customize menu items with ease, without any coding knowledge.
23+
* **Import, Export and Duplicate Capabilities:** Save time and effort. This feature enables seamless replication of menus across different instances and Magento stores. It also gives an option to duplicate menus for faster setup and customization.
24+
* **Multiple Ways of Adding Menus to Frontend:** Easily add menus to your frontend using PHTML templates, or fetch the data from our REST and GraphQL APIs.
25+
26+
## User Guide and Documentation
27+
To learn more about Magento 2 Menu by Snowdog, go to [wiki](https://github.com/SnowdogApps/magento2-menu/wiki).
28+
29+
## Contributing
30+
Contributions are welcome! If you find a bug or have a feature request, feel free to open an issue or submit a pull request.
31+
32+
## Like this project?
33+
We'd appreciate it if you leave a ⭐ or share it with the world ✨.

etc/frontend/events.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"
3+
>
4+
<event name="hyva_config_generate_before">
5+
<observer name="Snowdog_Menu" instance="Snowdog\Menu\Observer\RegisterModuleForHyvaConfig"/>
6+
</event>
7+
</config>

0 commit comments

Comments
 (0)