<?php
namespace Sifency\Traits;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
use Elementor\Controls_Manager;
/**
 * Trait Sifency_Addons_Widget_Config_And_Help
 * This trait handles both Widget Configuration (name, title, icon, etc.)
 * and the Elementor Help Tab controls.
 */
trait Sifency_Addons_Layout_Controls {
	protected function add_sifency_addons_layout_controls( $args = array() ) {
		$this->add_control(
			'layout_style',
			array(
				'label'   => 'Layout',
				'type'    => Controls_Manager::SELECT,
				'options' => array(
					'grid'     => 'Grid',
					'carousel' => 'Carousel',
				),
				'default' => 'grid',
			)
		);

		$this->add_responsive_control(
			'columns',
			array(
				'label'          => 'Columns',
				'type'           => Controls_Manager::SELECT,
				'default'        => '4',
				'tablet_default' => '3',
				'mobile_default' => '2',
				'options'        => array(
					'1' => '1',
					'2' => '2',
					'3' => '3',
					'4' => '4',
					'5' => '5',
					'6' => '6',
				),
				'selectors'      => array(
					'{{WRAPPER}} .sifency-clients--grid, {{WRAPPER}} .sifency-stacks--grid' => 'display: grid; grid-template-columns: repeat({{VALUE}}, 1fr);',
				),
				'condition'      => array( 'layout_style' => 'grid' ),
			)
		);

		$this->add_responsive_control(
			'gap',
			array(
				'label'     => 'Gap',
				'type'      => Controls_Manager::SLIDER,
				'range'     => array(
					'px' => array(
						'min' => 0,
						'max' => 100,
					),
				),
				'selectors' => array(
					'{{WRAPPER}} .sifency-clients--grid, {{WRAPPER}} .sifency-stacks--grid,' => 'gap: {{SIZE}}{{UNIT}};',
				),
				'condition' => array( 'layout_style' => 'grid' ),
			)
		);
	}
}
