array( 'recordId' => array( 'type' => 'number', 'default' => 0, ), ), 'provides_context' => array( 'gutenberg/recordId' => 'recordId', ), 'editor_script_handles' => array( 'gutenberg-test-block-context' ), ) ); register_block_type( 'gutenberg/test-context-consumer', array( 'uses_context' => array( 'gutenberg/recordId', 'postId', 'postType', ), 'render_callback' => static function ( $attributes, $content, $block ) { $ordered_context = array( $block->context['gutenberg/recordId'], $block->context['postId'], $block->context['postType'], ); return '
' . implode( ',', $ordered_context ) . '
'; }, 'editor_script_handles' => array( 'gutenberg-test-block-context' ), ) ); } add_action( 'init', 'gutenberg_test_register_context_blocks' );