Skip to content

Commit

Permalink
Merge branch 'release/2.24.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Ortega committed Nov 28, 2023
2 parents 312fe91 + 0281410 commit 5f4e463
Show file tree
Hide file tree
Showing 44 changed files with 2,626 additions and 274 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
rules: {
'vue/html-indent': [2, 4],
'vue/component-definition-name-casing': [2, 'kebab-case'],
'vue/no-mutating-props': 1
'vue/no-mutating-props': 1,
'vue/multi-word-component-names': 1,
}
}
3 changes: 3 additions & 0 deletions Block/Adminhtml/Edit/Tab/Nodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Snowdog\Menu\Model\NodeTypeProvider;
use Snowdog\Menu\Model\VueProvider;

/**
* @api
*/
class Nodes extends Template implements TabInterface
{
const IMAGE_UPLOAD_URL = 'snowmenu/node/uploadimage';
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.24.0] - 2023-11-28
### Added
- Hyvä compatibility (DEV-101754)
### Changed
- Updated eslint version to `8.45.0` and `eslint-plugin-vue` to 9.15.1 (DEV-95002)
### Fixed
- Mobile nav sidebar (DEV-101802)
- Category Child and CMS block nodes shouldn't have image fields (DEV-94387)
- `custom_url` type node has empty `url_key` in GraphQl context (DEV-103670, [#302](https://github.com/SnowdogApps/magento2-menu/issues/302))
- Added BINARY collation to load menus by identifier (DEV-103752)

## [2.23.1] - 2023-07-28
### Fixed
- Fixed issue with closing } missing
Expand Down
4 changes: 4 additions & 0 deletions Model/GraphQl/Resolver/DataProvider/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class Node
const SUBMENU_TEMPLATE_FIELD = 'submenu_template';
const URL_KEY = 'url_key';

const NODE_TYPE_CUSTOM_URL = 'custom_url';

/**
* @var NodeRepositoryInterface
*/
Expand Down Expand Up @@ -148,6 +150,8 @@ private function getUrlKey(NodeInterface $node): ?string
}
$currentModel = $this->loadedModels[$node->getType()][$node->getContent()];
return $this->typeModel->getModelUrlKey($node->getType(), $currentModel);
} elseif ($node->getType() == self::NODE_TYPE_CUSTOM_URL) {
return $node->getContent();
} else {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion Model/Menu/NodeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function getByIdentifier($identifier)
$collection->addOrder('parent_id', AbstractCollection::SORT_ORDER_ASC);
$collection->addOrder('position', AbstractCollection::SORT_ORDER_ASC);
$collection->join(['menu' => 'snowmenu_menu'], 'main_table.menu_id = menu.menu_id', 'identifier');
$collection->addFilter('identifier', $identifier);
$collection->addFilter(new \Zend_Db_Expr('BINARY `identifier`'), $identifier);

return $collection->getItems();
}
Expand Down
5 changes: 4 additions & 1 deletion Model/MenuRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Snowdog\Menu\Model\ResourceModel\Menu\Collection;
use Snowdog\Menu\Model\ResourceModel\Menu\CollectionFactory;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class MenuRepository implements MenuRepositoryInterface
{
/** @var MenuFactory */
Expand Down Expand Up @@ -162,7 +165,7 @@ public function getList(SearchCriteriaInterface $criteria)
public function get($identifier, $storeId)
{
$collection = $this->collectionFactory->create();
$collection->addFilter('identifier', $identifier);
$collection->addFilter(new \Zend_Db_Expr('BINARY `identifier`'), $identifier);
$collection->addFilter('is_active', 1);
$collection->join(['stores' => 'snowmenu_store'], 'main_table.menu_id = stores.menu_id', 'store_id');
$collection->addFilter('store_id', $storeId);
Expand Down
32 changes: 32 additions & 0 deletions Observer/RegisterModuleForHyvaConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Snowdog\Menu\Observer;

use Magento\Framework\Component\ComponentRegistrar;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class RegisterModuleForHyvaConfig implements ObserverInterface
{
private $componentRegistrar;

public function __construct(ComponentRegistrar $componentRegistrar)
{
$this->componentRegistrar = $componentRegistrar;
}

public function execute(Observer $event)
{
$config = $event->getData('config');
$extensions = $config->hasData('extensions') ? $config->getData('extensions') : [];

$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, 'Snowdog_Menu');

// Only use the path relative to the Magento base dir
$extensions[] = ['src' => substr($path, strlen(BP) + 1)];

$config->setData('extensions', $extensions);
}
}
57 changes: 29 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# Magento 2 Menu
![Static Badge](https://img.shields.io/badge/compatible-compatible?style=for-the-badge&label=Hyv%C3%A4&labelColor=%230A144B&color=%230A23B9%20)
[![Packagist](https://img.shields.io/packagist/v/snowdog/module-menu?style=for-the-badge)](https://packagist.org/packages/snowdog/module-menu)
[![Packagist](https://img.shields.io/packagist/dt/snowdog/module-menu?style=for-the-badge)](https://packagist.org/packages/snowdog/module-menu)
[![Packagist](https://img.shields.io/packagist/dm/snowdog/module-menu?style=for-the-badge)](https://packagist.org/packages/snowdog/module-menu)

# Magento 2 Menu
Provides powerful menu editor to replace category based menus in Magento 2.

## Setup
1. Create new menu in the admin area `Content > Elements > Menus`.
2. Add new block to the layout, using the same ID as in the admin area.
```xml
<block name="block-name" class="Snowdog\Menu\Block\Menu">
<arguments>
<argument name="menu" xsi:type="string">menu-id</argument>
</arguments>
</block>
```
3. Use created block in the template
```php
<?= $block->getChildHtml('block-name') ?>
```

### This module doesn't provide ready to use UI
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.

You can use themes or extensions build on top of this module if you are looking for something taht works out of the box:
- [Snowdog Alpaca theme](https://github.com/SnowdogApps/magento2-alpaca-theme)
- [RedChamps Luma theme support](https://github.com/redchamps/snowdog-menu-luma-support)
- [Victor Seager's Luma theme support](https://github.com/vseager/magento2-snowdog-menu-luma)

## Docs
Please check [wiki](https://github.com/SnowdogApps/magento2-menu/wiki) for more.
**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.
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.

![snowdog-magento-2-menu-admin-configuartio](https://github.com/SnowdogApps/magento2-menu/assets/49198312/102b4d2a-7d06-48a4-9f99-37a17faae0f7)


## Use Cases
Here are some scenarios where Snowdog's Menu can be effectively used:
* **Create Separate Header Menus for Mobile and Desktop:** Optimize navigation for customers on different devices by creating distinct header menus for mobile and desktop.
* **Create Footer Menu:** Improve the management of footer links.
* **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.

## Key Features
* **Flexible Content:** Add various types of elements to menus, such as links, images, and CMS blocks.
* **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.
* **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.
* **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.
* **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.

## User Guide and Documentation
To learn more about Magento 2 Menu by Snowdog, go to [wiki](https://github.com/SnowdogApps/magento2-menu/wiki).

## Contributing
Contributions are welcome! If you find a bug or have a feature request, feel free to open an issue or submit a pull request.

## Like this project?
We'd appreciate it if you leave a ⭐ or share it with the world ✨.
7 changes: 7 additions & 0 deletions etc/frontend/events.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"
>
<event name="hyva_config_generate_before">
<observer name="Snowdog_Menu" instance="Snowdog\Menu\Observer\RegisterModuleForHyvaConfig"/>
</event>
</config>
Loading

0 comments on commit 5f4e463

Please sign in to comment.