diff --git a/includes/core/classes/blocks/class-rsvp-template.php b/includes/core/classes/blocks/class-rsvp-template.php index 840905be2..8b0430d90 100644 --- a/includes/core/classes/blocks/class-rsvp-template.php +++ b/includes/core/classes/blocks/class-rsvp-template.php @@ -35,6 +35,14 @@ class Rsvp_Template { */ use Singleton; + /** + * Constant representing the Block Name. + * + * @since 1.0.0 + * @var string + */ + const BLOCK_NAME = 'gatherpress/rsvp-template'; + /** * Class constructor. * @@ -73,7 +81,7 @@ protected function setup_hooks(): void { * @return string The filtered block content. */ public function ensure_block_styles_loaded( string $block_content, array $block ): string { - if ( 'gatherpress/rsvp-template' === $block['blockName'] ) { + if ( self::BLOCK_NAME === $block['blockName'] ) { $block_instance = Block::get_instance(); $tag = new WP_HTML_Tag_Processor( $block_content ); @@ -130,7 +138,11 @@ public function render_block( array $attributes, string $content, WP_Block $bloc if ( -1 === $response_id ) { $blocks = wp_json_encode( $block->parsed_block ); - $rsvp_response_template = '
'; + $rsvp_response_template = sprintf( + '
', + intval( get_the_ID() ), + esc_attr( $blocks ) + ); continue; } diff --git a/includes/core/classes/blocks/class-rsvp.php b/includes/core/classes/blocks/class-rsvp.php index 0341b3be8..dff2d142e 100644 --- a/includes/core/classes/blocks/class-rsvp.php +++ b/includes/core/classes/blocks/class-rsvp.php @@ -97,7 +97,11 @@ public function transform_block_content( string $block_content, array $block ): // Render inner blocks for all statuses. $inner_blocks_markup = ''; foreach ( $serialized_inner_blocks as $status => $serialized_inner_block ) { - $inner_blocks_markup .= '
' . do_blocks( $serialized_inner_block ) . '
'; + $inner_blocks_markup .= sprintf( + '
%s
', + esc_attr( $status ), + do_blocks( $serialized_inner_block ) + ); } // Set dynamic attributes for interactivity.