<?php if(! defined('ABSPATH')){ return; }
/*
 Name: Accordion
 Description: Create and display an Accordion element
 Class: TH_Accordion
 Category: content
 Level: 3
*/
/**
 * Class HT_Accordion
 *
 * Create and display an Accordion element
 *
 * @package  Kallyas
 * @category Page Builder
 * @author Team Hogash
 * @since 3.8.0
 */
class TH_Accordion extends ZnElements
{
	public static function getName(){
		return __( "Accordion", 'zn_framework' );
	}

	/**
	 * This method is used to display the output of the element.
	 * @return void
	 */
	function element()
	{

		$GLOBALS['options'] = array(
			'accordion' => $this->data['options']
		);
		include( 'inc/ui.inc.php' );
	}

	/**
	 * This method is used to retrieve the configurable options of the element.
	 * @return array The list of options that compose the element and then passed as the argument for the render() function
	 */
	function options()
	{
		$extra_options = array (
			"name"           => __( "Accordions", 'zn_framework' ),
			"description"    => __( "Here you can create your desired accordions.", 'zn_framework' ),
			"id"             => "accordion_single",
			"std"            => "",
			"type"           => "group",
			"group_sortable" => true,
			"subelements"    => array (
				array (
					"name"        => __( "Title", 'zn_framework' ),
					"description" => __( "Please enter a title for this accordion.", 'zn_framework' ),
					"id"          => "acc_single_title",
					"std"         => "",
					"type"        => "text"
				),
				array (
					"name"        => __( "Accordion content", 'zn_framework' ),
					"description" => __( "Please enter a content for this accordion.", 'zn_framework' ),
					"id"          => "acc_single_desc",
					"std"         => "",
					"type"        => "visual_editor",
					'class'		  => 'zn_full'
				),
				array (
					"name"        => __( "Auto Colapsed", 'zn_framework' ),
					"description" => __( "Select yes if you want this accordion to be visible on page load.", 'zn_framework' ),
					"id"          => "acc_colapsed",
					"std"         => "no",
					"options"     => array (
						'yes' => __( 'Yes', 'zn_framework' ),
						'no'  => __( 'No', 'zn_framework' )
					),
					"type"        => "select"
				)
			)
		);
		return array (
				array (
					"name"        => __( "Title", 'zn_framework' ),
					"description" => __( "Enter a title for your Accordion element", 'zn_framework' ),
					"id"          => "acc_title",
					"std"         => "",
					"type"        => "text",
				),
				array (
					"name"        => __( "Accordion Style", 'zn_framework' ),
					"description" => __( "Please select the style you want to use.", 'zn_framework' ),
					"id"          => "acc_style",
					"std"         => "default-style",
					"options"     => array (
						'default-style' => __( 'Style 1', 'zn_framework' ),
						'style2'        => __( 'Style 2', 'zn_framework' ),
						'style3'        => __( 'Style 3', 'zn_framework' ),
						'style4'        => __( 'Style 4', 'zn_framework' ),
					),
					"type"        => "select",
					'live' => array(
						'type'		=> 'class',
						'css_class' => '.'.$this->data['uid']
					)
				),
				$extra_options,
		);
	}
}
