Skip to content

block hierarchy and settings #98

@dgpalmer

Description

@dgpalmer

It is unfortunate that in this current implementation of theme blocks, that we cannot pass parameters to dynamic blocks, such as settings from the parent block. It is especially frustrating that a parent block, cannot read it's children block settings.

With section blocks, you could do clever things like filtering for a certain block type, and then passing that block to another block to accommodate that use case. Some high level examples:

Here is an example of when you may need to do that.

Let's say you have a large catalog shop and a "Mega Menu" with 3 tiers of navigation. See this example from nordstrom.com (This is not my site, it is just an example)

Image

You can see there are unique "promo" cards under parent level menu. In order to do this with shopify's navigation structure, it's best to have a "panel block" that gets assigned to a menu index. With me so far?

In a nested block world, it would be lovely to put those cards inside of the panel, that's a great use case for a nested theme block. That would work fine.

The struggle though is accessing that setting for the index in the panel, through the new theme blocks. In the existing section blocks approach, I can simply filter for my mega menu panel blocks and then loop through my menu, and render the appropriate panel for the appropriate index.

Keep in mind that we have a parent level navigation block that controls logic of what type of menu to render and all that fun stuff.

tldr; it would be nice if parent & children nested blocks could access one another's settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions