Accessing parent blocks

Hello,

I have a block that needs contextual information about its parent block. I have read the wordpress documentation on block context but can’t really see how to apply this with Sage 10.

Anyone who have achieved this?

How are you registering blocks in your Sage 10 theme? Are you using a JSON file or something like acorn poet?

In any case, you would add the providesContext field with appropriate items to to the parent block configuration and usesContext to the designated child block configuration.
Then you can consume the context in the component (by adjusting edit and save).

heeey,
the renderCallback needs to take all the parameters that acf_render_block()
provides.

see

advanced-custom-fields-pro/pro/blocks.php:637

https://www.advancedcustomfields.com/resources/acf-blocks-key-concepts/#block-variables-or-parameters-for-callbacks-in-php

then you need to pass them on to the view.
after that $context should be available in your component.