<?php   
/**
 * Block Patterns
 *
 * @package EVSE Charging Dock
 * @since 1.0
 */

/**
 * Registers block patterns and categories.
 *
 * @since 1.0
 *
 * @return void
 */
function evse_charging_dock_register_block_patterns() {
	$evse_charging_dock_block_pattern_categories = array(
		'evse-charging-dock' => array( 'label' => esc_html__( 'EVSE Charging Dock Patterns', 'evse-charging-dock' ) ),
		'pages'    => array( 'label' => esc_html__( 'Pages', 'evse-charging-dock' ) ),
	);

	$evse_charging_dock_block_pattern_categories = apply_filters( 'evse_charging_dock_block_pattern_categories', $evse_charging_dock_block_pattern_categories );

	foreach ( $evse_charging_dock_block_pattern_categories as $evse_charging_dock_name => $evse_charging_dock_properties ) {
		if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $evse_charging_dock_name ) ) {
			register_block_pattern_category( $evse_charging_dock_name, $evse_charging_dock_properties );
		}
	}

	$evse_charging_dock_block_patterns = array(
		'header-default',
		'banner-section',
		'offer-section',
		'post-one-column',
		'post-two-column',
		'inner-banner',
		'search-banner',
		'hidden-404',
		'sidebar',
		'footer-default',
	);

	$evse_charging_dock_block_patterns = apply_filters( 'evse_charging_dock_block_patterns', $evse_charging_dock_block_patterns );

	foreach ( $evse_charging_dock_block_patterns as $evse_charging_dock_block_pattern ) {
		$evse_charging_dock_pattern_file = get_parent_theme_file_path( '/inc/patterns/' . $evse_charging_dock_block_pattern . '.php' );

		register_block_pattern(
			'evse-charging-dock/' . $evse_charging_dock_block_pattern,
			require $evse_charging_dock_pattern_file
		);
	}
}
add_action( 'init', 'evse_charging_dock_register_block_patterns', 9 );