Automattic\WooCommerce\Blocks\BlockTypes
AbstractBlock::render_callback
The default render_callback for all blocks. This will ensure assets are enqueued just in time, then render the block (if applicable).
Method of the class: AbstractBlock{}
No Hooks.
Returns
String
. Rendered block type output.
Usage
$AbstractBlock = new AbstractBlock(); $AbstractBlock->render_callback( $attributes, $content, $block );
- $attributes(array|WP_Block)
- Block attributes, or an instance of a WP_Block.
Default: an empty array - $content(string)
- Block content.
Default: empty string - $block(WP_Block|null)
- Block instance.
Default: null
AbstractBlock::render_callback() AbstractBlock::render callback code WC 9.9.3
public function render_callback( $attributes = [], $content = '', $block = null ) { $render_callback_attributes = $this->parse_render_callback_attributes( $attributes ); if ( ! is_admin() && ! WC()->is_rest_api_request() ) { $this->register_block_type_assets(); $this->enqueue_assets( $render_callback_attributes, $content, $block ); } return $this->render( $render_callback_attributes, $content, $block ); }