<?php

// Porto Feature Box
add_shortcode('porto_feature_box', 'porto_shortcode_feature_box');
add_action('vc_after_init', 'porto_load_feature_box_shortcode');

function porto_shortcode_feature_box($atts, $content = null) {
    ob_start();
    if ($template = porto_shortcode_template('porto_feature_box'))
        include $template;
    return ob_get_clean();
}

function porto_load_feature_box_shortcode() {
    $animation_type = porto_vc_animation_type();
    $animation_duration = porto_vc_animation_duration();
    $animation_delay = porto_vc_animation_delay();
    $custom_class = porto_vc_custom_class();

    vc_map( array(
        "name" => "Porto " . __("Feature Box", 'porto-shortcodes'),
        "base" => "porto_feature_box",
        "category" => __("Porto", 'porto-shortcodes'),
        "icon" => "porto_vc_feature_box",
        "as_parent" => array('except' => 'porto_feature_box'),
        "content_element" => true,
        "controls" => "full",
        //'is_container' => true,
        "js_view" => 'VcColumnView',
        "params" => array(
            array(
                'type' => 'dropdown',
                'heading' => __('Skin Color', 'porto-shortcodes'),
                'param_name' => 'skin',
                'std' => 'custom',
                'value' => porto_sh_commons('colors'),
                'admin_label' => true
            ),
            array(
                'type' => 'checkbox',
                'heading' => __('Show Icon', 'porto-shortcodes'),
                'param_name' => 'show_icon',
                'value' => array(__('Yes, please', 'js_composer') => 'yes')
            ),
            array(
                'type' => 'dropdown',
                'heading' => __( 'Icon library', 'js_composer' ),
                'value' => array(
                    __( 'Font Awesome', 'porto-shortcodes' ) => 'fontawesome',
                    __( 'Simple Line Icon', 'porto-shortcodes' ) => 'simpleline',										__( 'Porto Icon', 'porto-shortcodes' ) => 'porto',
                    __( 'Custom Image Icon', 'porto-shortcodes' ) => 'image'
                ),
                'param_name' => 'icon_type',
                'dependency' => array('element' => 'show_icon', 'not_empty' => true)
            ),
            array(
                'type' => 'attach_image',
                'heading' => __('Select Icon', 'porto-shortcodes'),
                'dependency' => array('element' => 'icon_type', 'value' => 'image'),
                'param_name' => 'icon_image'
            ),
            array(
                'type' => 'iconpicker',
                'heading' => __('Select Icon', 'porto-shortcodes'),
                'param_name' => 'icon',
                'dependency' => array('element' => 'icon_type', 'value' => 'fontawesome')
            ),
            array(
                'type' => 'iconpicker',
                'heading' => __('Select Icon', 'porto-shortcodes'),
                'param_name' => 'icon_simpleline',
                'value' => '',
                'settings' => array(
                    'type' => 'simpleline',
                    'iconsPerPage' => 4000,
                ),
                'dependency' => array('element' => 'icon_type', 'value' => 'simpleline')
            ),						array(                'type' => 'iconpicker',                'heading' => __('Select Icon', 'porto-shortcodes'),                'param_name' => 'icon_porto',                'value' => '',                'settings' => array(                    'type' => 'porto',                    'iconsPerPage' => 4000,                ),                'dependency' => array('element' => 'icon_type', 'value' => 'porto')            ),			array(				"type" => "number",				"heading" => __("Size of Icon", "porto"),				"param_name" => "icon_size",				"value" => 14,				"min" => 12,				"max" => 72,				"suffix" => "px",				"description" => __("How big would you like it?", "porto"),				"dependency" => Array("element" => "icon_type","value" => array("fontawesome", "simpleline", "porto")),			),
            array(
                'type' => 'dropdown',
                'heading' => __('Box Style', 'porto-shortcodes'),
                'param_name' => 'box_style',
                'value' => porto_sh_commons('feature_box_style'),
                'admin_label' => true
            ),
            array(
                "type" => "dropdown",
                "heading" => __("Box Direction", 'porto-shortcodes'),
                "param_name" => "box_dir",
                "value" => porto_sh_commons('feature_box_dir'),
            ),
            $custom_class,
            $animation_type,
            $animation_duration,
            $animation_delay
        )
    ) );

    if (!class_exists('WPBakeryShortCode_Porto_Feature_Box')) {
        class WPBakeryShortCode_Porto_Feature_Box extends WPBakeryShortCodesContainer {
        }
    }
}