<?php
/** Title: Campaign Backers Section
 * Slug: crowdfunding-platform/campaign-backers
 * Description: Campaign backers and supporters showcase section
 * Categories: crowdfunding_platform
 * Keywords: backers, supporters, community, social proof
 */

// Check if this section should be displayed
if ( ! apply_filters( 'crowdfunding_platform_show_campaign_backers', true ) ) {
    return;
}

// Backers section data - can be filtered by plugins for dynamic content
$backers_data = array(
    'title'       => apply_filters( 'crowdfunding_platform_campaign_backers_title', __( 'Our Amazing Backers', 'crowdfunding-platform' ) ),
    'description' => apply_filters( 'crowdfunding_platform_campaign_backers_description', __( 'We are incredibly grateful to our backers who have made this campaign possible. Here are some of our amazing supporters:', 'crowdfunding-platform' ) ),
    'backers'     => apply_filters( 'crowdfunding_platform_campaign_backers_list', array() ),
    'footer_text' => apply_filters( 'crowdfunding_platform_campaign_backers_footer', __( '...and 151 more amazing supporters!', 'crowdfunding-platform' ) ),
);
?>

<!-- wp:group {"className":"campaign-section campaign-backers","layout":{"type":"default"}} -->
<div class="wp-block-group campaign-section campaign-backers">

	<!-- wp:heading {"level":2,"fontSize":"biggest","className":"pattern-heading-spacing-small"} -->
	<h2 class="wp-block-heading has-biggest-font-size pattern-heading-spacing-small"><?php echo esc_html( $backers_data['title'] ); ?></h2>
	<!-- /wp:heading -->

	<!-- wp:paragraph {"textColor":"secondary","fontSize":"base","className":"pattern-content-spacing"} -->
	<p class="has-secondary-color has-text-color has-base-font-size pattern-content-spacing"><?php echo esc_html( $backers_data['description'] ); ?></p>
	<!-- /wp:paragraph -->

	<!-- wp:group {"layout":{"type":"default"}} -->
	<div class="wp-block-group">

		<?php if ( ! empty( $backers_data['backers'] ) ) : ?>
			<?php foreach ( $backers_data['backers'] as $backer ) : ?>
		<!-- wp:paragraph {"style":{"spacing":{"margin":{"top":"0","bottom":"var(--wp--preset--spacing--20)"}}},"fontSize":"base"} -->
		<p class="has-base-font-size" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--20)">
			<?php
				printf(
					/* translators: 1: backer name (wrapped in strong tag), 2: amount backed (wrapped in strong tag with color) */
					__( '%1$s backed %2$s', 'crowdfunding-platform' ),
					'<strong>' . esc_html( $backer['name'] ) . '</strong>',
					'<strong class="has-primary-color has-text-color">' . esc_html( $backer['amount'] ) . '</strong>'
				);
				if ( ! empty( $backer['level'] ) ) {
					printf(
						/* translators: %s: reward level name */
						' ' . __( 'for "%s"', 'crowdfunding-platform' ),
						esc_html( $backer['level'] )
					);
				}
				if ( ! empty( $backer['date'] ) ) {
					echo ' <span class="has-secondary-color has-text-color">- ' . esc_html( $backer['date'] ) . '</span>';
				}
			?>
		</p>
		<!-- /wp:paragraph -->
			<?php endforeach; ?>
		<?php else : ?>
		<!-- wp:paragraph {"style":{"spacing":{"margin":{"top":"0","bottom":"var(--wp--preset--spacing--20)"}}},"fontSize":"base"} -->
		<p class="has-base-font-size" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--20)">
			<?php
			/* translators: 1: backer name (wrapped in strong tag), 2: amount backed (wrapped in strong tag with color) */
			printf(
				__( '%1$s backed %2$s', 'crowdfunding-platform' ),
				'<strong>' . esc_html__( 'Sarah Johnson', 'crowdfunding-platform' ) . '</strong>',
				'<strong class="has-primary-color has-text-color">$250</strong>'
			);
			/* translators: %s: reward level name */
			printf( ' ' . __( 'for "%s"', 'crowdfunding-platform' ), esc_html__( 'Early Bird Special', 'crowdfunding-platform' ) );
			?>
			<span class="has-secondary-color has-text-color">- <?php esc_html_e( 'Sept 15, 2025', 'crowdfunding-platform' ); ?></span>
		</p>
		<!-- /wp:paragraph -->

		<!-- wp:paragraph {"style":{"spacing":{"margin":{"top":"0","bottom":"var(--wp--preset--spacing--20)"}}},"fontSize":"base"} -->
		<p class="has-base-font-size" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--20)">
			<?php
			/* translators: 1: backer name (wrapped in strong tag), 2: amount backed (wrapped in strong tag with color) */
			printf(
				__( '%1$s backed %2$s', 'crowdfunding-platform' ),
				'<strong>' . esc_html__( 'Michael Chen', 'crowdfunding-platform' ) . '</strong>',
				'<strong class="has-primary-color has-text-color">$100</strong>'
			);
			/* translators: %s: reward level name */
			printf( ' ' . __( 'for "%s"', 'crowdfunding-platform' ), esc_html__( 'Standard Package', 'crowdfunding-platform' ) );
			?>
			<span class="has-secondary-color has-text-color">- <?php esc_html_e( 'Sept 14, 2025', 'crowdfunding-platform' ); ?></span>
		</p>
		<!-- /wp:paragraph -->

		<!-- wp:paragraph {"style":{"spacing":{"margin":{"top":"0","bottom":"var(--wp--preset--spacing--20)"}}},"fontSize":"base"} -->
		<p class="has-base-font-size" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--20)">
			<?php
			/* translators: 1: backer name (wrapped in strong tag), 2: amount backed (wrapped in strong tag with color) */
			printf(
				__( '%1$s backed %2$s', 'crowdfunding-platform' ),
				'<strong>' . esc_html__( 'Emily Rodriguez', 'crowdfunding-platform' ) . '</strong>',
				'<strong class="has-primary-color has-text-color">$50</strong>'
			);
			/* translators: %s: reward level name */
			printf( ' ' . __( 'for "%s"', 'crowdfunding-platform' ), esc_html__( 'Supporter Level', 'crowdfunding-platform' ) );
			?>
			<span class="has-secondary-color has-text-color">- <?php esc_html_e( 'Sept 13, 2025', 'crowdfunding-platform' ); ?></span>
		</p>
		<!-- /wp:paragraph -->

		<!-- wp:paragraph {"style":{"spacing":{"margin":{"top":"0","bottom":"var(--wp--preset--spacing--20)"}}},"fontSize":"base"} -->
		<p class="has-base-font-size" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--20)">
			<?php
			/* translators: 1: backer name (wrapped in strong tag), 2: amount backed (wrapped in strong tag with color) */
			printf(
				__( '%1$s backed %2$s', 'crowdfunding-platform' ),
				'<strong>' . esc_html__( 'David Thompson', 'crowdfunding-platform' ) . '</strong>',
				'<strong class="has-primary-color has-text-color">$50</strong>'
			);
			?>
			<span class="has-secondary-color has-text-color">- <?php esc_html_e( 'Sept 12, 2025', 'crowdfunding-platform' ); ?></span>
		</p>
		<!-- /wp:paragraph -->

		<!-- wp:paragraph {"style":{"spacing":{"margin":{"top":"0","bottom":"var(--wp--preset--spacing--20)"}}},"fontSize":"base"} -->
		<p class="has-base-font-size" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--20)">
			<?php
			/* translators: 1: backer name (wrapped in strong tag), 2: amount backed (wrapped in strong tag with color) */
			printf(
				__( '%1$s backed %2$s', 'crowdfunding-platform' ),
				'<strong>' . esc_html__( 'Lisa Park', 'crowdfunding-platform' ) . '</strong>',
				'<strong class="has-primary-color has-text-color">$25</strong>'
			);
			/* translators: %s: reward level name */
			printf( ' ' . __( 'for "%s"', 'crowdfunding-platform' ), esc_html__( 'Basic Support', 'crowdfunding-platform' ) );
			?>
			<span class="has-secondary-color has-text-color">- <?php esc_html_e( 'Sept 11, 2025', 'crowdfunding-platform' ); ?></span>
		</p>
		<!-- /wp:paragraph -->

		<?php endif; ?>

	</div>
	<!-- /wp:group -->

	<!-- wp:paragraph {"align":"center","textColor":"secondary","fontSize":"base","className":"pattern-content-spacing"} -->
	<p class="has-text-align-center has-secondary-color has-text-color has-base-font-size pattern-content-spacing"><?php echo esc_html( $backers_data['footer_text'] ); ?></p>
	<!-- /wp:paragraph -->

</div>
<!-- /wp:group -->