<?php
/**
 * Вспомогательные функции для шаблонов
 */

if ( ! function_exists( 'render_hero_metric' ) ) :
function render_hero_metric( array $metric ): void {
    $icon = ! empty( $metric['img_id'] )
        ? wp_get_attachment_url( $metric['img_id'] )
        : $metric['default_icon'];

    ?>
    <div class="wrapper__propositions">
        <img src="<?php echo esc_url( $icon ); ?>" alt="" width="96" height="96" loading="eager">
        <h3><?php echo esc_html( $metric['number'] ); ?></h3>
        <p><?php echo esc_html( $metric['label'] ); ?></p>
    </div>
    <?php
}
endif;
