Skip to content

Fix GraphQL node loading for duplicate identifiers and add cms block content#396

Open
sashagfu wants to merge 1 commit intoSnowdogApps:developfrom
sashagfu:feature/graphql-cms-block-and-menu-id
Open

Fix GraphQL node loading for duplicate identifiers and add cms block content#396
sashagfu wants to merge 1 commit intoSnowdogApps:developfrom
sashagfu:feature/graphql-cms-block-and-menu-id

Conversation

@sashagfu
Copy link
Copy Markdown

@sashagfu sashagfu commented Mar 9, 2026

Summary
This PR improves GraphQL support for menu nodes in two areas:

  • adds support for cms_block node content
  • fixes node loading for multi-store setups by loading nodes by resolved menu_id

Why
In multi-store Magento setups, different menus may use the same identifier across stores. The GraphQL resolver correctly resolves the menu in the current store context first,
but then loads nodes again by identifier. This may return nodes from other menus that share the same identifier.

Also, cms_block nodes currently do not return rendered block content in GraphQL.

Changes

  • register cms_block in GraphQL TypeModel
  • load CMS block data through Snowdog\Menu\Model\ResourceModel\NodeType\CmsBlock
  • render CMS block content with FilterProvider before returning it in GraphQL
  • keep url_key unchanged for cms_block nodes
  • replace getByIdentifier() with getByMenu() after resolving the menu entity

Validation
Validated manually in a real Magento project:

  • cms_block nodes return rendered content in GraphQL
  • GraphQL returns nodes only for the resolved menu in the current store context, even when other stores use the same menu identifier

@sashatkachukv
Copy link
Copy Markdown

Related Issue #397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants