$attributes Block attributes. * @var WP_Block $block Block instance. */ defined( 'ABSPATH' ) || exit; $planetfoss_post = isset( $block->context['postId'] ) ? get_post( (int) $block->context['postId'] ) : get_post(); $planetfoss_html = planetfoss_card_for_post( $planetfoss_post, (string) ( $attributes['topic'] ?? '' ), 'wp-block-planetfoss-topic' ); if ( '' !== $planetfoss_html ) { // The card brings its own section element; the wrapper attributes carry alignment and spacing from the editor. printf( '
%s
', wp_kses_data( get_block_wrapper_attributes() ), $planetfoss_html ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped in planetfoss_render_topic(). } elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { printf( '

%s

', wp_kses_data( get_block_wrapper_attributes() ), esc_html__( 'No PlanetFOSS topic fits this post yet. It appears once a tag or category matches a topic with reports in the last 30 days, or pick a topic in the block settings.', 'planetfoss' ) ); }