# shopbuilder/1.1.4/app/Elementor/Widgets/Controls/LayoutFields.php

ShopBuilder – WooCommerce Builder For Elementor, version 1.1.4. 1,103 lines.

- Page: https://pluginprobe.com/plugins/shopbuilder/1.1.4/code/app/Elementor/Widgets/Controls/LayoutFields.php
- Raw: https://pluginprobe.com/plugins/shopbuilder/1.1.4/raw/app/Elementor/Widgets/Controls/LayoutFields.php
- Modified: 2023-07-11T10:48:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shopbuilder/1.1.4/code/app/Elementor/Widgets/Controls/LayoutFields.php#L10-L20`.

```php
<?php
/**
 * Elementor Layout Fields Class.
 *
 * This class contains all the common fields for Layout tab.
 *
 * @package RadiusTheme\SB
 */

namespace RadiusTheme\SB\Elementor\Widgets\Controls;

use RadiusTheme\SB\Helpers\Fns;
use RadiusTheme\SB\Elementor\Helper\ControlHelper;

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'This script cannot be accessed directly.' );
}

/**
 * Elementor Layout Fields Class.
 */
class LayoutFields {
	/**
	 * Tab name.
	 *
	 * @access private
	 * @static
	 *
	 * @var array
	 */
	private static $tab = 'layout';

	/**
	 * Grid Layout section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function grid_layout( $obj ) {
		$fields['layout_section'] = $obj->start_section(
			esc_html__( 'Layouts', 'shopbuilder' ),
			self::$tab
		);

		$fields['layout'] = [
			'type'      => 'rtsb-image-selector',
			'options'   => ControlHelper::grid_layouts(),
			'default'   => 'grid-layout1',
			'separator' => 'default',
		];

		$fields['layout_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/grid_layout_control', $fields, $obj );
	}

	/**
	 * List Layout section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function list_layout( $obj ) {
		$fields['layout_section'] = $obj->start_section(
			esc_html__( 'Layouts', 'shopbuilder' ),
			self::$tab
		);

		$fields['layout'] = [
			'type'      => 'rtsb-image-selector',
			'options'   => ControlHelper::list_layouts(),
			'default'   => 'list-layout1',
			'separator' => 'default',
		];

		$fields['layout_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/list_layout_control', $fields, $obj );
	}

	/**
	 * Slider Layout section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function slider_layout( $obj ) {
		$fields['layout_section'] = $obj->start_section(
			esc_html__( 'Slider Layouts', 'shopbuilder' ),
			self::$tab
		);

		$fields['layout'] = [
			'type'      => 'rtsb-image-selector',
			'options'   => ControlHelper::slider_layouts(),
			'default'   => 'slider-layout1',
			'separator' => 'default',
		];

		$fields['layout_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/slider_layout_control', $fields, $obj );
	}

	/**
	 * Category Layout section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function category_layout( $obj ) {
		$fields['layout_section'] = $obj->start_section(
			esc_html__( 'Layouts', 'shopbuilder' ),
			self::$tab
		);

		$fields['layout'] = [
			'type'      => 'rtsb-image-selector',
			'options'   => ControlHelper::category_layouts(),
			'default'   => 'category-layout1',
			'separator' => 'default',
		];

		$fields['layout_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/list_layout_control', $fields, $obj );
	}

	/**
	 * Category Layout section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function category_single_layout( $obj ) {
		$fields['layout_section'] = $obj->start_section(
			esc_html__( 'Layouts', 'shopbuilder' ),
			self::$tab
		);

		$fields['layout'] = [
			'type'      => 'rtsb-image-selector',
			'options'   => ControlHelper::single_category_layouts(),
			'default'   => 'category-single-layout1',
			'separator' => 'default',
		];

		$fields['cat_alignment'] = [
			'mode'      => 'responsive',
			'type'      => 'choose',
			'label'     => esc_html__( 'Element Alignment', 'shopbuilder' ),
			'options'   => [
				'left'   => [
					'title' => esc_html__( 'Left', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-left',
				],
				'center' => [
					'title' => esc_html__( 'Center', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-center',
				],
				'right'  => [
					'title' => esc_html__( 'Right', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-right',
				],
			],
			'selectors' => [
				$obj->selectors['category_single_layout']['cat_alignment']['text_align'] => 'text-align: {{VALUE}};',
				$obj->selectors['category_single_layout']['cat_alignment']['justify_content'] => 'justify-content: {{VALUE}};',
			],
		];

		$fields['cat_height'] = [
			'type'        => 'slider',
			'mode'        => 'responsive',
			'label'       => esc_html__( 'Element Height', 'shopbuilder' ),
			'size_units'  => [ 'px', '%' ],
			'range'       => [
				'px' => [
					'min'  => 0,
					'max'  => 1500,
					'step' => 1,
				],
				'%'  => [
					'min'  => 0,
					'max'  => 100,
					'step' => 1,
				],
			],
			'description' => esc_html__( 'Please select the element height.', 'shopbuilder' ),
			'selectors'   => [
				$obj->selectors['category_single_layout']['cat_height'] => 'height: {{SIZE}}{{UNIT}};',
			],
		];

		$fields['layout_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/cat_layout_control', $fields, $obj );
	}

	/**
	 * Columns section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function columns( $obj ) {
		$fields['columns_section'] = $obj->start_section(
			esc_html__( 'Columns', 'shopbuilder' ),
			self::$tab
		);

		$fields['cols'] = [
			'type'           => 'select2',
			'mode'           => 'responsive',
			'label'          => esc_html__( 'Number of Columns', 'shopbuilder' ),
			'description'    => esc_html__( 'Please select the number of columns to show per row.', 'shopbuilder' ),
			'options'        => ControlHelper::layout_columns(),
			'label_block'    => true,
			'default'        => '0',
			'tablet_default' => '0',
			'mobile_default' => '0',
			'required'       => true,
			'separator'      => 'default',
		];

		$fields['grid_gap'] = [
			'type'        => 'slider',
			'mode'        => 'responsive',
			'label'       => esc_html__( 'Grid Gap / Spacing (px)', 'shopbuilder' ),
			'size_units'  => [ 'px' ],
			'range'       => [
				'px' => [
					'min'  => 0,
					'max'  => 100,
					'step' => 1,
				],
			],
			'default'     => [
				'unit' => 'px',
				'size' => 30,
			],
			'description' => esc_html__( 'Please select the grid gap in px.', 'shopbuilder' ),
			'selectors'   => [
				$obj->selectors['columns']['grid_gap']['padding'] => 'padding-left: calc({{SIZE}}{{UNIT}} / 2); padding-right: calc({{SIZE}}{{UNIT}} / 2);',
				$obj->selectors['columns']['grid_gap']['margin'] => 'margin-left: calc(-{{SIZE}}{{UNIT}} / 2); margin-right: calc(-{{SIZE}}{{UNIT}} / 2);',
			],
			'condition'   => [ 'cols!' => [ '1' ] ],
		];

		$fields['image_width'] = [
			'type'        => 'slider',
			'mode'        => 'responsive',
			'label'       => esc_html__( 'Image Width (%)', 'shopbuilder' ),
			'size_units'  => [ 'px' ],
			'range'       => [
				'%' => [
					'min'  => 0,
					'max'  => 100,
					'step' => 1,
				],
			],
			'default'     => [
				'unit' => '%',
				'size' => 32,
			],
			'description' => esc_html__( 'Please select the image width in %.', 'shopbuilder' ),
			'selectors'   => [
				$obj->selectors['columns']['image_width'] => 'flex-basis: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};',
			],
			'condition'   => [ 'layout' => [ 'list-layout1', 'list-layout2' ] ],
		];

		$fields['image_gap'] = [
			'type'        => 'slider',
			'mode'        => 'responsive',
			'label'       => esc_html__( 'Image Gap (px)', 'shopbuilder' ),
			'size_units'  => [ 'px' ],
			'range'       => [
				'px' => [
					'min'  => 0,
					'max'  => 100,
					'step' => 1,
				],
			],
			'default'     => [
				'unit' => 'px',
				'size' => 30,
			],
			'description' => esc_html__( 'Please select the image gap in px.', 'shopbuilder' ),
			'selectors'   => [
				$obj->selectors['columns']['image_gap'] => 'gap: {{SIZE}}{{UNIT}};',
			],
			'condition'   => [ 'layout' => [ 'list-layout1', 'list-layout2' ] ],
		];

		$fields['grid_alignment'] = [
			'mode'      => 'responsive',
			'type'      => 'choose',
			'label'     => esc_html__( 'Elements Alignment', 'shopbuilder' ),
			'options'   => [
				'left'   => [
					'title' => esc_html__( 'Left', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-left',
				],
				'center' => [
					'title' => esc_html__( 'Center', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-center',
				],
				'right'  => [
					'title' => esc_html__( 'Right', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-right',
				],
			],
			'separator' => 'before-short elementor-control-separator-after',
			'selectors' => [
				$obj->selectors['columns']['grid_alignment']['text_align'] => 'text-align: {{VALUE}};',
				$obj->selectors['columns']['grid_alignment']['justify_content'] => 'justify-content: {{VALUE}};',
			],
		];
		/*
		$fields['grid_style'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Grid Style', 'shopbuilder' ),
			'options'     => [
				'even'    => esc_html__( 'Even', 'shopbuilder' ),
				'masonry' => esc_html__( 'Masonry', 'shopbuilder' ),
				'equal'   => esc_html__( 'Equal Height', 'shopbuilder' ),
			],
			'label_block' => true,
			'default'     => 'even',
			'description' => esc_html__( 'Please select the grid style.', 'shopbuilder' ),
			'classes'     => $obj->pro_class(),
			'separator'   => 'default',
		];
		*/
		$fields['columns_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/columns_control', $fields, $obj );
	}

	/**
	 * Slider Columns section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function slider_columns( $obj ) {
		$fields['columns_section'] = $obj->start_section(
			esc_html__( 'Columns', 'shopbuilder' ),
			self::$tab
		);

		$fields['cols'] = [
			'type'           => 'select2',
			'mode'           => 'responsive',
			'label'          => esc_html__( 'Number of Slides Per View', 'shopbuilder' ),
			'description'    => esc_html__( 'Please select the number of slides to show per view.', 'shopbuilder' ),
			'options'        => ControlHelper::layout_columns(),
			'label_block'    => true,
			'default'        => '0',
			'tablet_default' => '0',
			'mobile_default' => '0',
			'required'       => true,
			'separator'      => 'default elementor-control-separator-after',
		];

		$fields['cols_group'] = [
			'type'           => 'select2',
			'mode'           => 'responsive',
			'label'          => esc_html__( 'Number of Slides Per Group', 'shopbuilder' ),
			'description'    => esc_html__( 'Please select the number of slides to show per group.', 'shopbuilder' ),
			'options'        => ControlHelper::layout_columns(),
			'label_block'    => true,
			'default'        => '0',
			'tablet_default' => '0',
			'mobile_default' => '0',
			'required'       => true,
			'separator'      => 'default',
			'classes'        => $obj->pro_class(),
		];

		$fields['grid_gap'] = [
			'type'        => 'slider',
			'mode'        => 'responsive',
			'label'       => esc_html__( 'Space Between Slides (px)', 'shopbuilder' ),
			'size_units'  => [ 'px' ],
			'range'       => [
				'px' => [
					'min'  => 0,
					'max'  => 100,
					'step' => 1,
				],
			],
			'default'     => [
				'unit' => 'px',
				'size' => 30,
			],
			'description' => esc_html__( 'Please select the space Between slides in px.', 'shopbuilder' ),
		];

		$fields['grid_alignment'] = [
			'mode'      => 'responsive',
			'type'      => 'choose',
			'label'     => esc_html__( 'Elements Alignment', 'shopbuilder' ),
			'options'   => [
				'left'   => [
					'title' => esc_html__( 'Left', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-left',
				],
				'center' => [
					'title' => esc_html__( 'Center', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-center',
				],
				'right'  => [
					'title' => esc_html__( 'Right', 'shopbuilder' ),
					'icon'  => 'eicon-text-align-right',
				],
			],
			'separator' => 'before-short elementor-control-separator-after',
			'selectors' => [
				$obj->selectors['columns']['grid_alignment']['text_align'] => 'text-align: {{VALUE}};',
				$obj->selectors['columns']['grid_alignment']['justify_content'] => 'justify-content: {{VALUE}};',
			],
		];

		$fields['columns_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/columns_control', $fields, $obj );
	}

	/**
	 * Query section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function query( $obj ) {
		$fields['query_section'] = $obj->start_section(
			esc_html__( 'Query', 'shopbuilder' ),
			self::$tab
		);

		$fields['query_note'] = $obj->el_heading( esc_html__( 'Common Filters', 'shopbuilder' ), 'default' );

		$fields['query_tabs']  = $obj->start_tab_group();
		$fields['include_tab'] = $obj->start_tab( esc_html__( 'Include', 'shopbuilder' ) );

		$fields['include_posts'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Include Products', 'shopbuilder' ),
			'options'     => Fns::get_products_list(),
			'description' => esc_html__( 'Please select the products to show. Leave it blank to include all products.', 'shopbuilder' ),
			'multiple'    => true,
			'label_block' => true,
			'separator'   => 'default',
		];

		$fields['include_tab_end'] = $obj->end_tab();
		$fields['exclude_tab']     = $obj->start_tab( esc_html__( 'Exclude', 'shopbuilder' ) );

		$fields['exclude_posts'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Exclude Products', 'shopbuilder' ),
			'options'     => Fns::get_products_list(),
			'description' => esc_html__( 'Please select the products to show. Leave it blank to exclude none.', 'shopbuilder' ),
			'multiple'    => true,
			'label_block' => true,
			'separator'   => 'default',
		];

		$fields['exclude_tab_end'] = $obj->end_tab();
		$fields['query_tabs_end']  = $obj->end_tab_group();

		$fields['posts_limit'] = [
			'type'        => 'number',
			'label'       => esc_html__( 'Products Limit', 'shopbuilder' ),
			'description' => esc_html__( 'The number of products to show. Set empty to show all products.', 'shopbuilder' ),
			'default'     => 12,
		];

		$fields['posts_offset'] = [
			'type'        => 'number',
			'label'       => esc_html__( 'Products Offset', 'shopbuilder' ),
			'description' => esc_html__( 'Number of products to skip.', 'shopbuilder' ),
		];

		$fields['category_note'] = $obj->el_heading( esc_html__( 'Taxonomy Filters', 'shopbuilder' ), 'before' );

		$fields['filter_categories'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Filter By Categories', 'shopbuilder' ),
			'options'     => Fns::get_all_terms( 'product_cat' ),
			'description' => esc_html__( 'Select the categories you want to filter, Leave it blank for all categories.', 'shopbuilder' ),
			'multiple'    => true,
			'label_block' => true,
			'separator'   => 'default',
		];

		$fields['filter_tags'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Filter By Tags', 'shopbuilder' ),
			'options'     => Fns::get_all_terms( 'product_tag' ),
			'description' => esc_html__( 'Select the tags you want to filter, Leave it blank for all tags.', 'shopbuilder' ),
			'multiple'    => true,
			'label_block' => true,
		];

		$fields['filter_attributes'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Filter By Attributes', 'shopbuilder' ),
			'options'     => Fns::get_all_attributes(),
			'description' => esc_html__( 'Select the attributes you want to filter, Leave it blank for all attributes.', 'shopbuilder' ),
			'multiple'    => true,
			'label_block' => true,
		];

		$fields['tax_relation'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Taxonomy relation', 'shopbuilder' ),
			'options'     => [
				'OR'  => 'Show All Products (OR)',
				'AND' => 'Show Common Products (AND)',
			],
			'default'     => 'OR',
			'description' => esc_html__( 'Select the taxonomies relationship. It is applicable if you select more than one taxonomy.', 'shopbuilder' ),
			'label_block' => true,
		];

		$fields['advanced_note'] = $obj->el_heading( esc_html__( 'Advanced Filters', 'shopbuilder' ), 'before' );

		$fields['filter_author'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Filter By Author', 'shopbuilder' ),
			'options'     => Fns::get_users(),
			'description' => esc_html__( 'Select the author you want to filter, Leave it blank for all author.', 'shopbuilder' ),
			'multiple'    => true,
			'label_block' => true,
			'separator'   => 'default elementor-control-separator-after',
		];

		$fields['products_filter'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Display Products By:', 'shopbuilder' ),
			'options'     => ControlHelper::filter_products(),
			'default'     => 'best-selling',
			'description' => esc_html__( 'Please select the conditional display of products.', 'shopbuilder' ),
			'label_block' => true,
			'classes'     => $obj->pro_class(),
			'separator'   => 'default',
		];

		$fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );

		$fields['posts_order_by'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Order By', 'shopbuilder' ),
			'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
			'options'     => ControlHelper::posts_order_by(),
			'default'     => 'date',
			'separator'   => 'default',
		];

		$fields['posts_order'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Order', 'shopbuilder' ),
			'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
			'options'     => ControlHelper::posts_order(),
			'default'     => 'DESC',
		];

		$fields['query_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/query_control', $fields, $obj );
	}

	/**
	 * Query section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function additional_query( $obj ) {
		$fields['query_section'] = $obj->start_section(
			esc_html__( 'Query', 'shopbuilder' ),
			self::$tab
		);

		$fields['query_note'] = $obj->el_heading( esc_html__( 'Common Filters', 'shopbuilder' ), 'default' );

		$fields['posts_limit'] = [
			'type'        => 'number',
			'label'       => esc_html__( 'Products Limit', 'shopbuilder' ),
			'description' => esc_html__( 'The number of products to show. Set empty to show all products.', 'shopbuilder' ),
			'default'     => 12,
		];

		$fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );

		$fields['posts_order_by'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Order By', 'shopbuilder' ),
			'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
			'options'     => ControlHelper::posts_order_by(),
			'default'     => 'date',
			'separator'   => 'default',
		];

		$fields['posts_order'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Order', 'shopbuilder' ),
			'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
			'options'     => ControlHelper::posts_order(),
			'default'     => 'DESC',
		];

		$fields['query_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/query_control', $fields, $obj );
	}

	/**
	 * Category Query section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function cat_single_query( $obj ) {
		$fields['query_section'] = $obj->start_section(
			esc_html__( 'Query', 'shopbuilder' ),
			self::$tab
		);

		$fields['select_source'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Select Taxonomy', 'shopbuilder' ),
			'options'     => Fns::get_tax_list(),
			'description' => esc_html__( 'Please select the taxonomy.', 'shopbuilder' ),
			'label_block' => true,
			'default'     => 'product_cat',
			'separator'   => 'default',
		];

		$fields['select_cat'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Choose Category', 'shopbuilder' ),
			'options'     => Fns::get_terms( 'product_cat' ),
			'description' => esc_html__( 'Please select the category to show.', 'shopbuilder' ),
			'label_block' => true,
			'default'     => Fns::get_terms( 'product_cat', true ),
			'condition'   => [
				'select_source' => [ 'product_cat' ],
			],
		];

		$fields['select_tag'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Choose Tag', 'shopbuilder' ),
			'options'     => Fns::get_terms( 'product_tag' ),
			'description' => esc_html__( 'Please select the tag to show.', 'shopbuilder' ),
			'label_block' => true,
			'default'     => Fns::get_terms( 'product_tag', true ),
			'condition'   => [
				'select_source' => [ 'product_tag' ],
			],
		];

		$fields['query_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/cat_single_query_control', $fields, $obj );
	}

	/**
	 * Category Query section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function cat_query( $obj ) {
		$fields['query_section'] = $obj->start_section(
			esc_html__( 'Query', 'shopbuilder' ),
			self::$tab
		);

		$fields['query_note'] = $obj->el_heading( esc_html__( 'Filter', 'shopbuilder' ), 'default' );

		$fields['display_cat_by'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Display Categories By:', 'shopbuilder' ),
			'options'     => Fns::get_cat_list(),
			'description' => esc_html__( 'Please select what categories will be displayed.', 'shopbuilder' ),
			'label_block' => true,
			'default'     => 'all',
			'separator'   => 'default',
		];

		$fields['select_parent_cat'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Select Parent Category', 'shopbuilder' ),
			'options'     => Fns::get_terms( 'product_cat', false, true ),
			'description' => esc_html__( 'Please select the parent category to show.', 'shopbuilder' ),
			'label_block' => true,
			'default'     => Fns::get_terms( 'product_cat', true, true ),
			'condition'   => [ 'display_cat_by' => [ 'specific_parent' ] ],
		];

		$fields['include_cats'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Select Categories', 'shopbuilder' ),
			'options'     => Fns::get_terms( 'product_cat' ),
			'description' => esc_html__( 'Please select the categories to show.', 'shopbuilder' ),
			'label_block' => true,
			'multiple'    => true,
			'condition'   => [ 'display_cat_by' => [ 'selection' ] ],
		];

		$fields['include_cat_ids'] = [
			'type'        => 'text',
			'label'       => esc_html__( 'Enter Category IDs', 'shopbuilder' ),
			'description' => esc_html__( 'Please enter the category IDs separated by comma.', 'shopbuilder' ),
			'label_block' => true,
			'condition'   => [ 'display_cat_by' => [ 'cat_ids' ] ],
		];

		$fields['exclude_cats'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Exclude Categories', 'shopbuilder' ),
			'options'     => Fns::get_terms( 'product_cat' ),
			'description' => esc_html__( 'Please select the categories to exclude. Leave it blank to exclude none.', 'shopbuilder' ),
			'multiple'    => true,
			'label_block' => true,
			'condition'   => [ 'display_cat_by' => [ 'all' ] ],
		];

		$fields['cats_limit'] = [
			'type'        => 'number',
			'label'       => esc_html__( 'Categories Limit', 'shopbuilder' ),
			'description' => esc_html__( 'The number of categories to show. Set empty to show all categories.', 'shopbuilder' ),
			'condition'   => [ 'display_cat_by!' => [ 'selection' ] ],
		];

		$fields['show_top_level_cats'] = [
			'type'        => 'switch',
			'label'       => __( 'Show only Top Level <br /> Sub-Categories?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to display only first level sub-categories.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'condition'   => [ 'display_cat_by' => [ 'specific_parent' ] ],
		];

		$fields['show_empty'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Show Empty Categories?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to display empty categories.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'default'     => 'yes',
		];

		$fields['show_uncategorized'] = [
			'type'        => 'switch',
			'label'       => __( 'Show Uncategorized <br />(Or Default Category)?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to display uncategorized.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'default'     => 'yes',
			'condition'   => [ 'display_cat_by' => [ 'all' ] ],
		];

		$fields['show_subcats'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Show Sub-Categories?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to display subcategories.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'default'     => 'yes',
			'condition'   => [ 'display_cat_by' => [ 'all' ] ],
		];

		$fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );

		$fields['cats_order_by'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Order By', 'shopbuilder' ),
			'description' => esc_html__( 'Please choose to reorder categories.', 'shopbuilder' ),
			'options'     => ControlHelper::cats_order_by(),
			'default'     => 'name',
			'separator'   => 'default',
		];

		$fields['cats_order'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Order', 'shopbuilder' ),
			'description' => esc_html__( 'Please choose to reorder categories.', 'shopbuilder' ),
			'options'     => ControlHelper::posts_order(),
			'default'     => 'ASC',
		];

		$fields['query_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/cat_query_control', $fields, $obj );
	}

	/**
	 * Pagination section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function pagination( $obj ) {
		$fields['pagination_section'] = $obj->start_section(
			esc_html__( 'Pagination', 'shopbuilder' ),
			self::$tab
		);

		$fields['show_pagination'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Enable Pagination?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'separator'   => 'default',
		];

		$fields['pagination_per_page'] = [
			'type'        => 'number',
			'label'       => esc_html__( 'Number of Posts Per Page', 'shopbuilder' ),
			'default'     => 8,
			'description' => esc_html__( 'Please enter the number of team members per page to show.', 'shopbuilder' ),
			'condition'   => [ 'show_pagination' => [ 'yes' ] ],
		];

		$fields['pagination_type'] = [
			'type'            => 'select2',
			'label'           => esc_html__( 'Pagination Type', 'shopbuilder' ),
			// TODO: Will be activated later.
			// 'description' => __( 'Please choose the pagination type.<span class="elementor-pro-notice"><a target="_blank" href="' . esc_url( rtsb()->pro_version_link() ) . '">Upgrade to PRO</a> to unlock Load More and Ajax Pagination.</span>', 'shopbuilder' ),
				'description' => __( 'Please choose the pagination type.', 'shopbuilder' ),
			'options'         => [
				'pagination' => esc_html__( 'Number Pagination', 'shopbuilder' ),
			],
			'default'         => 'pagination',
			'label_block'     => true,
			'condition'       => [ 'show_pagination' => [ 'yes' ] ],
		];

		$fields['pagination_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/pagination_control', $fields, $obj );
	}

	/**
	 * Image section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function image( $obj ) {
		$fields['image_section'] = $obj->start_section(
			esc_html__( 'Image', 'shopbuilder' ),
			self::$tab
		);

		$fields['show_featured_image'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Display Featured Image?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to display featured image.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'default'     => 'yes',
			'separator'   => 'default',
		];

		$fields['show_hover_image'] = [
			'type'        => 'switch',
			'label'       => __( 'Display Gallery Image <br />on Hover?', 'shopbuilder' ),
			'description' => __( 'Switch on to display gallery image on hover. <br /><b>Note: </b>It will display the first gallery image on hover.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'default'     => 'yes',
			'condition'   => [ 'show_featured_image' => [ 'yes' ] ],
		];

		if ( function_exists( 'rtwpvsp' ) ) {
			$fields['show_hover_image']['condition'] = [
				'show_featured_image' => [ 'yes' ],
				'show_swatches'       => [ '' ],
			];
		}

		$fields['image_hover_animation'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Image Hover Animation', 'shopbuilder' ),
			'description' => esc_html__( 'Please choose image hover animation.', 'shopbuilder' ),
			'options'     => [
				'zoom_in'  => esc_html__( 'Zoom In', 'shopbuilder' ),
				'zoom_out' => esc_html__( 'Zoom Out', 'shopbuilder' ),
				'none'     => esc_html__( 'None', 'shopbuilder' ),
			],
			'label_block' => true,
			'condition'   => [ 'show_featured_image' => [ 'yes' ] ],
			'default'     => 'zoom_in',
		];

		$fields = array_merge( $fields, self::image_size_controls( 'grid' ) );

		$fields['image_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/image_control', $fields, $obj );
	}

	/**
	 * Category Image section
	 *
	 * @param object $obj Reference object.
	 * @return array
	 */
	public static function cat_image( $obj ) {
		$fields['cat_image_section'] = $obj->start_section(
			esc_html__( 'Image', 'shopbuilder' ),
			self::$tab
		);

		$fields['show_cat_image'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Display Category Image?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to display category image.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'default'     => 'yes',
			'separator'   => 'default',
		];

		$fields['show_custom_image'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Add Custom Image?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to select a custom category image. Setting a custom image will override the category image.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'classes'     => $obj->pro_class(),
			'separator'   => 'default',
			'condition'   => [ 'layout' => [ 'category-single-layout1' ] ],
		];

		$fields['custom_image'] = [
			'type'        => 'media',
			'label'       => esc_html__( 'Upload Custom Image', 'shopbuilder' ),
			'description' => esc_html__( 'Please choose the custom category image.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'condition'   => [ 'show_custom_image' => [ 'yes' ] ],
			'default'     => [
				'url' => \Elementor\Utils::get_placeholder_image_src(),
			],
		];

		$fields['show_overlay'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Enable Image Overlay?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to enable image overlay.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'condition'   => [
				'layout' => [ 'category-single-layout1' ],
			],
		];

		$fields['show_custom_icon'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Enable Custom Icons?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to enable custom icons instead of category images.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'condition'   => [ 'layout!' => [ 'category-single-layout1' ] ],
			'classes'     => $obj->pro_class(),
			'separator'   => 'default',
		];

		$all_categories = Fns::get_terms( 'product_cat', false, false, true );

		foreach ( $all_categories as $cat_id => $category ) {
			$fields[ 'custom_icon_' . $cat_id ] = [
				'type'      => 'icons',
				'label'     => sprintf(
					/* translators: Category name */
					__( 'Choose Icon for Category: %s', 'shopbuilder' ),
					esc_html( $category )
				),
				'condition' => [
					'show_custom_icon' => [ 'yes' ],
					'layout!'          => [ 'category-single-layout1' ],
				],
			];
		}

		$fields = array_merge( $fields, self::image_size_controls( 'catgory' ) );

		$fields['cat_image_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/cat_image_control', $fields, $obj );
	}

	/**
	 * Image Size Controls.
	 *
	 * @param string $type Type.
	 * @return array
	 */
	private static function image_size_controls( $type ) {
		$conditions = [
			'relation' => 'and',
			'terms'    => [],
		];

		if ( 'grid' === $type ) {
			$conditions['terms'][] = [
				'relation' => 'or',
				'terms'    => [
					[
						'name'     => 'show_featured_image',
						'operator' => '==',
						'value'    => 'yes',
					],
				],
			];
		} else {
			$conditions['terms'][] = [
				'relation' => 'or',
				'terms'    => [
					[
						'name'     => 'show_cat_image',
						'operator' => '==',
						'value'    => 'yes',
					],
					[
						'name'     => 'show_custom_image',
						'operator' => '==',
						'value'    => 'yes',
					],
				],
			];
		}

		$fields['image'] = [
			'type'            => 'select2',
			'label'           => esc_html__( 'Select Image Size', 'shopbuilder' ),
			'description'     => esc_html__( 'Please select the image size.', 'shopbuilder' ),
			'options'         => Fns::get_image_sizes(),
			'default'         => 'woocommerce_thumbnail',
			'label_block'     => true,
			'content_classes' => 'elementor-descriptor',
			'conditions'      => $conditions,
		];

		$conditions['terms'][] = [
			'relation' => 'or',
			'terms'    => [
				[
					'name'     => 'image',
					'operator' => '==',
					'value'    => 'rtsb_custom',
				],
			],
		];

		$fields['image_custom_dimension'] = [
			'type'        => 'image-dimensions',
			'label'       => esc_html__( 'Enter Custom Image Size', 'shopbuilder' ),
			'label_block' => true,
			'show_label'  => true,
			'default'     => [
				'width'  => 400,
				'height' => 400,
			],
			'conditions'  => $conditions,
		];

		$fields['image_crop'] = [
			'type'        => 'select2',
			'label'       => esc_html__( 'Image Crop', 'shopbuilder' ),
			'description' => esc_html__( 'Please click on "Apply" to update the image.', 'shopbuilder' ),
			'options'     => [
				'soft' => esc_html__( 'Soft Crop', 'shopbuilder' ),
				'hard' => esc_html__( 'Hard Crop', 'shopbuilder' ),
			],
			'default'     => 'hard',
			'conditions'  => $conditions,
		];

		$fields['image_custom_dimension_note'] = [
			'type'       => 'html',
			'raw'        => sprintf(
				'<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a">%s</span>',
				esc_html__( 'Please note that, if you enter image size larger than the actual image iteself, the image sizes will fallback to the full image dimension.', 'shopbuilder' )
			),
			'conditions' => $conditions,
			'separator'  => 'after',
		];

		return $fields;
	}
}

```
