<?php
class AIOC_PortfolioCarousel extends ET_Builder_Module {

	public $slug       = 'aioc_portfolio_carousel';
	public $vb_support = 'on';

	protected $module_credits = array(
		'module_uri' => 'https://diviextended.com/product/all-in-one-carousel-for-divi',
		'author'     => 'Elicus',
		'author_uri' => 'https://elicus.com',
	);

	/**
	 * Track if the module is currently rendering to prevent unnecessary rendering and recursion.
	 *
	 * @var bool
	 */
	protected static $rendering = false;

	public function init() {
		$this->name             = esc_html__( 'DE Portfolio Carousel', 'all-in-one-carousel-for-divi' );
		$this->main_css_element = '%%order_class%%';
	}

	public function get_settings_modal_toggles() {
		return array(
			'general'  => array(
				'toggles' => array(
					'main_content'    => array(
						'title' => esc_html__( 'Content', 'all-in-one-carousel-for-divi' ),
					),
					'elements'        => array(
						'title' => esc_html__( 'Elements', 'all-in-one-carousel-for-divi' ),
					),
					'slider_settings' => array(
						'title' => esc_html__( 'Slider', 'all-in-one-carousel-for-divi' ),
						'sub_toggles'   => array(
							'general' => array(
								'name' => 'General',
							),
							'navigation' => array(
								'name' => 'Navigation',
							),
						),
						'tabbed_subtoggles' => true,
					),
				),
			),
			'advanced' => array(
				'toggles' => array(
					'text_settings' => array(
						'title' => esc_html__( 'Content', 'all-in-one-carousel-for-divi' ),
						'sub_toggles'   => array(
							'title' => array(
								'name' => 'Title',
							),
							'category' => array(
								'name' => 'Category',
							),
							'body' => array(
								'name' => 'Body',
							),
						),
						'tabbed_subtoggles' => true,
					),
					'content_wrapper_toggle' => array(
						'title' => esc_html__( 'Post Content', 'all-in-one-carousel-for-divi' ),
					),
					'coverflow_settings' => array(
						'title' => esc_html__( 'Coverflow', 'all-in-one-carousel-for-divi' ),
					),
					'icon' => array(
						'title' => esc_html__( 'Icon', 'all-in-one-carousel-for-divi' ),
					),
					'overlay' => array(
						'title' => esc_html__( 'Overlay', 'all-in-one-carousel-for-divi' ),
					),
					'arrow_settings' => array(
						'title' => esc_html__( 'Arrow', 'all-in-one-carousel-for-divi' ),
						'sub_toggles'   => array(
							'general' => array(
								'name' => 'General',
							),
							'left_arrow' => array(
								'name' => 'Left',
							),
							'right_arrow' => array(
								'name' => 'Right',
							),
						),
						'tabbed_subtoggles' => true,
					),
					'pagination_styles' => array(
						'title' => esc_html__( 'Pagination', 'all-in-one-carousel-for-divi' ),
					),
					'read_more_settings'     => array(
						'title' => esc_html__( 'Read More Settings', 'all-in-one-carousel-for-divi' ),
					),
				),
			),
		);
	}

	public function get_advanced_fields_config() {
		return array(
			'fonts' => array(
				'title' => array(
					'label'          => esc_html__( 'Title', 'all-in-one-carousel-for-divi' ),
					'font_size'      => array(
						'default'        => '18px',
						'range_settings' => array(
							'min'  => '1',
							'max'  => '100',
							'step' => '1',
						),
						'validate_unit'  => true,
					),
					'line_height'    => array(
						'default'        => '1.5em',
						'range_settings' => array(
							'min'  => '0.1',
							'max'  => '10',
							'step' => '0.1',
						),
					),
					'letter_spacing' => array(
						'default'        => '0px',
						'range_settings' => array(
							'min'  => '0',
							'max'  => '10',
							'step' => '1',
						),
						'validate_unit'  => true,
					),
					'css'            => array(
						'main'      => "{$this->main_css_element} .aioc_portfolio_carousel_post_title, {$this->main_css_element} .aioc_portfolio_carousel_post_title a",
						'important' => 'all',
					),
					'header_level'   => array(
						'default' => 'h2',
					),
					'hide_text_align' => true,
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'title',
				),
				'body' => array(
					'label'          => esc_html__( 'Body', 'all-in-one-carousel-for-divi' ),
					'font_size'      => array(
						'default'        => '16px',
						'range_settings' => array(
							'min'  => '1',
							'max'  => '100',
							'step' => '1',
						),
						'validate_unit'  => true,
					),
					'line_height'    => array(
						'default'        => '1.3em',
						'range_settings' => array(
							'min'  => '0',
							'max'  => '5',
							'step' => '0.1',
						),
					),
					'letter_spacing' => array(
						'default'        => '0px',
						'range_settings' => array(
							'min'  => '0',
							'max'  => '10',
							'step' => '1',
						),
						'validate_unit'  => true,
					),
					'css'            => array(
						'main'      => "{$this->main_css_element} .aioc_portfolio_carousel_content, {$this->main_css_element} .aioc_portfolio_carousel_content p",
						'important' => 'all',
					),
					'hide_text_align' => true,
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'body',
				),
				'category' => array(
					'label'          => esc_html__( 'Category', 'all-in-one-carousel-for-divi' ),
					'font_size'      => array(
						'default'        => '14px',
						'range_settings' => array(
							'min'  => '1',
							'max'  => '100',
							'step' => '1',
						),
						'validate_unit'  => true,
					),
					'line_height'    => array(
						'default'        => '1.3em',
						'range_settings' => array(
							'min'  => '0.1',
							'max'  => '10',
							'step' => '0.1',
						),
					),
					'letter_spacing' => array(
						'default'        => '0px',
						'range_settings' => array(
							'min'  => '0',
							'max'  => '10',
							'step' => '1',
						),
						'validate_unit'  => true,
					),
					'css'            => array(
						'main'      => "{$this->main_css_element} .aioc_portfolio_carousel_post .aioc_portfolio_carousel_post_categories, {$this->main_css_element} .aioc_portfolio_carousel_post .aioc_portfolio_carousel_post_categories a",
						'important' => 'all',
					),
					'hide_text_align' => true,
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'category',
				),
			),
			'button' => array(
				'read_more' => array(
					'label'           => esc_html__( 'Button', 'all-in-one-carousel-for-divi' ),
					'css'             => array(
						'main'      => "{$this->main_css_element} .aioc_portfolio_carousel_button_link .et_pb_button",
						'alignment' => "{$this->main_css_element} .aioc_portfolio_carousel_button_link",
						'important' => 'all',
					),
					'margin_padding'  => array(
						'css' => array(
							'margin'    => "{$this->main_css_element} .aioc_portfolio_carousel_button_link",
							'padding'   => "{$this->main_css_element} .aioc_portfolio_carousel_button_link .et_pb_button",
							'important' => 'all',
						),
					),
					'no_rel_attr'     => true,
					'use_alignment'   => false,
					'box_shadow'      => false,
					'depends_on'      => array( 'show_read_more' ),
					'depends_show_if' => 'on',
				),
			),
			'borders' => array(
				'single_post' => array(
					'label_prefix' => esc_html__( 'Single Post', 'all-in-one-carousel-for-divi' ),
					'css'          => array(
						'main' => array(
							'border_radii'  => '%%order_class%% .aioc_portfolio_carousel_post',
							'border_styles' => '%%order_class%% .aioc_portfolio_carousel_post',
							'important'     => 'all',
						),
					),
				),
				'category' => array(
					'label_prefix' => esc_html__( 'Category', 'all-in-one-carousel-for-divi' ),
					'css'          => array(
						'main' => array(
							'border_radii'  => '%%order_class%% .aioc_portfolio_carousel_post_categories a',
							'border_styles' => '%%order_class%% .aioc_portfolio_carousel_post_categories a',
							'important'     => 'all',
						),
					),
					'depends_on'        => array( 'show_categories' ),
					'depends_show_if'   => 'on',
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'category',
				),
				'default'     => array(
					'css' => array(
						'main'      => array(
							'border_radii'  => $this->main_css_element,
							'border_styles' => $this->main_css_element,
						),
						'important' => 'all',
					),
				),
			),
			'box_shadow' => array(
				'single_post' => array(
					'label'       => esc_html__( 'Single Post', 'all-in-one-carousel-for-divi' ),
					'css'         => array(
						'main' => "{$this->main_css_element} .aioc_portfolio_carousel_post",
						'important' => 'all',
					),
					'tab_slug'    => 'advanced',
					'toggle_slug' => 'box_shadow',
				),
				'default' => array(
					'css' => array(
						'main' => '%%order_class%%',
					),
				),
			),
			'slider_margin_padding' => array(
				'slider_container' => array(
					'margin_padding' => array(
						'css' => array(
							'use_margin' => false,
							'padding'   => "{$this->main_css_element} .swiper-container",
							'important' => 'all',
						),
					),
				),
				'post_content_wrapper' => array(
					'margin_padding' => array(
						'css' => array(
							'margin'    => "{$this->main_css_element} .aioc_portfolio_content_wrapper",
							'padding'   => "{$this->main_css_element} .aioc_portfolio_content_wrapper",
							'important' => 'all',
						),
					),
				),
				'category' => array(
					'margin_padding' => array(
						'css' => array(
							'use_padding' => false,
							'margin'    => "{$this->main_css_element} .aioc_portfolio_carousel_post_categories",
							'important'  => 'all',
						),
					),
				),
				'arrows' => array(
					'margin_padding' => array(
						'css' => array(
							'use_margin' => false,
							'padding'    => "{$this->main_css_element} .swiper-button-next::after, {$this->main_css_element} .swiper-button-prev::after",
							'important'  => 'all',
						),
					),
				),
			),
			'margin_padding' => array(
				'css' => array(
					'margin'    => $this->main_css_element,
					'padding'   => $this->main_css_element,
					'important' => 'all',
				),
			),
			'height' => array(
				'default' => array(
					'css' => array(
						'main' => "{$this->main_css_element}, {$this->main_css_element} .aioc_portfolio_carousel_container .swiper-container",
					),
				),
			),
			'text'        => false,
			'text_shadow' => false,
		);
	}

	public function get_fields() {
		return array_merge(
			array(
				'slider_layout' => array(
					'label'            => esc_html__( 'Layout', 'all-in-one-carousel-for-divi' ),
					'type'             => 'select',
					'option_category'  => 'layout',
					'options'          => array(
						'layout1' => esc_html__( 'Layout 1', 'all-in-one-carousel-for-divi' ),
						'layout2' => esc_html__( 'Layout 2', 'all-in-one-carousel-for-divi' ),
						'layout3' => esc_html__( 'Layout 3', 'all-in-one-carousel-for-divi' ),
						'layout4' => esc_html__( 'Layout 4', 'all-in-one-carousel-for-divi' ),
						'layout5' => esc_html__( 'Layout 5', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'layout1',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Here you can select the slider layout.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'content_alignment' => array(
					'label'             => esc_html__( 'Content Alignment', 'all-in-one-carousel-for-divi' ),
					'type'              => 'select',
					'option_category'   => 'configuration',
					'options'           => array(
						'top_left'      => esc_html__( 'Top Left', 'all-in-one-carousel-for-divi' ),
						'top_right'     => esc_html__( 'Top Right', 'all-in-one-carousel-for-divi' ),
						'top_center'    => esc_html__( 'Top Center', 'all-in-one-carousel-for-divi' ),
						'center'        => esc_html__( 'Center', 'all-in-one-carousel-for-divi' ),
						'bottom_left'   => esc_html__( 'Bottom Left', 'all-in-one-carousel-for-divi' ),
						'bottom_right'  => esc_html__( 'Bottom Right', 'all-in-one-carousel-for-divi' ),
						'bottom_center' => esc_html__( 'Bottom Center', 'all-in-one-carousel-for-divi' ),
						'left_center' 	=> esc_html__( 'Left Top Center', 'all-in-one-carousel-for-divi' ),
						'right_center' 	=> esc_html__( 'Right Top Center', 'all-in-one-carousel-for-divi' ),
					),
					'default'           => 'center',
					'default_on_front'  => 'center',
					'tab_slug'          => 'general',
					'toggle_slug'       => 'main_content',
					'description'       => esc_html__( 'Here you can select the content alignment.', 'all-in-one-carousel-for-divi' ),
				),
				'posts_number' => array(
					'label'            => esc_html__( 'Number of Posts', 'all-in-one-carousel-for-divi' ),
					'type'             => 'text',
					'option_category'  => 'configuration',
					'default'          => '10',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Here you can define the value of number of posts you would like to display.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'offset_number' => array(
					'label'            => esc_html__( 'Post Offset Number', 'all-in-one-carousel-for-divi' ),
					'type'             => 'text',
					'option_category'  => 'configuration',
					'default'          => 0,
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Choose how many posts you would like to skip. These posts will not be shown in the feed.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'post_order' => array(
					'label'            => esc_html__( 'Order', 'all-in-one-carousel-for-divi' ),
					'type'             => 'select',
					'option_category'  => 'configuration',
					'options'          => array(
						'DESC' => esc_html__( 'DESC', 'all-in-one-carousel-for-divi' ),
						'ASC'  => esc_html__( 'ASC', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'DESC',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Here you can choose the order of your posts.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'post_order_by' => array(
					'label'            => esc_html__( 'Order by', 'all-in-one-carousel-for-divi' ),
					'type'             => 'select',
					'option_category'  => 'configuration',
					'options'          => array(
						'date'      => esc_html__( 'Date', 'all-in-one-carousel-for-divi' ),
						'modified'  => esc_html__( 'Modified Date', 'all-in-one-carousel-for-divi' ),
						'title'     => esc_html__( 'Title', 'all-in-one-carousel-for-divi' ),
						'name'      => esc_html__( 'Slug', 'all-in-one-carousel-for-divi' ),
						'ID'        => esc_html__( 'ID', 'all-in-one-carousel-for-divi' ),
						'rand'      => esc_html__( 'Random', 'all-in-one-carousel-for-divi' ),
						'relevance' => esc_html__( 'Relevance', 'all-in-one-carousel-for-divi' ),
						'none'      => esc_html__( 'None', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'date',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Here you can choose the order type of your posts.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'include_categories' => array(
					'label'            => esc_html__( 'Select Categories', 'all-in-one-carousel-for-divi' ),
					'type'             => 'categories',
					'option_category'  => 'basic_option',
					'taxonomy_name'    => 'project_category',
					'renderer_options' => array(
						'use_terms' => false,
					),
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Choose which categories you would like to include in the feed', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'show_thumbnail' => array(
					'label'            => esc_html__( 'Show Featured Image', 'all-in-one-carousel-for-divi' ),
					'type'             => 'yes_no_button',
					'option_category'  => 'configuration',
					'options'          => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'on',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'elements',
					'description'      => esc_html__( 'This will turn thumbnails on and off.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'featured_image_size' => array(
					'label'            => esc_html__( 'Featured Image Size', 'all-in-one-carousel-for-divi' ),
					'type'             => 'select',
					'option_category'  => 'configuration',
					'options'          => array(
						'medium' => esc_html__( 'Medium', 'all-in-one-carousel-for-divi' ),
						'large'  => esc_html__( 'Large', 'all-in-one-carousel-for-divi' ),
						'full'   => esc_html__( 'Full', 'all-in-one-carousel-for-divi' ),
					),
					'show_if'          => array(
						'show_thumbnail' => 'on',
					),
					'default'          => 'large',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'elements',
					'description'      => esc_html__( 'Here you can select the size of the featured image.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'disable_lazyload' => array(
					'label'        	   => esc_html__( 'Disable Lazy Load', 'all-in-one-carousel-for-divi' ),
					'type'             => 'yes_no_button',
					'option_category'  => 'configuration',
					'options'          => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'off',
					'show_if'          => array(
						'show_thumbnail' => 'on',
					),
					'tab_slug'         => 'general',
					'toggle_slug'      => 'elements',
					'description'      => esc_html__( 'Enable this to disable lazy loading.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'show_excerpt' => array(
					'label'            => esc_html__( 'Show Excerpt', 'all-in-one-carousel-for-divi' ),
					'type'             => 'yes_no_button',
					'option_category'  => 'configuration',
					'options'          => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'off',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'This will turn excerpt text display on and off.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'excerpt_length' => array(
					'label'            => esc_html__( 'Excerpt Length', 'all-in-one-carousel-for-divi' ),
					'type'             => 'text',
					'option_category'  => 'configuration',
					'show_if'          => array(
						'show_excerpt' => 'on',
					),
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Here you can define excerpt length in characters, if 0 no excerpt will be shown. However this won\'t work with the manual excerpt defined in the post.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'no_result_text' => array(
					'label'            => esc_html__( 'No Result Text', 'all-in-one-carousel-for-divi' ),
					'type'             => 'text',
					'option_category'  => 'configuration',
					'default'		   => esc_html__( 'The posts you requested could not be found. Try changing your module settings or create some new posts.', 'all-in-one-carousel-for-divi' ),
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Here you can define custom no result text.', 'all-in-one-carousel-for-divi' ),
				),
				'show_categories' => array(
					'label'            => esc_html__( 'Show Categories/Terms', 'all-in-one-carousel-for-divi' ),
					'type'             => 'yes_no_button',
					'option_category'  => 'configuration',
					'options'          => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'on',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'elements',
					'description'      => esc_html__( 'Turn the category/terms links on or off.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'show_read_more' => array(
					'label'            => esc_html__( 'Show Button', 'all-in-one-carousel-for-divi' ),
					'type'             => 'yes_no_button',
					'option_category'  => 'configuration',
					'options'          => array(
						'off' => esc_html__( 'Off', 'all-in-one-carousel-for-divi' ),
						'on'  => esc_html__( 'On', 'all-in-one-carousel-for-divi' ),
					),
					'affects'          => array(
						'custom_read_more',
					),
					'default'          => 'off',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'elements',
					'description'      => esc_html__( 'Here you can define whether to show "read more" link after the excerpts or not.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'read_more_text' => array(
					'label'            => esc_html__( 'Button Text', 'all-in-one-carousel-for-divi' ),
					'type'             => 'text',
					'option_category'  => 'configuration',
					'show_if'          => array(
						'show_read_more' => 'on',
					),
					'default'          => 'Read More',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'elements',
					'description'      => esc_html__( 'Here you can define "read more" button/link text.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'link_target' => array(
					'label'             => esc_html__( 'Button Link Target', 'all-in-one-carousel-for-divi' ),
					'type'              => 'select',
					'option_category'   => 'configuration',
					'options'           => array(
						'off' => esc_html__( 'In The Same Window', 'all-in-one-carousel-for-divi' ),
						'on'  => esc_html__( 'In The New Tab', 'all-in-one-carousel-for-divi' ),
					),
					'default'           => 'off',
					'show_if'          => array(
						'show_read_more' => 'on',
					),
					'tab_slug'          => 'general',
					'toggle_slug'       => 'elements',
					'description'       => esc_html__( 'Here you can choose whether or not the member opens the link in a new window.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'enable_overlay' => array(
					'label'            => esc_html__( 'Enable Image Overlay on Hover', 'all-in-one-carousel-for-divi' ),
					'type'             => 'yes_no_button',
					'option_category'  => 'configuration',
					'options'          => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default' 			=> 'off',
					'default_on_front' 	=> 'off',
					'show_if_not'      => array(
						'slider_layout' => array('layout2', 'layout5'),
					),
					'tab_slug'          => 'general',
					'toggle_slug'      	=> 'elements',
					'description'      	=> esc_html__( 'Whether or not to show images in lightbox.', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'category_align' => array(
					'label'            => esc_html__( 'Category Alignment', 'all-in-one-carousel-for-divi' ),
					'type'             => 'text_align',
					'option_category'  => 'layout',
					'options'          => et_builder_get_text_orientation_options( array( 'justified' ) ),
					'default_on_front' => 'left',
					'show_if'               => array(
						'slider_layout' => array('layout4'),
					),
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'category',
					'description'      => esc_html__( 'Here you can choose the category alignment.', 'all-in-one-carousel-for-divi' ),
					'options_icon'     => 'module_align',
				),
				'category_custom_margin' => array(
					'label'            => esc_html__( 'Category Margin', 'all-in-one-carousel-for-divi' ),
					'type'             => 'custom_margin',
					'option_category'  => 'layout',
					'mobile_options'   => true,
					'hover'            => false,
					'default'          => '',
					'default_on_front' => '',
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'category',
					'description'      => esc_html__( 'Margin adds extra space to the outside of the element, increasing the distance between the element and other items on the page.', 'divi-plus' ),
				),
				'category_background_color' => array(
					'label'        => esc_html__( 'Category Background Color', 'all-in-one-carousel-for-divi' ),
					'type'         => 'color-alpha',
					'custom_color' => true,
					'show_if'      => array(
						'show_categories' => 'on',
						'slider_layout' => array('layout2', 'layout4', 'layout5'),
					),
					'hover'        => 'tabs',
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'category',
					'description'  => esc_html__( 'Here you can define a custom color for the category background.', 'all-in-one-carousel-for-divi' ),
				),
				'post_content_wrapper_background_color' => array(
					'label'                 => esc_html__( 'Post Content Background', 'all-in-one-carousel-for-divi' ),
					'type'                  => 'background-field',
					'base_name'             => 'button_bg',
					'context'               => 'button_bg_color',
					'option_category'       => 'button',
					'custom_color'          => true,
					'background_fields'     => $this->generate_background_options( 'post_content_wrapper_background', 'button', 'advanced', 'content_wrapper_toggle', 'post_content_wrapper_background_color' ),
					'hover'                 => 'tabs',
					'mobile_options'        => true,
					'default'      			=> 'rgba(244,244,244,0.7)',
					'tab_slug'              => 'advanced',
					'toggle_slug'           => 'content_wrapper_toggle',
					'description'           => esc_html__( 'Customize the background style of the post content by adjusting the background color, gradient, and image.', 'all-in-one-carousel-for-divi' ),
				),
				'post_content_wrapper_custom_margin' => array(
					'label'            => esc_html__( 'Content Margin', 'all-in-one-carousel-for-divi' ),
					'type'             => 'custom_padding',
					'option_category'  => 'layout',
					'mobile_options'   => false,
					'hover'            => false,
					'default'          => '',
					'default_on_front' => '',
					'tab_slug'         => 'advanced',
					'toggle_slug'      => 'content_wrapper_toggle',
					'description'      => esc_html__( 'Margin adds extra space to the outside of the element, increasing the distance between the element and other items on the page.', 'all-in-one-carousel-for-divi' ),
				),
				'post_content_wrapper_custom_padding' => array(
					'label'            => esc_html__( 'Content Padding', 'all-in-one-carousel-for-divi' ),
					'type'             => 'custom_padding',
					'option_category'  => 'layout',
					'mobile_options'   => true,
					'hover'            => false,
					'default'          => '',
					'default_on_front' => '',
					'tab_slug'         => 'advanced',
					'toggle_slug'      => 'content_wrapper_toggle',
					'description'      => esc_html__( 'Padding adds extra space to the inside of the element, increasing the distance between the edge of the element and its inner contents.', 'all-in-one-carousel-for-divi' ),
				),
				'slider_container_custom_padding' => array(
					'label'            => esc_html__( 'Slider Container Padding', 'all-in-one-carousel-for-divi' ),
					'type'             => 'custom_padding',
					'option_category'  => 'layout',
					'mobile_options'   => true,
					'hover'            => false,
					'tab_slug'         => 'advanced',
					'toggle_slug'      => 'margin_padding',
					'description'      => esc_html__( 'Padding adds extra space to the inside of the element, increasing the distance between the edge of the element and its inner contents.', 'all-in-one-carousel-for-divi' ),
				),
				'slide_effect' => array(
					'label'            => esc_html__( 'Slide Effect', 'all-in-one-carousel-for-divi' ),
					'type'             => 'select',
					'option_category'  => 'layout',
					'options'          => array(
						'slide'     => esc_html__( 'Slide', 'all-in-one-carousel-for-divi' ),
						'cube'      => esc_html__( 'Cube', 'all-in-one-carousel-for-divi' ),
						'coverflow' => esc_html__( 'Coverflow', 'all-in-one-carousel-for-divi' ),
						'flip'      => esc_html__( 'Flip', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'slide',
					'default_on_front' => 'slide',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'      => esc_html__( 'Here you can choose the slide animation effect.', 'all-in-one-carousel-for-divi' ),
				),
				'post_per_slide' => array(
					'label'            => esc_html__( 'Number of Post Per View', 'all-in-one-carousel-for-divi' ),
					'type'             => 'select',
					'option_category'  => 'layout',
					'options'          => array(
						'1'  => esc_html__( '1', 'all-in-one-carousel-for-divi' ),
						'2'  => esc_html__( '2', 'all-in-one-carousel-for-divi' ),
						'3'  => esc_html__( '3', 'all-in-one-carousel-for-divi' ),
						'4'  => esc_html__( '4', 'all-in-one-carousel-for-divi' ),
						'5'  => esc_html__( '5', 'all-in-one-carousel-for-divi' ),
						'6'  => esc_html__( '6', 'all-in-one-carousel-for-divi' ),
						'7'  => esc_html__( '7', 'all-in-one-carousel-for-divi' ),
						'8'  => esc_html__( '8', 'all-in-one-carousel-for-divi' ),
						'9'  => esc_html__( '9', 'all-in-one-carousel-for-divi' ),
						'10' => esc_html__( '10', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => '3',
					'default_on_front' => '3',
					'mobile_options'   => true,
					'show_if'          => array(
						'slide_effect' => array( 'slide', 'coverflow' ),
					),
					'tab_slug'         => 'general',
					'toggle_slug'      => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'      => esc_html__( 'Here you can choose the number of posts you want to display per slide.', 'all-in-one-carousel-for-divi' ),
				),
				'slides_per_group' => array(
					'label'           => esc_html__( 'Number of Slides Per Group', 'all-in-one-carousel-for-divi' ),
					'type'            => 'select',
					'option_category' => 'layout',
					'options'         => array(
						'1'  => esc_html__( '1', 'all-in-one-carousel-for-divi' ),
						'2'  => esc_html__( '2', 'all-in-one-carousel-for-divi' ),
						'3'  => esc_html__( '3', 'all-in-one-carousel-for-divi' ),
						'4'  => esc_html__( '4', 'all-in-one-carousel-for-divi' ),
						'5'  => esc_html__( '5', 'all-in-one-carousel-for-divi' ),
						'6'  => esc_html__( '6', 'all-in-one-carousel-for-divi' ),
						'7'  => esc_html__( '7', 'all-in-one-carousel-for-divi' ),
						'8'  => esc_html__( '8', 'all-in-one-carousel-for-divi' ),
						'9'  => esc_html__( '9', 'all-in-one-carousel-for-divi' ),
						'10' => esc_html__( '10', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => '1',
					'mobile_options'  => true,
					'show_if'         => array(
						'slide_effect' => array( 'slide', 'coverflow' ),
					),
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can choose the number of slides per group to slide by.', 'all-in-one-carousel-for-divi' ),
				),
				'space_between_slides' => array(
					'label'           => esc_html__( 'Space between Slides', 'all-in-one-carousel-for-divi' ),
					'type'            => 'range',
					'option_category' => 'layout',
					'range_settings'  => array(
						'min'  => '10',
						'max'  => '100',
						'step' => '1',
					),
					'show_if'         => array(
						'slide_effect' => array( 'slide', 'coverflow' ),
					),
					'fixed_unit'      => 'px',
					'default'         => '15px',
					'mobile_options'  => true,
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Move the slider or input the value to increse or decrease the space between slides.', 'all-in-one-carousel-for-divi' ),
				),
				'slider_loop' => array(
					'label'           => esc_html__( 'Enable Loop', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'show_if_not'      => array(
						'slide_effect' => 'thumbnail',
					),
					'default'         => 'off',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can choose whether or not to enable loop for the logo slider.', 'all-in-one-carousel-for-divi' ),
				),
				'autoplay' => array(
					'label'           => esc_html__( 'Autoplay', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => 'on',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can choose whether or not to autoplay logo slider.', 'all-in-one-carousel-for-divi' ),
				),
				'enable_linear_transition'	=> array(
					'label'           => esc_html__( 'Enable Linear Transition', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => 'off',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can choose whether or not to enable linear transition between slides.', 'all-in-one-carousel-for-divi' ),
				),
				'autoplay_speed' => array(
					'label'           => esc_html__( 'Autoplay Delay', 'all-in-one-carousel-for-divi' ),
					'type'            => 'text',
					'option_category' => 'configuration',
					'default'         => '3000',
					'show_if'         => array(
						'autoplay' => 'on',
					),
					'show_if_not'     => array(
						'autoplay' => 'off',
					),
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can input the value to delay autoplay after a complete transition of the logo slider.', 'all-in-one-carousel-for-divi' ),
				),
				'transition_duration' => array(
					'label'           => esc_html__( 'Transition Duration', 'all-in-one-carousel-for-divi' ),
					'type'            => 'text',
					'option_category' => 'configuration',
					'default'         => '1000',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can input the value to delay each slide in a transition.', 'all-in-one-carousel-for-divi' ),
				),
				'pause_on_hover' => array(
					'label'           => esc_html__( 'Pause On Hover', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => 'on',
					'show_if'         => array(
						'autoplay' => 'on',
					),
					'show_if_not'     => array(
						'autoplay' => 'off',
					),
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can choose whether or not to pause slides on mouse hover.', 'all-in-one-carousel-for-divi' ),
				),
				'slide_center_mode' => array(
					'label'            => esc_html__( 'Slide Center Mode', 'all-in-one-carousel-for-divi' ),
					'type'             => 'yes_no_button',
					'option_category'  => 'configuration',
					'options'          => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'show_if'               => array(
						'slide_effect' => array('slide'),
					),
					'default'           => 'off',
					'default_on_front'  => 'off',
					'tab_slug'          => 'general',
					'toggle_slug'       => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'       => esc_html__( 'Whether or not to enable slide center mode.', 'all-in-one-carousel-for-divi' ),
				),
				'equalize_posts_height' => array(
					'label'           => esc_html__( 'Equalize Posts Height', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'off' => esc_html__( 'Off', 'all-in-one-carousel-for-divi' ),
						'on'  => esc_html__( 'On', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => 'on',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can choose whether or not equalize posts height.', 'all-in-one-carousel-for-divi' ),
				),
				'show_arrow' => array(
					'label'           => esc_html__( 'Show Arrows', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => 'on',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'navigation',
					'description'     => esc_html__( 'Here you can choose whether or not to display previous & next arrow on the slider.', 'all-in-one-carousel-for-divi' ),
				),
				'show_arrow_on_hover' => array(
					'label'           => esc_html__( 'Show Arrows Only On Hover', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'show_if'         => array(
						'show_arrow' => 'on',
					),
					'default'         => 'off',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'navigation',
					'description'     => esc_html__( 'Here you can choose whether or not to display previous and next arrow on hover.', 'all-in-one-carousel-for-divi' ),
				),
				'arrows_position' => array(
					'label'           => esc_html__( 'Arrows Position', 'all-in-one-carousel-for-divi' ),
					'type'            => 'select',
					'option_category' => 'layout',
					'options'         => array(
						'inside' 		=> esc_html__( 'Inside', 'all-in-one-carousel-for-divi' ),
						'outside'		=> esc_html__( 'Outside', 'all-in-one-carousel-for-divi' ),
						'top_left'      => esc_html__( 'Top Left', 'all-in-one-carousel-for-divi' ),
						'top_right'     => esc_html__( 'Top Right', 'all-in-one-carousel-for-divi' ),
						'top_center'    => esc_html__( 'Top Center', 'all-in-one-carousel-for-divi' ),
						'bottom_left'   => esc_html__( 'Bottom Left', 'all-in-one-carousel-for-divi' ),
						'bottom_right'  => esc_html__( 'Bottom Right', 'all-in-one-carousel-for-divi' ),
						'bottom_center' => esc_html__( 'Bottom Center', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => 'outside',
					'mobile_options'  => true,
					'show_if'         => array(
						'show_arrow' => 'on',
					),
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'navigation',
					'description'     => esc_html__( 'Here you can choose the arrows position.', 'all-in-one-carousel-for-divi' ),
				),
				'show_control_dot' => array(
					'label'           => esc_html__( 'Show Dots Pagination', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => 'on',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'navigation',
					'description'     => esc_html__( 'Here you choose whether or not to display pagination on the logo slider.', 'all-in-one-carousel-for-divi' ),
				),
				'control_dot_style' => array(
					'label'           => esc_html__( 'Dots Pagination Style', 'all-in-one-carousel-for-divi' ),
					'type'            => 'select',
					'option_category' => 'layout',
					'options'         => array(
						'solid_dot'       => esc_html__( 'Solid Dot', 'all-in-one-carousel-for-divi' ),
						'transparent_dot' => esc_html__( 'Transparent Dot', 'all-in-one-carousel-for-divi' ),
						'stretched_dot'   => esc_html__( 'Stretched Dot', 'all-in-one-carousel-for-divi' ),
						'line'            => esc_html__( 'Line', 'all-in-one-carousel-for-divi' ),
						'rounded_line'    => esc_html__( 'Rounded Line', 'all-in-one-carousel-for-divi' ),
						'square_dot'      => esc_html__( 'Squared Dot', 'all-in-one-carousel-for-divi' ),
						'number_dot'      => esc_html__( 'Number Dot', 'all-in-one-carousel-for-divi' ),
					),
					'show_if'         => array(
						'show_control_dot' => 'on',
					),
					'default'         => 'solid_dot',
					'tab_slug'        => 'general',
					'toggle_slug'     => 'slider_settings',
					'sub_toggle'	  => 'navigation',
					'description'     => esc_html__( 'control dot style', 'all-in-one-carousel-for-divi' ),
				),
				'enable_dynamic_dots' => array(
					'label'            => esc_html__( 'Enable Dynamic Dots', 'all-in-one-carousel-for-divi' ),
					'type'             => 'yes_no_button',
					'option_category'  => 'configuration',
					'options'          => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'          => 'off',
					'show_if'          => array(
						'show_control_dot' => 'on',
						'control_dot_style' => array(
							'solid_dot',
							'transparent_dot',
							'square_dot',
							'number_dot'
						),
					),
					'tab_slug'         => 'general',
					'toggle_slug'      => 'slider_settings',
					'sub_toggle'	   => 'navigation',
					'description'      => esc_html__( 'This setting will turn on and off the dynamic pagination of the slider.', 'all-in-one-carousel-for-divi' ),
				),
				'enable_coverflow_shadow' => array(
					'label'           => esc_html__( 'Enable Slide Shadow', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'default'         => 'off',
					'show_if'         => array(
						'slide_effect' => 'coverflow',
					),
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'coverflow_settings',
					'description'     => esc_html__( 'Enable Slide Shadow For Coverflow Effect.', 'all-in-one-carousel-for-divi' ),
				),
				'coverflow_shadow_color' => array(
					'label'        => esc_html__( 'Shadow Color', 'all-in-one-carousel-for-divi' ),
					'type'         => 'color-alpha',
					'custom_color' => true,
					'show_if'      => array(
						'slide_effect'            => 'coverflow',
						'enable_coverflow_shadow' => 'on',
					),
					'default'      => '#ccc',
					'tab_slug'     => 'advanced',
					'toggle_slug'  => 'coverflow_settings',
					'description'  => esc_html__( 'Here you can select color for the Shadow.', 'all-in-one-carousel-for-divi' ),
				),
				'coverflow_rotate' => array(
					'label'           => esc_html__( 'Coverflow Rotate', 'all-in-one-carousel-for-divi' ),
					'type'            => 'range',
					'option_category' => 'font_option',
					'range_settings'  => array(
						'min'  => '1',
						'max'  => '360',
						'step' => '1',
					),
					'unitless'        => true,
					'show_if'         => array(
						'slide_effect' => 'coverflow',
					),
					'default'         => '40',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'coverflow_settings',
					'description'     => esc_html__( 'Coverflow Rotate Slide.', 'all-in-one-carousel-for-divi' ),
				),
				'coverflow_depth' => array(
					'label'           => esc_html__( 'Coverflow Depth', 'all-in-one-carousel-for-divi' ),
					'type'            => 'range',
					'option_category' => 'font_option',
					'range_settings'  => array(
						'min'  => '1',
						'max'  => '1000',
						'step' => '1',
					),
					'unitless'        => true,
					'show_if'         => array(
						'slide_effect' => 'coverflow',
					),
					'default'         => '100',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'coverflow_settings',
					'description'     => esc_html__( 'Coverflow Depth Slide.', 'all-in-one-carousel-for-divi' ),
				),
				'overlay_icon_color' => array(
					'label'          => esc_html__( 'Overlay Icon Color', 'all-in-one-carousel-for-divi' ),
					'description'    => esc_html__( 'Here you can define a custom color for the overlay icon.', 'all-in-one-carousel-for-divi' ),
					'type'           => 'color-alpha',
					'custom_color'   => true,
					'tab_slug'       => 'advanced',
					'show_if'         => array(
						'enable_overlay' => 'on',
					),
					'show_if_not'      => array(
						'slider_layout'   => array ('layout2', 'layout5'),
					),
					'toggle_slug'    => 'overlay',
					'mobile_options' => true,
					'sticky'         => true,
				),
				'hover_overlay_color' => array(
					'label'          => esc_html__( 'Overlay Background Color', 'all-in-one-carousel-for-divi' ),
					'description'    => esc_html__( 'Pick a color to use for the icon that appears when hovering over a portfolio item.', 'all-in-one-carousel-for-divi' ),
					'type'           => 'color-alpha',
					'custom_color'   => true,
					'show_if'         => array(
						'enable_overlay' => 'on',
					),
					'show_if_not'      => array(
						'slider_layout'   => array ('layout2', 'layout5'),
					),
					'tab_slug'       => 'advanced',
					'toggle_slug'    => 'overlay',
					'mobile_options' => true,
					'sticky'         => true,
				),
				'overlay_icon' => array(
					'label'           => esc_html__( 'Overlay Icon', 'all-in-one-carousel-for-divi' ),
					'type'            => 'select_icon',
					'option_category' => 'configuration',
					'class'           => array( 'et-pb-font-icon' ),
					'show_if'         => array(
						'enable_overlay' => 'on',
					),
					'show_if_not'      => array(
						'slider_layout'   => array ('layout2', 'layout5'),
					),
					'tab_slug'       => 'advanced',
					'toggle_slug'    => 'overlay',
					'description'     => esc_html__( 'Here you can define a custom icon for the overlay', 'all-in-one-carousel-for-divi' ),
					'computed_affects' => array(
						'__portfolio_carousel_data',
					),
				),
				'arrows_custom_padding' => array(
					'label'            => esc_html__( 'Arrows Padding', 'all-in-one-carousel-for-divi' ),
					'type'             => 'custom_padding',
					'option_category'  => 'layout',
					'show_if'          => array(
						'show_arrow' => 'on',
					),
					'default'          => '5px|10px|5px|10px|true|true',
					'default_on_front' => '5px|10px|5px|10px|true|true',
					'mobile_options'   => true,
					'hover'            => false,
					'tab_slug'         => 'advanced',
					'toggle_slug'      => 'arrow_settings',
					'sub_toggle'	   => 'general',
					'description'      => esc_html__( 'Padding adds extra space to the inside of the element, increasing the distance between the edge of the element and its inner contents.', 'all-in-one-carousel-for-divi' ),
				),
				'space_between_arrows' => array(
					'label'           => esc_html__( 'Space between Arrows', 'all-in-one-carousel-for-divi' ),
					'type'            => 'range',
					'option_category' => 'layout',
					'range_settings'  => array(
						'min'  => '0',
						'max'  => '100',
						'step' => '1',
					),
					'show_if_not'     => array(
						'arrows_position' => array('inside', 'outside'),
					),
					'fixed_unit'	  => 'px',
					'default'         => '15px',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Move the slider or input the value to increse or decrease the space between arrows.', 'all-in-one-carousel-for-divi' ),
				),
				'arrow_font_size' => array(
					'label'           => esc_html__( 'Arrow Font Size', 'all-in-one-carousel-for-divi' ),
					'type'            => 'range',
					'option_category' => 'layout',
					'range_settings'  => array(
						'min'  => '10',
						'max'  => '100',
						'step' => '1',
					),
					'show_if'         => array(
						'show_arrow' => 'on',
					),
					'mobile_options'  => true,
					'default'         => '24px',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Move the slider or input the value to increse or decrease the size of arrows.', 'all-in-one-carousel-for-divi' ),
				),
				'arrow_color' => array(
					'label'        => esc_html__( 'Arrow Color', 'all-in-one-carousel-for-divi' ),
					'type'         => 'color-alpha',
					'custom_color' => true,
					'show_if'      => array(
						'show_arrow' => 'on',
					),
					'show_if_not'  => array(
						'show_arrow' => 'off',
					),
					'default'      => '#007aff',
					'hover'        => 'tabs',
					'tab_slug'     => 'advanced',
					'toggle_slug'  => 'arrow_settings',
					'sub_toggle'   => 'general',
					'description'  => esc_html__( 'Here you can choose a custom color to be used for arrows.', 'all-in-one-carousel-for-divi' ),
				),
				'use_arrow_background' => array(
					'label'           => esc_html__( 'Use Arrow Background', 'all-in-one-carousel-for-divi' ),
					'type'            => 'yes_no_button',
					'option_category' => 'configuration',
					'options'         => array(
						'on'  => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
						'off' => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
					),
					'show_if'         => array(
						'show_arrow' => 'on',
					),
					'default'         => 'off',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Here you can choose whehter or not to apply background on arrows.', 'all-in-one-carousel-for-divi' ),
				),
				'arrow_background_color' => array(
					'label'        => esc_html__( 'Arrow Background', 'all-in-one-carousel-for-divi' ),
					'type'         => 'color-alpha',
					'custom_color' => true,
					'show_if'      => array(
						'show_arrow'           => 'on',
						'use_arrow_background' => 'on',
					),
					'hover'        => 'tabs',
					'tab_slug'     => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'general',
					'description'  => esc_html__( 'Here you can choose a custom color to be used for the background of arrows.', 'all-in-one-carousel-for-divi' ),
				),
				'arrow_background_border_size' => array(
					'label'           => esc_html__( 'Arrow Background Border', 'all-in-one-carousel-for-divi' ),
					'type'            => 'range',
					'option_category' => 'layout',
					'range_settings'  => array(
						'min'  => '1',
						'max'  => '10',
						'step' => '1',
					),
					'show_if'         => array(
						'show_arrow'           => 'on',
						'use_arrow_background' => 'on',
					),
					'default'         => '0px',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'general',
					'description'     => esc_html__( 'Move the slider or input the value to increase or decrease the border size of the arrow background.', 'all-in-one-carousel-for-divi' ),
				),
				'arrow_shape_border_color' => array(
					'label'        => esc_html__( 'Arrow Background Border Color', 'all-in-one-carousel-for-divi' ),
					'type'         => 'color-alpha',
					'custom_color' => true,
					'show_if'      => array(
						'show_arrow'           => 'on',
						'use_arrow_background' => 'on',
					),
					'hover'        => 'tabs',
					'tab_slug'     => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'general',
					'description'  => esc_html__( 'Here you can choose a custom color to be used for the arrow background border', 'all-in-one-carousel-for-divi' ),
				),
				'arrows_border_radius' => array(
					'label'       => esc_html__( 'Border Radius', 'all-in-one-carousel-for-divi' ),
					'type'        => 'border-radius',
					'default'     => 'on||||',
					'show_if' 		  => array(
						'show_arrow' => 'on',
					),
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'general',
				),
				'previous_slide_arrow' => array(
					'label'           => esc_html__( 'Previous Arrow', 'all-in-one-carousel-for-divi' ),
					'type'            => 'select_icon',
					'option_category' => 'basic_option',
					'class'           => array(
						'et-pb-font-icon',
					),
					'show_if'         => array(
						'show_arrow' => 'on',
					),
					'default'         => ET_BUILDER_PRODUCT_VERSION < '4.13.0' ? '%%19%%' : '&#x34;||divi||400',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'left_arrow',
					'description'     => esc_html__( 'Here you can select the icon to be used for the previous slide navigation.', 'all-in-one-carousel-for-divi' ),
				),
				'next_slide_arrow' => array(
					'label'           => esc_html__( 'Next Arrow', 'all-in-one-carousel-for-divi' ),
					'type'            => 'select_icon',
					'option_category' => 'basic_option',
					'class'           => array(
						'et-pb-font-icon',
					),
					'show_if'         => array(
						'show_arrow' => 'on',
					),
					'default'         => ET_BUILDER_PRODUCT_VERSION < '4.13.0' ? '%%20%%' : '&#x35;||divi||400',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'arrow_settings',
					'sub_toggle'	  => 'right_arrow',
					'description'     => esc_html__( 'Here you can select the icon to be used for the next slide navigation.', 'all-in-one-carousel-for-divi' ),
				),
				'control_dot_active_color' => array(
					'label'        => esc_html__( 'Active Dot Pagination Color', 'all-in-one-carousel-for-divi' ),
					'type'         => 'color-alpha',
					'custom_color' => true,
					'show_if'      => array(
						'show_control_dot' => 'on',
					),
					'show_if_not'  => array(
						'show_control_dot' => 'off',
					),
					'default'      => '#000000',
					'tab_slug'     => 'advanced',
					'toggle_slug'  	   => 'pagination_styles',
					'description'  => esc_html__( 'Here you can choose a custom color to be used for the pagination of an active item.', 'all-in-one-carousel-for-divi' ),
				),
				'control_dot_inactive_color' => array(
					'label'        => esc_html__( 'Inactive Dot Pagination Color', 'all-in-one-carousel-for-divi' ),
					'type'         => 'color-alpha',
					'custom_color' => true,
					'show_if'      => array(
						'show_control_dot' => 'on',
					),
					'default'      => '#007aff',
					'tab_slug'     => 'advanced',
					'toggle_slug'  => 'pagination_styles',
					'description'  => esc_html__( 'Here you can choose a custom color to be used for the pagination of inactive items.', 'all-in-one-carousel-for-divi' ),
				),
				'number_dot_text_color' => array(
					'label'        	   => esc_html__( 'Number Dot Color', 'all-in-one-carousel-for-divi' ),
					'type'         	   => 'color-alpha',
					'custom_color'     => true,
					'show_if'      	   => array(
						'show_control_dot'  => 'on',
						'control_dot_style' => 'number_dot',
					),
					'default'      	   => '#ffffff',
					'tab_slug'     	   => 'advanced',
					'toggle_slug'  	   => 'pagination_styles',
					'description'  	   => esc_html__( 'Here you can define color for the number of pagination item.', 'all-in-one-carousel-for-divi' ),
				),
				'featured_image_height' => array(
					'label'           => esc_html__( 'Featured Image Height', 'all-in-one-carousel-for-divi' ),
					'type'            => 'range',
					'option_category' => 'layout',
					'range_settings'  => array(
						'min'  => '1',
						'max'  => '1000',
						'step' => '1',
					),
					'show_if'         => array(
						'show_thumbnail' => 'on',
					),
					'mobile_options'  => 'true',
					'default'         => '300px',
					'tab_slug'        => 'advanced',
					'toggle_slug'     => 'width',
					'description'     => esc_html__( 'Move the slider or input the value to increase or decrease the featured image size.', 'all-in-one-carousel-for-divi' ),
				),
				'__portfolio_carousel_data' => array(
					'type'                => 'computed',
					'computed_callback'   => array( 'AIOC_PortfolioCarousel', 'get_portfolio_posts' ),
					'computed_depends_on' => array(
						'slider_layout',
						'posts_number',
						'offset_number',
						'post_order',
						'post_order_by',
						'include_categories',
						'show_thumbnail',
						'featured_image_size',
						'disable_lazyload',
						'show_excerpt',
						'excerpt_length',
						'show_categories',
						'show_read_more',
						'read_more_text',
						'custom_read_more',
						'read_more_icon',
						'link_target',
						'enable_overlay',
						'overlay_icon',
						'title_level',
					),
				),
			),
			$this->generate_background_options( 'post_content_wrapper_background', 'skip', 'advanced', 'content_wrapper_toggle', 'post_content_wrapper_background_color' )
		);
	}

	public static function get_portfolio_posts( $attrs = array(), $conditional_tags = array(), $current_page = array() ) {
		global $et_fb_processing_shortcode_object, $et_pb_rendering_column_content;

		if ( self::$rendering ) {
			// We are trying to render a Portfolio module while a Portfolio module is already being rendered
			// which means we have most probably hit an infinite recursion. While not necessarily
			// the case, rendering a post which renders a Portfolio module which renders a post
			// which renders a Portfolio module is not a sensible use-case.
			return '';
		}

		/*
		 * Cached $wp_filter so it can be restored at the end of the callback.
		 * This is needed because this callback uses the_content filter / calls a function
		 * which uses the_content filter. WordPress doesn't support nested filter
		 */
		global $wp_filter;
		$wp_filter_cache = $wp_filter;

		$global_processing_original_value = $et_fb_processing_shortcode_object;

		$defaults = array(
			'posts_number'        => '10',
			'offset_number'       => '0',
			'slider_layout'       => 'layout1',
			'post_order'          => 'DESC',
			'post_order_by'       => 'date',
			'include_categories'  => '',
			'show_thumbnail'      => 'on',
			'featured_image_size' => 'large',
			'disable_lazyload'    => 'off',
			'show_excerpt'        => 'off',
			'excerpt_length'      => '',
			'show_categories'     => 'on',
			'show_read_more' 	  => 'on',
			'read_more_text'      => esc_html__( 'Read More', 'all-in-one-carousel-for-divi' ),
			'custom_read_more'    => 'off',
			'read_more_icon'      => '',
			'link_target' 		  => 'off',
			'enable_overlay'      => 'off',
			'overlay_icon'	      => '',
			'title_level'         => 'h2',
		);

		// WordPress' native conditional tag is only available during page load. It'll fail during component update because
		// et_pb_process_computed_property() is loaded in admin-ajax.php. Thus, use WordPress' conditional tags on page load and
		// rely to passed $conditional_tags for AJAX call.
		$is_front_page     = (bool) et_fb_conditional_tag( 'is_front_page', $conditional_tags );
		$is_single         = (bool) et_fb_conditional_tag( 'is_single', $conditional_tags );
		$is_user_logged_in = (bool) et_fb_conditional_tag( 'is_user_logged_in', $conditional_tags );
		$current_post_id   = isset( $current_page['id'] ) ? (int) $current_page['id'] : 0;

		// remove all filters from WP audio shortcode to make sure current theme doesn't add any elements into audio module.
		remove_all_filters( 'wp_audio_shortcode_library' );
		remove_all_filters( 'wp_audio_shortcode' );
		remove_all_filters( 'wp_audio_shortcode_class' );

		$attrs = wp_parse_args( $attrs, $defaults );

		foreach ( $defaults as $key => $default ) {
			${$key} = esc_html( et_()->array_get( $attrs, $key, $default ) );
		}

		$processed_title_level = et_pb_process_header_level( $title_level, 'h2' );
		$processed_title_level = esc_html( $processed_title_level );

		if ( 'on' === $show_excerpt ) {
			$excerpt_length = ( '' === $excerpt_length ) ? 100 : intval( $excerpt_length );
		}

		$args = array(
			'post_type'      => 'project',
			'posts_per_page' => intval( $posts_number ),
			'post_status'    => 'publish',
			'offset'         => 0,
			'orderby'        => 'date',
			'order'          => 'DESC',
		);
		if ( $is_user_logged_in ) {
			$args['post_status'] = array( 'publish', 'private' );
		}
		if ( $include_categories && '' !== $include_categories ) {
			$args['tax_query'] = array( array(
				'taxonomy' => 'project_category',
				'field'    => 'term_id',
				'terms'    => array_map( 'intval', explode( ',', $include_categories ) ),
				'operator' => 'IN',
			) );
		}
		if ( '' !== $offset_number && ! empty( $offset_number ) ) {
			$args['offset'] = intval( $offset_number );
		}
		if ( '' !== $args['offset'] && -1 === intval( $args['posts_per_page'] ) ) {
			$count_posts            = wp_count_posts( 'post', 'readable' );
			$published_posts        = $count_posts->publish;
			$args['posts_per_page'] = intval( $published_posts );
		}
		if ( isset( $post_order_by ) && '' !== $post_order_by ) {
			$args['orderby'] = sanitize_text_field( $post_order_by );
		}
		if ( isset( $post_order ) && '' !== $post_order ) {
			$args['order'] = sanitize_text_field( $post_order );
		}
		if ( $is_single && ! isset( $args['post__not_in'] ) ) {
			$args['post__not_in'] = array( intval( get_the_ID() ) );
		}

		if ( 'on' === $show_read_more ) {
			$read_more_text = ( ! isset( $read_more_text ) || '' === $read_more_text ) ?
			esc_html__( 'Read More', 'all-in-one-carousel-for-divi' ) :
			sprintf(
				esc_html__( '%s', 'all-in-one-carousel-for-divi' ),
				esc_html( $read_more_text )
			);
		}

		global $wp_the_query;
		$query_backup = $wp_the_query;

		$query = new WP_Query( $args );

		self::$rendering = true;

		$output_array = array();
		if ( $query->have_posts() ) {

			$image_classes = 'aioc_portfolio_carousel_post_image';
			if ( 'on' === $disable_lazyload ) {
				$image_classes .= ' no-lazyload skip-lazy';
			}

			while ( $query->have_posts() ) {
				$query->the_post();

				$post_id        = intval( get_the_ID() );
				$thumb          = aioc_get_post_thumbnail( $post_id, esc_html( $featured_image_size ), $image_classes );

				$no_thumb_class = ( '' === $thumb || 'off' === $show_thumbnail ) ? ' aioc_portfolio_carousel_no_thumb' : '';
				$post_classes   = array_map( 'sanitize_html_class', get_post_class( 'aioc_portfolio_carousel_post' . $no_thumb_class ) );
				$post_classes   = implode( ' ', $post_classes );

				$output = '';
				$read_more_html = aioc_render_divi_button( array(
					'button_text'         => et_core_esc_previously( $read_more_text ),
					'button_text_escaped' => true,
					'button_url'          => esc_url( get_permalink( $post_id ) ),
					'url_new_window'      => 'on' === $link_target ? $link_target : '',
					'button_custom'       => et_core_esc_previously( $custom_read_more ),
					'custom_icon'         => et_core_esc_previously( $read_more_icon ),
					'has_wrapper'         => false,
				) );

				if ( file_exists( plugin_dir_path( __FILE__ ) . 'layouts/' . sanitize_file_name( $slider_layout ) . '.php' ) ) {
					include plugin_dir_path( __FILE__ ) . 'layouts/' . sanitize_file_name( $slider_layout ) . '.php';
				}

				array_push( $output_array, $output );
			}
			wp_reset_postdata();

			// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
			$wp_the_query = $query_backup;
		}

		self::$rendering = false;
		return $output_array;
	}

	public function render( $attrs, $content, $render_slug ) {
		if ( self::$rendering ) {
			// We are trying to render a Portfolio module while a Portfolio module is already being rendered
			// which means we have most probably hit an infinite recursion. While not necessarily
			// the case, rendering a post which renders a Portfolio module which renders a post
			// which renders a Portfolio module is not a sensible use-case.
			return '';
		}

		/*
		 * Cached $wp_filter so it can be restored at the end of the callback.
		 * This is needed because this callback uses the_content filter / calls a function
		 * which uses the_content filter. WordPress doesn't support nested filter
		 */
		global $wp_filter, $aioc_portfolio_image_thumbs;;
		$wp_filter_cache = $wp_filter;

		$slider_layout                   = $this->props['slider_layout'];
		$content_alignment				 = $this->props['content_alignment'];
		$posts_number                    = $this->props['posts_number'];
		$offset_number                   = $this->props['offset_number'];
		$post_order                      = $this->props['post_order'];
		$post_order_by                   = $this->props['post_order_by'];
		$include_categories              = $this->props['include_categories'];
		$show_thumbnail                  = $this->props['show_thumbnail'];
		$featured_image_size             = $this->props['featured_image_size'];
		$show_excerpt                    = $this->props['show_excerpt'];
		$show_read_more                  = $this->props['show_read_more'];
		$read_more_text                  = $this->props['read_more_text'];
		$custom_read_more                = $this->props['custom_read_more'];
		$read_more_icon                  = $this->props['read_more_icon'];
		$link_target                     = $this->props['link_target'];
		$enable_overlay				     = $this->props['enable_overlay'];
		$overlay_icon       		     = $this->props['overlay_icon'];
		$excerpt_length                  = $this->props['excerpt_length'];
		$show_categories                 = $this->props['show_categories'];
		$no_result_text					 = $this->props['no_result_text'];
		$slide_center_mode               = 'on' === esc_attr( $this->props['slide_center_mode'] ) ? true : false;
		$enable_coverflow_shadow         = $this->props['enable_coverflow_shadow'];
		$coverflow_shadow_color          = $this->props['coverflow_shadow_color'];
		$coverflow_rotate                = $this->props['coverflow_rotate'];
		$coverflow_depth                 = $this->props['coverflow_depth'];
		$space_between_arrows 		     = $this->props['space_between_arrows'];
		$control_dot_style               = $this->props['control_dot_style'];
		$control_dot_active_color        = $this->props['control_dot_active_color'];
		$control_dot_inactive_color      = $this->props['control_dot_inactive_color'];
		$transition_duration             = $this->props['transition_duration'];
		$equalize_posts_height           = esc_attr( $this->props['equalize_posts_height'] );
		$show_arrow                      = esc_attr( $this->props['show_arrow'] );
		$previous_slide_arrow            = esc_attr( $this->props['previous_slide_arrow'] );
		$next_slide_arrow                = esc_attr( $this->props['next_slide_arrow'] );
		$show_control                    = esc_attr( $this->props['show_control_dot'] );
		$show_arrow_on_hover             = esc_attr( $this->props['show_arrow_on_hover'] );
		$arrow_color                     = esc_attr( $this->props['arrow_color'] );
		$arrow_color_hover               = esc_attr( $this->get_hover_value( 'arrow_color' ) );
		$use_arrow_background            = esc_attr( $this->props['use_arrow_background'] );
		$arrow_background_color          = esc_attr( $this->props['arrow_background_color'] );
		$arrow_background_color_hover    = esc_attr( $this->get_hover_value( 'arrow_background_color' ) );
		$arrow_background_border_size    = esc_attr( $this->props['arrow_background_border_size'] );
		$arrow_shape_border_color        = esc_attr( $this->props['arrow_shape_border_color'] );
		$arrow_shape_border_color_hover  = esc_attr( $this->get_hover_value( 'arrow_shape_border_color' ) );
		$control_dot_active_color        = esc_attr( $this->props['control_dot_active_color'] );
		$control_dot_inactive_color      = esc_attr( $this->props['control_dot_inactive_color'] );
		$number_dot_text_color           = esc_attr( $this->props['number_dot_text_color'] );
		$post_per_slide                  = intval( $this->props['post_per_slide'] );
		$category_align			         = esc_attr( $this->props['category_align'] );
		$category_background_color       = esc_attr( $this->props['category_background_color'] );
		$category_background_color_hover = esc_attr( $this->get_hover_value( 'category_background_color' ) );
		$slide_background_type           = esc_attr( $this->get_hover_value( 'slide_background_type' ) );
		$featured_image_height           = et_pb_responsive_options()->get_property_values( $this->props, 'featured_image_height' );
		$arrows_position			     = et_pb_responsive_options()->get_property_values( $this->props, 'arrows_position' );
		$arrows_position				 = array_filter( $arrows_position );
		$arrows_border_radius            = explode( '|', $this->props['arrows_border_radius'] );
		$disable_lazyload                = esc_attr( $this->props['disable_lazyload'] );

		$title_level  = esc_html( $this->props['title_level'] );
		$order_class  = $this->get_module_order_class( $render_slug );
		$order_number = esc_attr( preg_replace( '/[^0-9]/', '', esc_attr( $order_class ) ) );

		$video_background          = $this->video_background();
		$parallax_image_background = $this->get_parallax_image_background();
		$processed_title_level     = et_pb_process_header_level( $title_level, 'h2' );
		$processed_title_level     = esc_html( $processed_title_level );

		$args = array(
			'post_type'      => 'project',
			'posts_per_page' => intval( $posts_number ),
			'post_status'    => 'publish',
			'offset'         => 0,
			'orderby'        => 'date',
			'order'          => 'DESC',
		);
		if ( is_user_logged_in() ) {
			$args['post_status'] = array( 'publish', 'private' );
		}
		if ( $include_categories && '' !== $include_categories ) {
			$args['tax_query'] = array( array(
				'taxonomy' => 'project_category',
				'field'    => 'term_id',
				'terms'    => array_map( 'intval', explode( ',', $include_categories ) ),
				'operator' => 'IN',
			) );
		}
		if ( '' !== $offset_number && ! empty( $offset_number ) ) {
			$args['offset'] = intval( $offset_number );
		}
		if ( '' !== $args['offset'] && -1 === intval( $args['posts_per_page'] ) ) {
			$count_posts            = wp_count_posts( 'post', 'readable' );
			$published_posts        = $count_posts->publish;
			$args['posts_per_page'] = intval( $published_posts );
		}
		if ( isset( $post_order_by ) && '' !== $post_order_by ) {
			$args['orderby'] = sanitize_text_field( $post_order_by );
		}
		if ( isset( $post_order ) && '' !== $post_order ) {
			$args['order'] = sanitize_text_field( $post_order );
		}
		if ( is_single() && ! isset( $args['post__not_in'] ) ) {
			$args['post__not_in'] = array( intval( get_the_ID() ) );
		}

		if ( 'on' === $show_read_more ) {
			$read_more_text = ( ! isset( $read_more_text ) || '' === $read_more_text ) ?
			esc_html__( 'Read More', 'all-in-one-carousel-for-divi' ) :
			sprintf(
				esc_html__( '%s', 'all-in-one-carousel-for-divi' ),
				esc_html( $read_more_text )
			);
		}

		global $wp_the_query;
		$query_backup = $wp_the_query;

		$query = new WP_Query( $args );

		self::$rendering = true;
		if ( $query->have_posts() ) {

			wp_enqueue_script( 'elicus-swiper-script' );
			wp_enqueue_style( 'elicus-swiper-style' );
			wp_enqueue_style( 'aioc-swiper-style' );
			$file = et_is_builder_plugin_active() ? 'style-dbp' : 'style';
			wp_enqueue_style( 'aioc-portfolio-carousel-style', ALL_IN_ONE_CAROUSEL_FOR_DIVI_PATH . 'includes/modules/PortfolioCarousel/' . $file . '.min.css', array(), '1.0.0' );

			if ( 'on' === $enable_overlay ) {

				// Overlay Icon color.
				$this->generate_styles( array(
					'hover'          => false,
					'base_attr_name' => 'overlay_icon_color',
					'selector'       => "%%order_class%% .et_overlay:before",
					'css_property'   => 'color',
					'render_slug'    => $render_slug,
					'type'           => 'color',
					'important'      => true,
				) );

				// Hover Overlay color.
				$this->generate_styles( array(
					'hover'          => false,
					'base_attr_name' => 'hover_overlay_color',
					'selector'       => "%%order_class%% .et_overlay",
					'css_property'   => array( 'background-color', 'border-color' ),
					'render_slug'    => $render_slug,
					'type'           => 'color',
				) );

				$overlay_output = ET_Builder_Module_Helper_Overlay::render(
					array( 'icon' => $overlay_icon )
				);
				if ( class_exists( 'ET_Builder_Module_Helper_Style_Processor' ) && method_exists( 'ET_Builder_Module_Helper_Style_Processor', 'process_extended_icon' ) ) {
					$this->generate_styles( array(
						'utility_arg'    => 'icon_font_family',
						'render_slug'    => $render_slug,
						'base_attr_name' => 'overlay_icon',
						'important'      => true,
						'selector'       => '%%order_class%% .et_overlay:before',
						'processor'      => array(
							'ET_Builder_Module_Helper_Style_Processor',
							'process_extended_icon',
						),
					) );
				}
			}

			if ( ! empty( array_filter( $featured_image_height ) ) ) {
				et_pb_responsive_options()->generate_responsive_css( $featured_image_height, '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_image_wrapper', 'height', $render_slug, '!important;', 'type' );
			}

			// some themes do not include these styles/scripts so we need to enqueue them in this module to support audio post format.
			wp_enqueue_style( 'wp-mediaelement' );
			wp_enqueue_script( 'wp-mediaelement' );

			// include easyPieChart which is required for loading Portfolio module content via ajax correctly.
			wp_enqueue_script( 'easypiechart' );

			// include ET Shortcode scripts.
			wp_enqueue_script( 'et-shortcodes-js' );

			// remove all filters from WP audio shortcode to make sure current theme doesn't add any elements into audio module.
			remove_all_filters( 'wp_audio_shortcode_library' );
			remove_all_filters( 'wp_audio_shortcode' );
			remove_all_filters( 'wp_audio_shortcode_class' );

			if ( 'on' === $show_excerpt ) {
				$excerpt_length = ( '' === $excerpt_length ) ? 100 : intval( $excerpt_length );
			}

			// Slide Center Mode.
			if ( 'on' === $this->props['slide_center_mode'] ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_swiper_wrapper .swiper-slide:not(.swiper-slide-active)',
					'declaration' => 'transition: all 0.4s; transform: scale(0.8);',
				) );
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_swiper_wrapper .swiper-slide-active',
					'declaration' => 'transform: scale(1); transition: all 0.4s;',
				) );			
			}

			// Image Alignment.
			if ( 'layout4' === $slider_layout ) {
				if ( 'left' === $category_align ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_carousel_post_categories',
						'declaration' => 'text-align: left;',
					) );
				}
				if ( 'center' === $category_align ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_carousel_post_categories',
						'declaration' => 'text-align: center;',
					) );
				}
				if ( 'right' === $category_align ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_carousel_post_categories',
						'declaration' => 'text-align: right;',
					) );
				}
			}

			// Content Alignment.
			if ( 'top_left' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'align-items: flex-start; justify-content: flex-start; text-align: left;',
				) );
			} elseif ( 'top_right' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'align-items: flex-end; justify-content: flex-start; text-align: right;',
				) );
			} elseif ( 'top_center' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'align-items: center; justify-content: flex-start; text-align: center;',
				) );
			} elseif ( 'center' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'justify-content: center; align-items: center; text-align: center;',
				) );
			} elseif ( 'bottom_left' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'align-items: flex-start; justify-content: flex-end; text-align: left;',
				) );
			} elseif ( 'bottom_right' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'align-items: flex-end; justify-content: flex-end; text-align: right;',
				) );
			} elseif ( 'bottom_center' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'align-items: center; justify-content: flex-end; text-align: center;',
				) );
			} elseif ( 'left_center' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'align-items: flex-start; justify-content: center; text-align: left;',
				) );
			} elseif ( 'right_center' === $content_alignment ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_post .aioc_portfolio_content_wrapper',
					'declaration' => 'align-items: flex-end; justify-content: center; text-align: right;',
				) );
			}

			// Post Category.
			if ( 'layout2' === $slider_layout || 'layout4' === $slider_layout || 'layout5' === $slider_layout ) {
				$category_background_color = '' !== $category_background_color ? $category_background_color : '#ffffff';
				if ( '' !== $category_background_color ) {
					self::set_style( $render_slug, array(
						'selector'    => "{$this->main_css_element} .aioc_portfolio_carousel_post_categories a",
						'declaration' => sprintf( 'background-color: %1$s !important;', esc_attr( $category_background_color ) ),
					) );
					self::set_style( $render_slug, array(
						'selector'    => "{$this->main_css_element} .aioc_portfolio_carousel_post_categories a",
						'declaration' => 'padding: 2px 4px !important;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => "{$this->main_css_element} .aioc_portfolio_carousel_post_categories a",
						'declaration' => 'margin: 0 4px 5px 0 !important;',
					) );
				}
				if ( '' !== $category_background_color_hover ) {
					self::set_style( $render_slug, array(
						'selector'    => "{$this->main_css_element} .aioc_portfolio_carousel_post_categories a:hover",
						'declaration' => sprintf( 'background-color: %1$s !important;', esc_attr( $category_background_color_hover ) )
					) );
				}
			}

			// Coverflow CSS.
			if( 'on' === $enable_coverflow_shadow ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-container-3d .swiper-slide-shadow-left',
					'declaration' => sprintf( 'background-image: linear-gradient(to left,%1$s,rgba(0,0,0,0)) !important;', esc_attr( $coverflow_shadow_color ) ),
				) );
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-container-3d .swiper-slide-shadow-right',
					'declaration' => sprintf( 'background-image: linear-gradient(to right,%1$s,rgba(0,0,0,0)) !important;', esc_attr( $coverflow_shadow_color ) ),
				) );
			} else {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-container-3d .swiper-slide-shadow-left, %%order_class%% .swiper-container-3d .swiper-slide-shadow-right',
					'declaration' => 'background-image: none !important;',
				) );
			}

			// Arrow CSS.
			if ( 'on' === $show_arrow ) {
				if ( '' !== $arrows_border_radius ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .swiper-button-next, %%order_class%% .swiper-button-prev',
						'declaration' => sprintf( 'border-radius: %1$s %2$s %3$s %4$s;', 
							$arrows_border_radius[1],
							$arrows_border_radius[2],
							$arrows_border_radius[3],
							$arrows_border_radius[4]
						),
					) );
				}
				if ( isset( $space_between_arrows ) && '' !== $space_between_arrows ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-next',
						'declaration' => sprintf( 'margin-left: %1$s !important;', esc_attr( $space_between_arrows ) ),
					) );
				}
				if ( $arrow_color ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev, %%order_class%% .aioc_swiper_navigation .swiper-button-next',
						'declaration' => sprintf( 'color: %1$s !important;', esc_attr( $arrow_color ) ),
					) );
				}
				if ( $arrow_color_hover ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev:hover, %%order_class%% .aioc_swiper_navigation .swiper-button-next:hover',
						'declaration' => sprintf( 'color: %1$s !important;', esc_attr( $arrow_color_hover ) ),
					) );
				}

				$arrow_font_size = et_pb_responsive_options()->get_property_values( $this->props, 'arrow_font_size' );
				if ( ! empty( array_filter( $arrow_font_size ) ) ) {
					et_pb_responsive_options()->generate_responsive_css( $arrow_font_size, '%%order_class%% .aioc_swiper_navigation .swiper-button-prev, %%order_class%% .aioc_swiper_navigation .swiper-button-next', 'font-size', $render_slug, '!important;', 'range' );
				}

				if ( '' !== $this->props['next_slide_arrow'] ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-next::after',
						'declaration' => 'display: flex; align-items: center; height: 100%; content: attr(data-next_slide_arrow);',
					) );
					if ( class_exists( 'ET_Builder_Module_Helper_Style_Processor' ) && method_exists( 'ET_Builder_Module_Helper_Style_Processor', 'process_extended_icon' ) ) {
						$this->generate_styles( array(
							'utility_arg'    => 'icon_font_family',
							'render_slug'    => $render_slug,
							'base_attr_name' => 'next_slide_arrow',
							'important'      => true,
							'selector'       => '%%order_class%% .aioc_swiper_navigation .swiper-button-next::after',
							'processor'      => array(
								'ET_Builder_Module_Helper_Style_Processor',
								'process_extended_icon',
							),
						) );
					} else {
						self::set_style( $render_slug, array(
							'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-next::after',
							'declaration' => 'font-family: "ETmodules";',
						) );
					}
				}

				if ( '' !== $this->props['previous_slide_arrow'] ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev::after',
						'declaration' => 'display: flex; align-items: center; height: 100%; content: attr(data-previous_slide_arrow);',
					) );
					if ( class_exists( 'ET_Builder_Module_Helper_Style_Processor' ) && method_exists( 'ET_Builder_Module_Helper_Style_Processor', 'process_extended_icon' ) ) {
						$this->generate_styles( array(
							'utility_arg'    => 'icon_font_family',
							'render_slug'    => $render_slug,
							'base_attr_name' => 'previous_slide_arrow',
							'important'      => true,
							'selector'       => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev::after',
							'processor'      => array(
								'ET_Builder_Module_Helper_Style_Processor',
								'process_extended_icon',
							),
						) );
					} else {
						self::set_style( $render_slug, array(
							'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev::after',
							'declaration' => 'font-family: "ETmodules";',
						) );
					}
				}

				if ( 'on' === $show_arrow_on_hover ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev',
						'declaration' => 'visibility: hidden; opacity: 0; transition: all 300ms ease;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-next',
						'declaration' => 'visibility: hidden; opacity: 0; transition: all 300ms ease;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%%:hover .aioc_swiper_navigation .swiper-button-prev, %%order_class%%:hover .aioc_swiper_navigation .swiper-button-next',
						'declaration' => 'visibility: visible; opacity: 1;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%%:hover .aioc_swiper_navigation .swiper-button-prev.swiper-button-disabled, %%order_class%%:hover .aioc_swiper_navigation .swiper-button-next.swiper-button-disabled',
						'declaration' => 'opacity: 0.35;',
					) );
					
					// Outside Slider.
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_arrows_outside .swiper-button-prev',
						'declaration' => 'left: 50px;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_arrows_outside .swiper-button-next',
						'declaration' => 'right: 50px;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%%:hover .aioc_arrows_outside .swiper-button-prev',
						'declaration' => 'left: 0;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%%:hover .aioc_arrows_outside .swiper-button-next',
						'declaration' => 'right: 0;',
					) );

					// Inside Slider.
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_arrows_inside .swiper-button-prev',
						'declaration' => 'left: -50px;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .aioc_arrows_inside .swiper-button-next',
						'declaration' => 'right: -50px;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%%:hover .aioc_arrows_inside .swiper-button-prev',
						'declaration' => 'left: 0;',
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%%:hover .aioc_arrows_inside .swiper-button-next',
						'declaration' => 'right: 0;',
					) );
				}

				if ( 'on' === $use_arrow_background ) {
					if ( '' !== $arrow_background_color ) {
						self::set_style( $render_slug, array(
							'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev, %%order_class%% .aioc_swiper_navigation .swiper-button-next',
							'declaration' => sprintf( 'background: %1$s;', esc_attr( $arrow_background_color ) ),
						) );
					}
					if ( '' !== $arrow_background_color_hover ) {
						self::set_style( $render_slug, array(
							'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev:hover, %%order_class%% .aioc_swiper_navigation .swiper-button-next:hover',
							'declaration' => sprintf( 'background: %1$s;', esc_attr( $arrow_background_color_hover ) ),
						) );
					}
					if ( '' !== $arrow_background_border_size ) {
						self::set_style( $render_slug, array(
							'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev, %%order_class%% .aioc_swiper_navigation .swiper-button-next',
							'declaration' => sprintf( 'border-width: %1$s;', esc_attr( $arrow_background_border_size ) ),
						) );
					}
					if ( '' !== $arrow_shape_border_color ) {
						self::set_style( $render_slug, array(
							'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev, %%order_class%% .aioc_swiper_navigation .swiper-button-next',
							'declaration' => sprintf( 'border-color: %1$s;', esc_attr( $arrow_shape_border_color ) ),
						) );
					}
					if ( '' !== $arrow_shape_border_color_hover ) {
						self::set_style( $render_slug, array(
							'selector'    => '%%order_class%% .aioc_swiper_navigation .swiper-button-prev:hover, %%order_class%% .aioc_swiper_navigation .swiper-button-next:hover',
							'declaration' => sprintf( 'border-color: %1$s;', esc_attr( $arrow_shape_border_color_hover ) ),
						) );
					}
				}
			}

			// Pagination CSS.
			if ( 'on' === $show_control ) {
				if ( $control_dot_inactive_color ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .swiper-pagination-bullet',
						'declaration' => sprintf( 'background: %1$s;', esc_attr( $control_dot_inactive_color ) ),
					) );
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .transparent_dot .swiper-pagination-bullet',
						'declaration' => sprintf( 'border-color: %1$s;', esc_attr( $control_dot_inactive_color ) ),
					) );
				}
				if ( $control_dot_active_color ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .swiper-pagination-bullet.swiper-pagination-bullet-active',
						'declaration' => sprintf( 'background: %1$s;', esc_attr( $control_dot_active_color ) ),
					) );
				}
				if ( 'stretched_dot' === $control_dot_style && $transition_duration ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .stretched_dot .swiper-pagination-bullet',
						'declaration' => sprintf( 'transition: all %1$sms ease;', intval( $transition_duration ) ),
					) );
				}
				if ( ! empty( $number_dot_text_color ) ) {
					self::set_style( $render_slug, array(
						'selector'    => '%%order_class%% .swiper-pagination-bullet.number-bullet',
						'declaration' => sprintf( 'color: %1$s;', esc_attr( $number_dot_text_color ) ),
					) );
				}
			}

			// Equalize Post CSS.
			if ( 'on' === $equalize_posts_height ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-wrapper',
					'declaration' => 'align-items: stretch;',
				) );
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-slide article',
					'declaration' => 'height: 100%;',
				) );
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-slide .aioc_portfolio_content_wrapper',
					'declaration' => 'flex-grow: 1;',
				) );
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-slide',
					'declaration' => 'height: auto;',
				) );
			} elseif ( 1 === $post_per_slide ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-wrapper',
					'declaration' => 'align-items: center;',
				) );
			}

			$enable_linear_transition = $this->props['enable_linear_transition'];
			if ( 'on' === $enable_linear_transition ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .swiper-wrapper',
					'declaration' => 'transition-timing-function : linear !important;',
				) );
			}

			$output  = '<div class="aioc_swiper_wrapper">';
			$output .= '<div class="aioc_portfolio_carousel_container aioc_swiper_inner_wrap ' . sanitize_html_class( $slider_layout ) . '">';
			$output .= '<div class="swiper-container">';
			$output .= '<div class="swiper-wrapper">';

			$image_classes = 'aioc_portfolio_carousel_post_image';
			if ( 'on' === $disable_lazyload ) {
				$image_classes .= ' no-lazyload skip-lazy';
			}

			while ( $query->have_posts() ) {
				$query->the_post();

				$post_id = intval( get_the_ID() );

				$read_more_html = $this->render_button( array(
					'button_text'         => et_core_esc_previously( $read_more_text ),
					'button_text_escaped' => true,
					'button_url'          => esc_url( get_permalink( $post_id ) ),
					'url_new_window'      => 'on' === $link_target ? $link_target : '',
					'button_custom'       => isset( $custom_read_more ) ? esc_attr( $custom_read_more ) : 'off',
					'custom_icon'         => isset( $read_more_icon ) ? esc_attr( $read_more_icon ) : '',
					'has_wrapper'         => false,
				) );

				$thumb          = aioc_get_post_thumbnail( $post_id, esc_html( $featured_image_size ), $image_classes );

				$no_thumb_class = ( '' === $thumb || 'off' === $show_thumbnail ) ? ' aioc_portfolio_carousel_no_thumb' : '';
				$post_classes   = array_map( 'sanitize_html_class', get_post_class( 'aioc_portfolio_carousel_post' . $no_thumb_class ) );
				$post_classes   = implode( ' ', $post_classes );

				if ( file_exists( plugin_dir_path( __FILE__ ) . 'layouts/' . sanitize_file_name( $slider_layout ) . '.php' ) ) {
					include plugin_dir_path( __FILE__ ) . 'layouts/' . sanitize_file_name( $slider_layout ) . '.php';
				}
			}
			wp_reset_postdata();

			// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
			$wp_the_query = $query_backup;

			$output .= '</div> <!-- swiper-wrapper -->';
			$output .= '</div> <!-- swiper-container -->';

			if ( 'on' === $show_arrow ) {
				$next = sprintf(
					'<div class="swiper-button-next"%1$s></div>',
					'' !== $this->props['next_slide_arrow'] ?
					sprintf(
						' data-next_slide_arrow="%1$s"',
						esc_attr( et_pb_process_font_icon( $this->props['next_slide_arrow'] ) )
					) :
					''
				);
				$prev = sprintf(
					'<div class="swiper-button-prev"%1$s></div>',
					'' !== $this->props['previous_slide_arrow'] ?
					sprintf(
						' data-previous_slide_arrow="%1$s"',
						esc_attr( et_pb_process_font_icon( $this->props['previous_slide_arrow'] ) )
					) :
					''
				);
				if ( ! empty( $arrows_position ) ) {
					wp_enqueue_script( 'aioc-portfolio-carousel-custom', ALL_IN_ONE_CAROUSEL_FOR_DIVI_PATH ."includes/modules/PortfolioCarousel/aioc-portfolio-carousel-custom.min.js", array('jquery'), '1.0.0', true );
					$arrows_position_data = '';
					foreach( $arrows_position as $device => $value ) {
						$arrows_position_data .= ' data-arrows_' . $device . '="' . $value . '"';
					}
				}

				$output .= sprintf(
					'<div class="aioc_swiper_navigation"%3$s>%1$s %2$s</div>',
					$next,
					$prev,
					! empty( $arrows_position ) ? $arrows_position_data : ''
				);
			}
			$output .= '</div> <!-- aioc_portfolio_carousel_container -->';

			if ( 'on' === $show_control ) {
				$output .= sprintf(
					'<div class="aioc_swiper_pagination"><div class="swiper-pagination %1$s"></div></div>',
					esc_attr( $control_dot_style )
				);
			}

			$output .= '</div> <!-- aioc_swiper_wrapper -->';

			$script = $this->aioc_render_slider_script();
			$output .= $script;

			if ( '' === $thumb || 'off' === $show_thumbnail ) {
				self::set_style( $render_slug, array(
					'selector'    => '{$this->main_css_element} .layout1 .aioc_portfolio_content_wrapper',
					'declaration' => 'padding: 20px 30px;',
				) );
			}
			if ( isset( $read_more_icon ) ) {
				self::set_style( $render_slug, array(
					'selector'    => '%%order_class%% .aioc_portfolio_carousel_button_link .et_pb_button::after',
					'declaration' => 'content: attr(data-icon);',
				) );			
			}
			
			$args = array(
				'render_slug'	=> $render_slug,
				'props'			=> $this->props,
				'fields'		=> $this->fields_unprocessed,
				'module'		=> $this,
				'backgrounds' 	=> array(
					'post_content_wrapper_background' => array(
						'normal'    => "{$this->main_css_element} .aioc_portfolio_content_wrapper",
						'hover'     => "{$this->main_css_element} .aioc_portfolio_content_wrapper:hover",
					),
				),
			);
			AIOC_Helper::process_background( $args );

			$fields = array( 'slider_margin_padding' );
			AIOC_Helper::process_advanced_margin_padding_css( $this, $render_slug, $this->margin_padding, $fields );

		} else {
			$output = '<div className="entry">' . esc_html( $no_result_text ) . '</div>';
		}

		self::$rendering = false;
		return $output;
	}

	public function before_render() {
		$is_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, 'post_per_slide' );
		if ( ! $is_responsive ) {
			$post_per_slide = $this->props['post_per_slide'];
			if ( 'slide' === $this->props['slide_effect'] ) {
				$post_per_slide_tablet = $post_per_slide < 2 ? $post_per_slide : 2;
				$post_per_slide_mobile = 1;
			} elseif ( 'coverflow' === $this->props['slide_effect'] ) {
				$post_per_slide_tablet = 3;
				$post_per_slide_mobile = 1;
			}
			if ( isset( $post_per_slide_tablet ) && '' !== $post_per_slide_tablet ) {
				$this->props['post_per_slide_tablet'] = $post_per_slide_tablet;
			}
			if ( isset( $post_per_slide_mobile ) && '' !== $post_per_slide_mobile ) {
				$this->props['post_per_slide_phone'] = $post_per_slide_mobile;
			}
		}
	}

	public function aioc_render_slider_script() {
		$order_class              = $this->get_module_order_class( 'aioc_portfolio_carousel' );
		$slide_effect             = esc_attr( $this->props['slide_effect'] );
		$show_arrow               = esc_attr( $this->props['show_arrow'] );
		$slide_center_mode		  = 'on' === $this->props['slide_center_mode'] ? 'true' : 'false';
		$loop                     = esc_attr( $this->props['slider_loop'] );
		$autoplay                 = esc_attr( $this->props['autoplay'] );
		$autoplay_speed           = intval( $this->props['autoplay_speed'] );
		$transition_duration      = intval( $this->props['transition_duration'] );
		$pause_on_hover           = esc_attr( $this->props['pause_on_hover'] );
		$enable_coverflow_shadow  = 'on' === $this->props['enable_coverflow_shadow'] ? 'true' : 'false';
		$coverflow_rotate         = intval( $this->props['coverflow_rotate'] );
		$coverflow_depth          = intval( $this->props['coverflow_depth'] );
		$post_per_slide           = et_pb_responsive_options()->get_property_values( $this->props, 'post_per_slide', '', true );
		$space_between_slides     = et_pb_responsive_options()->get_property_values( $this->props, 'space_between_slides', '', true );
		$slides_per_group         = et_pb_responsive_options()->get_property_values( $this->props, 'slides_per_group', '', true );
		$show_control_dot         = esc_attr( $this->props['show_control_dot'] );		
		$dynamic_bullets		  = 'on' === $this->props['enable_dynamic_dots'] && in_array( $this->props['control_dot_style'], array( 'solid_dot', 'transparent_dot', 'square_dot', 'number_dot' ), true ) ? 'true' : 'false';
		$autoplay_speed           = '' !== $autoplay_speed || 0 !== $autoplay_speed ? $autoplay_speed : 3000;
		$transition_duration      = '' !== $transition_duration || 0 !== $transition_duration ? $transition_duration : 1000;
		$loop                     = 'on' === $loop ? 'true' : 'false';
		$arrows                   = 'false';
		$dots                     = 'false';
		$autoplaySlides           = 0;
		$cube                     = 'false';
		$coverflow                = 'false';
		$slidesPerGroup           = 1;
		$slidesPerGroupIpad       = 1;
		$slidesPerGroupMobile     = 1;
		$slidesPerGroupSkip       = 0;
		$slidesPerGroupSkipIpad   = 0;
		$slidesPerGroupSkipMobile = 0;

		if ( in_array( $slide_effect, array( 'slide', 'coverflow' ), true ) ) {
			$post_per_view             = $post_per_slide['desktop'];
			$post_per_view_ipad        = '' !== $post_per_slide['tablet'] ? $post_per_slide['tablet'] : $post_per_view;
			$post_per_view_mobile      = '' !== $post_per_slide['phone'] ? $post_per_slide['phone'] : $post_per_view_ipad;
			$post_space_between        = $space_between_slides['desktop'];
			$post_space_between_ipad   = '' !== $space_between_slides['tablet'] ? $space_between_slides['tablet'] : $post_space_between;
			$post_space_between_mobile = '' !== $space_between_slides['phone'] ? $space_between_slides['phone'] : $post_space_between_ipad;
			$slidesPerGroup            = $slides_per_group['desktop'];
			$slidesPerGroupIpad        = '' !== $slides_per_group['tablet'] ? $slides_per_group['tablet'] : $slidesPerGroup;
			$slidesPerGroupMobile      = '' !== $slides_per_group['phone'] ? $slides_per_group['phone'] : $slidesPerGroupIpad;

			if ( $post_per_view > $slidesPerGroup && 1 !== $slidesPerGroup ) {
				$slidesPerGroupSkip = $post_per_view - $slidesPerGroup;
			}
			if ( $post_per_view_ipad > $slidesPerGroupIpad && 1 !== $slidesPerGroupIpad ) {
				$slidesPerGroupSkipIpad = $post_per_view_ipad - $slidesPerGroupIpad;
			}
			if ( $post_per_view_mobile > $slidesPerGroupMobile && 1 !== $slidesPerGroupMobile ) {
				$slidesPerGroupSkipMobile = $post_per_view_mobile - $slidesPerGroupMobile;
			}
		} else {
			$post_per_view             = 1;
			$post_per_view_ipad        = 1;
			$post_per_view_mobile      = 1;
			$post_space_between        = 0;
			$post_space_between_ipad   = 0;
			$post_space_between_mobile = 0;
		}

		if ( in_array( $slide_effect, array( 'slide' ), true ) ) {
			$slide_center_mode = 'on' === $this->props['slide_center_mode'] ? 'true' : 'false';
		} else {
			$slide_center_mode = 'false';
		}
		if ( 'on' === $show_arrow ) {
			$arrows = "{    
				nextEl: '." . esc_attr( $order_class ) . " .swiper-button-next',
				prevEl: '." . esc_attr( $order_class ) . " .swiper-button-prev',
			}";
		}
		if ( 'on' === $show_control_dot ) {
			$number_dot = 'false';
			if ( 'number_dot' === $this->props['control_dot_style'] ) {
				$number_dot = "function (index, className) {
					return '<span class=\"' + className + ' number-bullet\">' + (index + 1) + ' </span>';
				}";
			}
			$dots = "{
				el: '." . esc_attr( $order_class ) . " .swiper-pagination',
				dynamicBullets: " . $dynamic_bullets . ",
				clickable: true,
				renderBullet: " . $number_dot . ",
			}";
		}
		if ( 'on' === $autoplay ) {
			if ( 'on' === $pause_on_hover ) {
				$autoplaySlides = '{
					delay:' . $autoplay_speed . ',
					disableOnInteraction: true,
				}';
			} else {
				$autoplaySlides = '{
					delay:' . $autoplay_speed . ',
					disableOnInteraction: false,
				}';
			}
		}
		if ( 'cube' === $slide_effect ) {
			$cube = '{
				shadow: false,
				slideShadows: false,
			}';
		}
		if ( 'coverflow' === $slide_effect ) {
			$coverflow = '{
				rotate: ' . $coverflow_rotate . ',
				stretch: 0,
				depth: ' . $coverflow_depth . ',
				modifier: 1,
				slideShadows : ' . $enable_coverflow_shadow . ',
			}';
		}

		$script  = '<script type="text/javascript">';
		$script .= 'jQuery(function($) {';

		$script .= 'var ' . esc_attr( $order_class ) . '_swiper = new Swiper(\'.' . esc_attr( $order_class ) . ' .swiper-container\', {
				slidesPerView: ' . $post_per_view . ',
				autoplay: ' . $autoplaySlides . ',
				centeredSlides: '.$slide_center_mode.',
				spaceBetween: ' . intval( $post_space_between ) . ',
				slidesPerGroup: ' . $slidesPerGroup . ',
				slidesPerGroupSkip: ' . $slidesPerGroupSkip . ',
				effect: "' . $slide_effect . '",
				cubeEffect: ' . $cube . ',
				coverflowEffect: ' . $coverflow . ',
				speed: ' . $transition_duration . ',
				loop: ' . $loop . ',
				pagination: ' . $dots . ',
				navigation: ' . $arrows . ',
				grabCursor: \'true\',
				observer: true,
				observeParents: true,
				breakpoints: {
					981: {
						slidesPerView: ' . $post_per_view . ',
						spaceBetween: ' . intval( $post_space_between ) . ',
						slidesPerGroup: ' . $slidesPerGroup . ',
						slidesPerGroupSkip: ' . $slidesPerGroupSkip . ',
					},
					768: {
						slidesPerView: ' . $post_per_view_ipad . ',
						spaceBetween: ' . intval( $post_space_between_ipad ) . ',
						slidesPerGroup: ' . $slidesPerGroupIpad . ',
						slidesPerGroupSkip: ' . $slidesPerGroupSkipIpad . ',
					},
					0: {
						slidesPerView: ' . $post_per_view_mobile . ',
						spaceBetween: ' . intval( $post_space_between_mobile ) . ',
						slidesPerGroup: ' . $slidesPerGroupMobile . ',
						slidesPerGroupSkip: ' . $slidesPerGroupSkipMobile . ',
					}
				},
		} );';

		if ( 'on' === $pause_on_hover && 'on' === $autoplay ) {
			$script .= '$(".' . esc_attr( $order_class ) . ' .swiper-container").on("mouseenter", function(e) {
				if ( typeof ' . esc_attr( $order_class ) . '_swiper.autoplay.stop === "function" ) {
					' . esc_attr( $order_class ) . '_swiper.autoplay.stop();
				}
			});';
			$script .= '$(".' . esc_attr( $order_class ) . ' .swiper-container").on("mouseleave", function(e) {
				if ( typeof ' . esc_attr( $order_class ) . '_swiper.autoplay.start === "function" ) {
					' . esc_attr( $order_class ) . '_swiper.autoplay.start();
				}
			});';
		}

		if ( 'true' !== $loop ) {
			$script .= esc_attr( $order_class ) . '_swiper.on(\'reachEnd\', function(){
				' . esc_attr( $order_class ) . '_swiper.autoplay = false;
			});';
		}
		$script .= '});</script>';

		return $script;
	}
}

new AIOC_PortfolioCarousel;
