<?php

class AIOC_ContentCarouselItem extends ET_Builder_Module {

	public $slug       = 'aioc_content_carousel_item';
	public $type       = 'child';
	public $vb_support = 'on';

	protected $module_credits = array(
		'module_uri' => 'https://diviextended.com/product/all-in-one-carousel-for-divi',
		'author'     => 'Elicus',
		'author_uri' => 'http://elicus.com',
	);
	
	public function init() {
		$this->name 						= esc_html__( 'Content Carousel Item', 'all-in-one-carousel-for-divi' );
		$this->advanced_setting_title_text  = esc_html__( 'Content', 'all-in-one-carousel-for-divi' );
        $this->child_title_var              = 'title';
		$this->main_css_element 			= '.aioc_content_carousel %%order_class%%';
		if ( is_archive() ) {
            $this->main_css_element = '%%order_class%%';
        }
		add_filter( 'et_builder_processed_range_value', array( $this, 'aioc_builder_processed_range_value' ), 10, 3 );
	}

	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' ),
					),
					'image' => array(
						'title' => esc_html__( 'Image', 'all-in-one-carousel-for-divi' ),
					),
					'button' => array(
						'title' => esc_html__( 'Button', 'all-in-one-carousel-for-divi' ),
					),
				),
			),
			'advanced' => array(
				'toggles' => array(
					'text_settings' => array(
						'title' => esc_html__( 'Content', 'all-in-one-carousel-for-divi' ),
						'sub_toggles'   => array(
                            'title' => array(
                                'name' => 'Title',
                            ),
                            'subtitle' => array(
                                'name' => 'Subtitle',
                            ),
                            'content' => array(
                                'name' => 'Content',
                            ),
                        ),
                        'tabbed_subtoggles' => true,
					),
					'image' => array(
						'title' => esc_html__( 'Image', 'all-in-one-carousel-for-divi' ),
					),
					'content_bg_settings' => array(
						'title' => esc_html__( 'Content Background', 'all-in-one-carousel-for-divi' ),
					),
					'button' => array(
						'title' => esc_html__( 'Button', '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' => '16px',
						'range_settings'   => array(
							'min'  => '1',
							'max'  => '100',
							'step' => '1',
						),
						'validate_unit'    => true,
					),
					'line_height'    => array(
						'default_on_front' => '1.2em',
						'range_settings'   => array(
							'min'  => '0.1',
							'max'  => '10',
							'step' => '0.1',
						),
					),
					'letter_spacing' => array(
						'default_on_front' => '',
						'range_settings'   => array(
							'min'  => '0',
							'max'  => '10',
							'step' => '1',
						),
						'validate_unit'    => true,
					),
					'header_level'  => array(
						'default'   => 'h4',
					),
					'css'            => array(
						'main' => "{$this->main_css_element} .aioc_slide_title",
						'important' => 'all',
					),
					'hide_text_align' => true,
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'title',
				),
				'subtitle' => array(
					'label'          => esc_html__( 'Subtitle', '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_on_front' => '1.2em',
						'range_settings'   => array(
							'min'  => '0.1',
							'max'  => '10',
							'step' => '0.1',
						),
					),
					'letter_spacing' => array(
						'default_on_front' => '0px',
						'range_settings'   => array(
							'min'  => '0',
							'max'  => '10',
							'step' => '1',
						),
						'validate_unit'    => true,
					),
					'header_level'  => array(
						'default'   => 'h5',
					),
					'css'            => array(
						'main' => "{$this->main_css_element} .aioc_slide_subtitle",
						'important' => 'all',
					),
					'hide_text_align' => true,
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'subtitle',
				),
				'content' => array(
					'label'          => esc_html__( 'Content', '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.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_slide_content",
						'important' => 'all',
					),
					'hide_text_align' => true,
					'tab_slug' => 'advanced',
					'toggle_slug' => 'text_settings',
					'sub_toggle' => 'content',
				),
			),
			'margin_padding' => array(
				'css' => array(
					'main'      => '%%order_class%%',
					'important' => 'all',
				),
			),
			'slide_content_margin_padding' => array(
                'image' => array(
                    'margin_padding' => array(
                        'css' => array(
                        	'margin' 	=> '%%order_class%% .aioc_slide_image_wrapper',
                            'padding'    => '%%order_class%% .aioc_slide_image_wrapper',
                            'important'  => 'all',
                        ),
                    ),
                ),
                'content' => array(
                    'margin_padding' => array(
                        'css' => array(
                        	'margin' 	=> '%%order_class%% .aioc_slide_inner_content_wrapper',
                            'padding'    => '%%order_class%% .aioc_slide_inner_content_wrapper',
                            'important'  => 'all',
                        ),
                    ),
                ),
            ),
            'button' => array(
			    'button' => array(
				    'label' => esc_html__( 'Button', 'all-in-one-carousel-for-divi' ),
				    'css' => array(
						'main'      => "{$this->main_css_element} .et_pb_button",
						'alignment' => "{$this->main_css_element} .et_pb_button_wrapper",
						'important' => 'all',
					),
		            'margin_padding' => array(
		                'custom_margin' => array(
		                    'default_on_front' => '20px||||false|false',
		                ),
						'css' => array(
							'margin'    => "{$this->main_css_element} .et_pb_button_wrapper",
							'padding'   => "{$this->main_css_element} .et_pb_button",
							'important' => 'all',
						),
		            ),
					'border_width'		=> array(
						'default' => '2px',
					),
					'box_shadow'      	=> false,
				    'depends_on'        => array( 'show_button' ),
		            'depends_show_if'   => 'on',
				    'tab_slug'          => 'advanced',
				    'toggle_slug'       => 'button',
			    ),
			),
			'max_width' => array(
				'default' => array(
					'css' => array(
						'main'             => '%%order_class%%',
						'module_alignment' => '%%order_class%%',
					),
				),
			),
			'height' => array(
				'css' => array(
					'main' => '%%order_class%%',
					'important' => 'all',
				),
			),
			'borders' => array(
				'image'  => array(
					'css'          => array(
						'main' => array(
							'border_radii'  => '.aioc_content_carousel %%order_class%% .aioc_slide_image',
							'border_styles' => '.aioc_content_carousel %%order_class%% .aioc_slide_image',
							'important'     => 'all',
						),
					),
					'label_prefix' => esc_html__( 'Image', 'all-in-one-carousel-for-divi' ),
					'tab_slug'     => 'advanced',
					'toggle_slug'  => 'image',
				),
				'default' => array(
					'css' => array(
						'main' => array(
							'border_styles' => '%%order_class%% .aioc_slide_wrapper',
							'border_radii'  => '%%order_class%% .aioc_slide_wrapper',
						),
						'important' => 'all',
					),
				),
			),
			'box_shadow' => array(
				'default' => array(
					'css' => array(
						'main' => '%%order_class%% .aioc_slide_wrapper',
					),
				),
			),
			'background' => array(
				'css' => array(
					'main' => '%%order_class%% .aioc_slide_wrapper',
				),
			),
			'text'    => false,
			'filters' => false,
			'text_shadow' => false,
		);
	}

	public function get_fields() {
		return array_merge(
			array(
				'title' => array(
					'label'           		=> esc_html__( 'Title', 'all-in-one-carousel-for-divi' ),
					'type'           		=> 'text',
					'option_category' 		=> 'basic_option',
					'tab_slug'        		=> 'general',
					'toggle_slug'     		=> 'main_content',
					'description'     		=> esc_html__( 'Here you can input the text to be used for the title.', 'all-in-one-carousel-for-divi' ),
				),
				'subtitle' => array(
					'label'           		=> esc_html__( 'Subtitle', 'all-in-one-carousel-for-divi' ),
					'type'           		=> 'text',
					'option_category' 		=> 'basic_option',
					'tab_slug'        		=> 'general',
					'toggle_slug'     		=> 'main_content',
					'description'     		=> esc_html__( 'Here you can input the text to be used for the subtitle.', 'all-in-one-carousel-for-divi' ),
				),
				'content' => array(
					'label'                 => esc_html__( 'Content', 'all-in-one-carousel-for-divi' ),
					'type'                  => 'tiny_mce',
					'option_category'       => 'basic_option',
					'toggle_slug'           => 'main_content',
					'description'           => esc_html__( 'Here you can input the text to be used for the content.', 'all-in-one-carousel-for-divi' ),
				),
				'content_length'       => array(
					'label'            => esc_html__( 'Content Length', 'all-in-one-carousel-for-divi' ),
					'type'             => 'text',
					'option_category'  => 'configuration',
					'default'		  => '250',
					'tab_slug'         => 'general',
					'toggle_slug'      => 'main_content',
					'description'      => esc_html__( 'Here you can define content length in characters, if 0 no content will be shown.', 'all-in-one-carousel-for-divi' ),
				),
				'image' => array(
					'label'                 => esc_html__( 'Image', 'all-in-one-carousel-for-divi' ),
					'type'                  => 'upload',
					'option_category'       => 'basic_option',
					'upload_button_text'    => esc_attr__( 'Upload an image', 'all-in-one-carousel-for-divi' ),
					'choose_text'           => esc_attr__( 'Choose an Image', 'all-in-one-carousel-for-divi' ),
					'update_text'           => esc_attr__( 'Set As Image', 'all-in-one-carousel-for-divi' ),
					'dynamic_content'  		=> 'image',
					'tab_slug'              => 'general',
					'toggle_slug'           => 'image',
					'description'           => esc_html__( 'Upload an image to display.', 'all-in-one-carousel-for-divi' ),
				),
				'image_alt' => array(
					'label'                 => esc_html__( 'Image Alt Text', 'all-in-one-carousel-for-divi' ),
					'type'                  => 'text',
					'option_category'       => 'basic_option',
					'tab_slug'              => 'general',
					'toggle_slug'           => 'image',
					'description'           => esc_html__( 'Here you can input the text to be used for the image as HTML ALT text.', 'all-in-one-carousel-for-divi' ),
				),
				'show_button' => array(
					'label'                 => esc_html__( 'Show Button', 'all-in-one-carousel-for-divi' ),
					'type'                  => 'yes_no_button',
					'option_category'       => 'basic_option',
					'options'               => array(
						'off'   => esc_html__( 'No', 'all-in-one-carousel-for-divi' ),
						'on'    => esc_html__( 'Yes', 'all-in-one-carousel-for-divi' ),
					),
					'affects'               => array(
					    'custom_button',
					),
					'default'               => 'off',
					'tab_slug'              => 'general',
					'toggle_slug'           => 'button',
					'description'           => esc_html__( 'Here you can choose whether or not display button.', 'all-in-one-carousel-for-divi' ),
				),
				'button_text' => array(
					'label'                 => esc_html__( 'Button Text', 'all-in-one-carousel-for-divi' ),
					'type'                  => 'text',
					'option_category'       => 'basic_option',
					'show_if'               => array(
					    'show_button'  => 'on',
					),
					'default'				=> esc_html__( 'Read More', 'all-in-one-carousel-for-divi' ),
					'default_on_front'		=> esc_html__( 'Read More', 'all-in-one-carousel-for-divi' ),
					'tab_slug'              => 'general',
					'toggle_slug'           => 'button',
					'description'           => esc_html__( 'Here you can input the text to be used for the Button.', 'all-in-one-carousel-for-divi' ),
				),
				'button_url' => array(
					'label'                 => esc_html__( 'Url', 'all-in-one-carousel-for-divi' ),
					'type'                  => 'text',
					'option_category'       => 'basic_option',
					'default'				=> '#',
					'default_on_front'		=> '#',
					'show_if'               => array(
					    'show_button'  => 'on',
					),
					'dynamic_content'  		=> 'url',
					'tab_slug'              => 'general',
					'toggle_slug'           => 'button',
					'description'           => esc_html__( 'Here you can input the URL that you want to open when the user clicks on the button.', 'all-in-one-carousel-for-divi' ),
				),
				'button_url_new_window' => array(
	                'label'             => esc_html__( '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',
	                'default_on_front'  => 'off',
	                'show_if'           => array(
					    'show_button'  => 'on',
					),
	                'tab_slug'          => 'general',
	                'toggle_slug'       => 'button',
	                'description'       => esc_html__( 'Here you can choose whether or not the link opens in a new window.', 'all-in-one-carousel-for-divi' ),
	            ),
				'image_custom_padding' => array(
	                'label'                 => esc_html__( 'Image Padding', 'all-in-one-carousel-for-divi' ),
	                'type'                  => 'custom_padding',
	                'option_category'       => 'layout',
	                'mobile_options'        => true,
	                'hover'                 => false,
	                'default'          		=> '||||true|true',
					'default_on_front' 		=> '||||true|true',
	                'tab_slug'              => 'advanced',
	                'toggle_slug'           => 'image',
	                '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' ),
	            ),
				'content_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'          		=> '20px|20px|20px|20px|true|true',
					'default_on_front' 		=> '20px|20px|20px|20px|true|true',
	                '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' ),
	            ),
				'content_custom_margin' => array(
	                'label'                 => esc_html__( 'Content Margin', 'all-in-one-carousel-for-divi' ),
	                'type'                  => 'custom_padding',
	                'option_category'       => 'layout',
	                'mobile_options'        => true,
	                'hover'                 => false,
	                'default'          		=> '||||true|true',
					'default_on_front' 		=> '||||true|true',
	                'tab_slug'              => 'advanced',
	                'toggle_slug'           => 'margin_padding',
	                'description'           => esc_html__( 'Margin adds extra space to the outside of the element, increasing the distance between the edge of the element and its inner contents.', 'all-in-one-carousel-for-divi' ),
	            ),
	            'content_bg_color' => array(
	                'label'                 => esc_html__( 'Content Background', 'all-in-one-carousel-for-divi' ),
	                'type'                  => 'background-field',
	                'base_name'             => 'content_bg',
	                'context'               => 'content_bg_color',
	                'option_category'       => 'button',
	                'custom_color'          => true,
	                'background_fields'     => $this->generate_background_options( 'content_bg', 'button', 'advanced', 'content_bg_settings', 'content_bg_color' ),
	                'hover'                 => 'tabs',
	                'tab_slug'              => 'advanced',
	                'toggle_slug'           => 'content_bg_settings',
	                'description'           => esc_html__( 'Customize the background style of the content box by adjusting the background color, gradient, and image.', 'all-in-one-carousel-for-divi' ),
	            ),
	        ),
			$this->generate_background_options( 'content_bg', 'skip', 'advanced', 'content_bg_settings', 'content_bg_color' )
		);

	}

	public function render( $attrs, $content, $render_slug ) {
		global $slide_effect, $enable_lightbox, $aioc_cc_disable_lazyload;

		$multi_view            		= et_pb_multi_view_options( $this );
		$button_text           		= sprintf( esc_html__( '%s', 'all-in-one-carousel-for-divi' ), $this->props['button_text'] );
		$button_url_new_window		= $this->props['button_url_new_window'];
		$image_alt 					= sprintf( esc_html__( '%s', 'all-in-one-carousel-for-divi' ), $this->props['image_alt'] );
		$slide_border_radius  		= '' !== $this->props['border_radii'] ? explode( '|', $this->props['border_radii'] ) : '';
		$title_level				= $this->props['title_level'];
		$subtitle_level				= $this->props['subtitle_level'];
		$processed_title_level 		= et_pb_process_header_level( $title_level, 'h4' );
		$processed_subtitle_level 	= et_pb_process_header_level( $subtitle_level, 'h5' );
		$processed_title_level 		= esc_html( $processed_title_level );
		$processed_subtitle_level 	= esc_html( $processed_subtitle_level );
		$content_length				= '' !== intval( $this->props['content_length'] ) ? intval( $this->props['content_length'] ) : 250;

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

		$image = $multi_view->render_element( array(
			'tag'      => 'img',
			'attrs'    => array(
				'src'          => '{{image}}',
				'data-mfp-src' => '{{image}}',
				'class'        => $image_classes,
				'alt'          => $image_alt,
			),
			'required' => 'image',
		) );

		$title = $multi_view->render_element( array(
			'tag'      => $processed_title_level,
			'content'  => '{{title}}',
			'attrs'    => array(
				'class' => 'aioc_slide_title',
			),
			'required' => 'title',
		) );
		$subtitle = $multi_view->render_element( array(
			'tag'      => $processed_subtitle_level,
			'content'  => '{{subtitle}}',
			'attrs'    => array(
				'class' => 'aioc_slide_subtitle',
			),
			'required' => 'subtitle',
		) );

		$contentLength = substr($content, 0, $content_length);
		$content = $multi_view->render_element( array(
			'tag'      => 'div',
			'content'  => $contentLength,
			'attrs'    => array(
				'class' => 'aioc_slide_content',
			),
			'required' => 'content',
		) );

		$button = $this->render_button( array(
			'display_button'	  => '' !== $this->props['button_url'] && 'off' !== $this->props['show_button'] ? true : false,
			'button_text'         => $button_text,
			'button_text_escaped' => true,
			'has_wrapper'      	  => true,
			'button_url'          => esc_url( $this->props['button_url'] ),
			'url_new_window'      => esc_attr( $this->props['button_url_new_window'] ),
			'button_custom'       => isset( $this->props['custom_button'] ) ? esc_attr( $this->props['custom_button'] ) : 'off',
			'custom_icon'         => isset( $this->props['button_icon'] ) ? $this->props['button_icon'] : '',
			'button_rel'          => isset( $this->props['button_rel'] ) ? esc_attr( $this->props['button_rel'] ) : '',
		) );

		if ( isset( $this->props['button_icon'] ) ){
			self::set_style( $render_slug, array(
				'selector'    => '%%order_class%% .et_pb_button_wrapper .et_pb_button::after',
				'declaration' => 'content: attr(data-icon);',
			) );			
		}

		if ( 'on' === $enable_lightbox ) {
			wp_enqueue_script( 'magnific-popup' );
			wp_enqueue_style( 'magnific-popup' );			
		}

		if ( '' !== $image ) {
			$image_wrapper = sprintf(
				'<div class="aioc_slide_image_wrapper">%1$s</div>',
				et_core_intentionally_unescaped( $image, 'html' )
			);
		}

		if ( '' !== $title || '' !== $subtitle || '' !== $content || '' !== $button ) {
			$content_wrapper = sprintf(
				'<div class="aioc_slide_content_wrapper">
					<div class="aioc_slide_inner_content_wrapper">%1$s%2$s%3$s%4$s</div>
				</div>',
				et_core_intentionally_unescaped( $title, 'html' ),
				et_core_intentionally_unescaped( $subtitle, 'html' ),
				et_core_intentionally_unescaped( $content, 'html' ),
				et_core_intentionally_unescaped( $button, 'html' )
			);
		}
		
		if ( isset( $image_wrapper ) || isset( $content_wrapper ) ) {
			$slide_wrapper = sprintf(
				'<div class="aioc_slide_wrapper">%1$s%2$s</div>',
				isset( $image_wrapper ) ? et_core_intentionally_unescaped( $image_wrapper, 'html' ) : '',
				isset( $content_wrapper ) ? et_core_intentionally_unescaped( $content_wrapper, 'html' ) : ''
			);
		} else {
			$slide_wrapper = '';
		}

		if ( !isset( $content_wrapper ) ){
			self::set_style( $render_slug, array(
				'selector'    => '%%order_class%% .aioc_slide_image_wrapper',
				'declaration' => 'height: 100%;',
			) );
		}
		
		if ( 'coverflow' === $slide_effect && '' !== $slide_border_radius ){	
			self::set_style( $render_slug, array(
				'selector'    => '%%order_class%% .aioc_slide_inner_content_wrapper',
				'declaration' => sprintf( 'border-radius: %1$s %2$s %3$s %4$s;', 
					$slide_border_radius[1],
					$slide_border_radius[2],
					$slide_border_radius[3],
					$slide_border_radius[4]
				),
			) );
		}

		$args = array(
			'render_slug'	=> $render_slug,
			'props'			=> $this->props,
			'fields'		=> $this->fields_unprocessed,
			'module'		=> $this,
			'backgrounds' 	=> array(
				'content_bg' => array(
					'normal' => "{$this->main_css_element} .aioc_slide_inner_content_wrapper",
					'hover' => "{$this->main_css_element} .aioc_slide_inner_content_wrapper:hover",
	 			),
			),
		);
		AIOC_Helper::process_background( $args );

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

		$background_layout_class_names = et_pb_background_layout_options()->get_background_layout_class( $this->props );
        $this->add_classname( array(
			$this->get_text_orientation_classname(),
			$background_layout_class_names[0],
			'aioc_slide_carousel_slide',
			'swiper-slide'
		) );

        $file = et_is_builder_plugin_active() ? 'style-dbp' : 'style';
		wp_enqueue_style( 'aioc-content-carousel-item-style', ALL_IN_ONE_CAROUSEL_FOR_DIVI_PATH . 'includes/modules/ContentCarouselItem/' . $file . '.min.css', array(), '1.0.0' );

		return $slide_wrapper;
	}

    /**
	 * Filter multi view value.
	 *
	 * @since 3.27.1
	 *
	 * @see ET_Builder_Module_Helper_MultiViewOptions::filter_value
	 *
	 * @param mixed                                     $raw_value Props raw value.
	 * @param array                                     $args {
	 *                                         Context data.
	 *
	 *     @type string $context      Context param: content, attrs, visibility, classes.
	 *     @type string $name         Module options props name.
	 *     @type string $mode         Current data mode: desktop, hover, tablet, phone.
	 *     @type string $attr_key     Attribute key for attrs context data. Example: src, class, etc.
	 *     @type string $attr_sub_key Attribute sub key that availabe when passing attrs value as array such as styes. Example: padding-top, margin-botton, etc.
	 * }
	 * @param ET_Builder_Module_Helper_MultiViewOptions $multi_view Multiview object instance.
	 *
	 * @return mixed
	 */
	public function multi_view_filter_value( $raw_value, $args, $multi_view ) {
		$name = isset( $args['name'] ) ? $args['name'] : '';
		$mode = isset( $args['mode'] ) ? $args['mode'] : '';

		if ( $raw_value && 'icon' === $name ) {
			$processed_value = html_entity_decode( et_pb_process_font_icon( $raw_value ) );
			if ( '%%1%%' === $raw_value ) {
				$processed_value = '"';
			}

			return $processed_value;
		}

		return $raw_value;
	}

	public function aioc_builder_processed_range_value( $result, $range, $range_string ) {
		if ( false !== strpos( $result, '0calc' ) ) {
			return $range;
		}
		return $result;
	}	

}

new AIOC_ContentCarouselItem;
