<?php
declare( strict_types=1 );

namespace FiboFilters\Integrations\Themes\Bricks;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * FiboFiltersAppliedFiltersElement class
 */
class FiboFiltersAppliedFiltersElement extends \Bricks\Element {
	/** @var string */
	public $category = 'woocommerce';
	/** @var string */
	public $name = 'fibofilters-applied-filters';
	/** @var string */
	public $icon = 'fiboicon-fibofilters';

	public function get_label() {
		return esc_html_x( 'FiboFilters Applied Filters', '[admin]', 'fibofilters' );
	}

	public function get_keywords() {
		return [ 'fibo', 'filters', 'fibofilters' ];
	}

	public function set_control_groups() {
		// Remove default control groups.
		unset( $this->control_groups['_attributes'] );
		unset( $this->control_groups['_typography'] );
		unset( $this->control_groups['_background'] );
		unset( $this->control_groups['_gradient'] );
		unset( $this->control_groups['_shapes'] );
		unset( $this->control_groups['_transform'] );
		unset( $this->control_groups['_border'] );
	}

	public function render() {
		if ( ! $this->is_frontend ) {
			$this->render_element_placeholder(
				[
					'title' => esc_html_x( 'Applied filters will appear here.', '[admin]', 'fibofilters' ),
				]
			);
			return;
		}

		echo "<div {$this->render_attributes( '_root' )}>";
		echo do_shortcode( '[fibofilters_applied_filters]' );
		echo '</div>';
	}
}
