block-developer-cookbook
block-developer-cookbook copied to clipboard
Block context
Creating a block that is aware of the postType and postID that it's inserted on and can provide context to it's children.
Post Picker.
- Custom block with InnerBlocks that only allows custom inner block that displays item Title.
- Inner block is a search field for whatever content type is chosen
- Main block gets the default post type from global context.
- Main Provides the chosen post type to the inner blocks
Tags
Block Context, InnerBlocks, data layer