<?php
/*
 * Templatation.com
 *
 * Banner with label slider for VC
 *
 */

function tt_lc_list_fn_vc()
{
    vc_map(
        array(
            "icon" => 'tt-vc-block',
            'name' => __('LC List', 'logiscargo'),
            'base' => 'tt_lc_list_shortcode',
            'description' => __('List box', 'logiscargo'),
            'as_parent' => array('only' => 'tt_lc_list_item_shortcode'),
            'content_element' => true,
            "js_view" => 'VcColumnView',
            "category" => __('Logiscargo', 'logiscargo'),
            'params' => array(
                array(
                    "type"       => "checkbox",
                    "heading"    => __ ( "Please click Save button below and then select its child shortcode to enter items.", 'logiscargo' ),
                    "description"    => __ ( "Above field is for information purpose only.", 'logiscargo' ),
                    "param_name" => "inffoo3",
                    "value"      => 'ok'
                ),
                array(
                    'type' => 'textfield',
                    'heading' => __( 'Extra class name', 'logiscargo' ),
                    'param_name' => 'el_class',
                    'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'logiscargo' ),
                ),
                array(
                    'type' => 'css_editor',
                    'heading' => __( 'Css', 'logiscargo' ),
                    'param_name' => 'css',
                    'group' => __( 'Design options', 'logiscargo' ),
                ),
            ),
        )
    );
}

add_action('vc_before_init', 'tt_lc_list_fn_vc');
// Nested Element
function tt_lc_list_item_fn_vc()
{
    vc_map(
        array(
            'name' => __('Item list', 'logiscargo'),
            'base' => 'tt_lc_list_item_shortcode',
            'description' => __('LC List Item', 'logiscargo'),
            "category" => __('Logiscargo', 'logiscargo'),
            'content_element' => true,
            'as_child' => array('only' => 'tt_lc_list_shortcode'), // Use only|except attributes to limit parent (separate multiple values with comma)
            'params' => array(
                array(
                    'type' => 'textfield',
                    'heading' => __('Name item', 'logiscargo'),
                    'param_name' => 'title',
                    'value' => '',
                    'description' => __('Enter list name', 'logiscargo'),
                ),
                array(
                    'type' => 'colorpicker',
                    'heading' => __('Item color', 'logiscargo'),
                    'param_name' => 'itemcolor',
                    'value' => '',
                ),
                array(
                    'type' => 'iconpicker',
                    'heading' => __('Type icon', 'logiscargo'),
                    'param_name' => 'type_icon',
                    'value' => '',
                    'settings' => array(
                        'emptyIcon' => true,
                        'iconsPerPage' => 300,
                    ),
                ),
                array(
                    'type' => 'colorpicker',
                    'heading' => __('Icon color', 'logiscargo'),
                    'param_name' => 'iconcolor',
                    'value' => '',
                ),
            ),
        )
    );
}

add_action('vc_before_init', 'tt_lc_list_item_fn_vc');

// A must for container functionality, replace Wbc_Item with your base name from mapping for parent container
if (class_exists('WPBakeryShortCodesContainer')) {
    class WPBakeryShortCode_tt_lc_list_shortcode extends WPBakeryShortCodesContainer
    {

    }
}

// Replace Wbc_Inner_Item with your base name from mapping for nested element
if (class_exists('WPBakeryShortCode')) {
    class WPBakeryShortCode_tt_lc_list_item_shortcode extends WPBakeryShortCode
    {

    }
}