Giter Site home page Giter Site logo

Comments (1)

theodesp avatar theodesp commented on May 31, 2024

Hello @studiohic. Thank you for the report.

After looking into this, I can see that this block is not a standard block that has queryable attributes. Its part of the Full-stack editing blocks that are generated dynamically per page.

If you look at the contents of a saved CoreNavigation block you will see that it contains only a reference:

<!-- wp:navigation {"ref":45} /-->

This means that by default it cannot be parsed using the parse_blocks function. It won't do anything.

One could try to fix this by retrieving the navigation model from the ref id (using https://developer.wordpress.org/reference/functions/wp_get_nav_menu_items/) and with adding Query Attributes that extract the menu items from the HTML or return the menu node so that users can query it.

Here is an example of how we do this with the MediaDetails attribute of the Image block

https://github.com/wpengine/wp-graphql-content-blocks/blob/main/includes/Blocks/CoreImage.php#L44-L69

Here is the block code that does this work maybe you can make a sense out of it:

https://github.com/WordPress/WordPress/blob/a4aeb7160325117db7eed9fb1277df95c1681273/wp-includes/blocks/navigation.php#L206-L231

from wp-graphql-content-blocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.