<?php
/*
 * Templatation.com
 *
 * Social Accordion for VC
 *
 */

// Parent Element
function tt_lc_accordion_fn_vc() {
	vc_map( 
		array(
			"icon" => 'tt-vc-block',
		    'name'                    => esc_html__( 'LC Accordion FAQ' , 'logiscargo' ),
		    'base'                    => 'tt_lc_accordion_shortcode',
		    'description'             => esc_html__( 'Create accordion', 'logiscargo' ),
		    'as_parent'               => array('only' => 'tt_lc_accordion_content_shortcode'), // Use only|except attributes to limit child shortcodes (separate multiple values with comma)
		    'content_element'         => true,
		    "js_view" => 'VcColumnView',
			"category" => esc_html__('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'
                    ),
				),
			)
	);
}
add_action( 'vc_before_init', 'tt_lc_accordion_fn_vc' );

// Nested Element
function tt_lc_accordion_content_fn_vc() {
	
	vc_map(
		array(
			"icon" => 'tt-vc-block',
		    'name'            => esc_html__('Accordion Content', 'logiscargo'),
		    'base'            => 'tt_lc_accordion_content_shortcode',
		    'description'     => esc_html__( 'Content Element', 'logiscargo' ),
			"category" => esc_html__('Logiscargo', 'logiscargo'),
		    'content_element' => true,
		    'as_child'        => array('only' => 'tt_lc_accordion_shortcode'), // Use only|except attributes to limit parent (separate multiple values with comma)
		    'params'          => array(
		    	array(
		    		"type" => "textfield",
		    		"heading" => esc_html__("Title", 'logiscargo'),
		    		"param_name" => "title",
				    'description'     => esc_html__( 'Enter title for accordion.', 'logiscargo' ),
		    		'holder' => 'div'
		    	),
	            array(
	            	"type" => "textarea",
	            	"heading" => esc_html__("Block Content", 'logiscargo'),
				    'description'     => esc_html__( 'Enter content for accordion.', 'logiscargo' ),
	            	"param_name" => "content"
	            ),
				array(
					'type'       => 'checkbox',
					'heading'    => esc_html__( 'Check this to make item active', 'logiscargo' ),
					'param_name' => 'active',
					'value'      => array( esc_html__( 'Yes, please', 'logiscargo' ) => 'yes' ),
				),
			),
		) 
	);
}
add_action( 'vc_before_init', 'tt_lc_accordion_content_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_accordion_shortcode extends WPBakeryShortCodesContainer {

    }
}

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

    }
}