<?php   
/**
 * Block Patterns
 *
 * @package HVAC Repair
 * @since 1.0
 */

/**
 * Registers block patterns and categories.
 *
 * @since 1.0
 *
 * @return void
 */
function hvac_repair_register_block_patterns() {
	$hvac_repair_block_pattern_categories = array(
		'hvac-repair' => array( 'label' => esc_html__( 'HVAC Repair Patterns', 'hvac-repair' ) ),
		'pages'    => array( 'label' => esc_html__( 'Pages', 'hvac-repair' ) ),
	);

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

	foreach ( $hvac_repair_block_pattern_categories as $hvac_repair_name => $hvac_repair_properties ) {
		if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $hvac_repair_name ) ) {
			register_block_pattern_category( $hvac_repair_name, $hvac_repair_properties );
		}
	}

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

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

	foreach ( $hvac_repair_block_patterns as $hvac_repair_block_pattern ) {
		$hvac_repair_pattern_file = get_parent_theme_file_path( '/inc/patterns/' . $hvac_repair_block_pattern . '.php' );

		register_block_pattern(
			'hvac-repair/' . $hvac_repair_block_pattern,
			require $hvac_repair_pattern_file
		);
	}
}
add_action( 'init', 'hvac_repair_register_block_patterns', 9 );