array( __CLASS__, 'render' ) ) );
}
}
/**
* Render a dynamic block with escaped attributes and text.
*
* @param array $attributes Validated block attributes.
* @param string $content Saved inner content.
* @param WP_Block $block Block instance and context.
*/
public static function render( $attributes, $content, $block ) {
ob_start();
$attrs = $attributes;
switch ( $block->name ) {
case 'objeka-toolkit/product-highlights':
?>
'objeka-highlights' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Core escapes wrapper attributes. ?>>
' . esc_html__( 'Choose a product in this block’s settings to display current volume prices.', 'objeka-toolkit' ) . '';
break;
}
?>
'objeka-pricing-table' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
get_meta( '_objeka_bundles' ) && ! $product->is_sold_individually() ? ( $qty >= 3 ? 0.75 : ( $qty >= 2 ? 0.85 : 1 ) ) : 1;
?>
$qty,
'price' => (float) $product->get_price() * $factor,
)
)
)
);
?>
'objeka-hotspots' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
![<?php echo esc_attr( $attrs['imageAlt'] ); ?>](<?php echo esc_url( $attrs['imageUrl'] ); ?>)
$pin ) :
$x = min( 90, max( 10, (float) ( $pin['x'] ?? 50 ) ) );
$y = min( 75, max( 10, (float) ( $pin['y'] ?? 50 ) ) );
?>
context['postId'] ?? get_the_ID();
$count = str_word_count( wp_strip_all_tags( get_post_field( 'post_content', $post_id ) ) );
$minutes = max( 1, (int) ceil( $count / 200 ) );
/* translators: %d: estimated reading time in whole minutes. */
echo '' . esc_html( sprintf( _n( '%d minute read', '%d minutes read', $minutes, 'objeka-toolkit' ), $minutes ) ) . '
';
break;
}
return ob_get_clean();
}
}