<?php
function furniture_hub_scripts() {
    // Enqueue parent theme's style
    wp_enqueue_style('furniture-hub-parent-style', get_template_directory_uri() . '/style.css');

}
add_action('wp_enqueue_scripts', 'furniture_hub_scripts');


/**
 * Registers pattern categories.
 *
 * @since Furniture Hub 1.0.0
 *
 * @return void
 */
function furniture_hub_register_pattern_category()
{

    $patterns = array();

    $block_pattern_categories = array(
        'furniture-hub' => array('label' => __('Furniture Hub Patterns', 'furniture-hub'))
    );

    $block_pattern_categories = apply_filters('furniture_hub_block_pattern_categories', $block_pattern_categories);

    foreach ($block_pattern_categories as $name => $properties) {
        if (!WP_Block_Pattern_Categories_Registry::get_instance()->is_registered($name)) {
            register_block_pattern_category($name, $properties);
        }
    }
}
add_action('init', 'furniture_hub_register_pattern_category', 9);

// enqueue dashicons
add_action( 'enqueue_block_assets', function (): void {
	wp_enqueue_style( 'dashicons' );
});

/**
 * Register block styles.
 */

 if ( ! function_exists( 'furniture_hub_block_styles' ) ) :
	/**
	 * Register custom block styles
	 *
	 * @since 1.0.0
	 * @return void
	 */
	function furniture_hub_block_styles() {

		register_block_style(
			'core/paragraph',
			array(
				'name'         => 'admin-icon',
				'label'        => __( 'Admin Icon', 'furniture-hub' ),
				/*
				 * Styles for the custom Arrow icon style of the Details block
				 */
				'inline_style' => '
				.is-style-admin-icon:before {
					content: "\f110";
					font-family: "dashicons";
				}
				.is-style-admin-icon span{
					display: none;
				}',
			)
		);
	}
endif;

add_action( 'init', 'furniture_hub_block_styles' );
