block_name ) { return; } add_action( 'render_block_' . $this->block_name, [ $this, 'validateAndRender' ], 10, 2 ); } /** * Validate and render block. * * @param string $block_content The block content. * @param array $block The block. * * @return string */ public function validateAndRender( string $block_content, array $block ): string { // If the content is valid, return the original content. if ( $this->isValid( $block_content, $block ) ) { return $block_content; } // Render the block - This should be implemented by the child class. return $this->render( $block_content, $block ); } }