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

    /**
     * This method is used to display the output of the element.
     * @return void
     */
    function element()
    {
        $options = $this->data['options'];


        echo '<div class="features_boxes_2">';
            echo '<div class="row">';
            if (isset($options['fb_title']) && ! empty ( $options['fb_title'] ) ) {
                echo '<div class="features_boxes_title clearfix">';
                echo '<div class="col-sm-12">';
                echo '<h4 class="smallm_title centered bigger"><span>' . $options['fb_title'] . '</span></h4>';
                echo '</div>';
                echo '</div>';
            }
            if(isset($options['features_single2'])) {
                if (!empty ($options['features_single2']) && is_array($options['features_single2'])) {
                    echo '<div class="feature_boxes_list clearfix">';
                    foreach ($options['features_single2'] as $feat) {
                        echo '<div class="col-sm-6 col-lg-3 feature_box style3">';
                        echo '<div class="box">';
                        echo '<h4 class="title">' . $feat['fb_single_title'] . '</h4>';
                        echo '<span class="icon ' . $feat['fb_single_icon'] . '"></span>';
                        echo '<p>' . $feat['fb_single_desc'] . '</p>';
                        echo '</div><!-- end box -->';
                        echo '</div>';
                    }
                    echo '</div>';
                }
            }
            echo '</div>';
        echo '</div>';
    }

    /**
     * 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"           => __( "Features Boxes", 'zn_framework' ),
            "description"    => __( "Here you can create your desired features boxes.", 'zn_framework' ),
            "id"             => "features_single2",
            "std"            => "",
            "type"           => "group",
            "add_text"       => __( "Feature box", 'zn_framework' ),
            "remove_text"    => __( "Feature box", 'zn_framework' ),
            "group_sortable" => true,
            "subelements"    => array (
                array (
                    "name"        => __( "Feature title", 'zn_framework' ),
                    "description" => __( "Please enter a title for this feature box.", 'zn_framework' ),
                    "id"          => "fb_single_title",
                    "std"         => "",
                    "type"        => "text"
                ),
                array (
                    "name"        => __( "Feature description", 'zn_framework' ),
                    "description" => __( "Please enter a description for this feature
                                            box.", 'zn_framework' ),
                    "id"          => "fb_single_desc",
                    "std"         => "",
                    "type"        => "textarea"
                ),
                array (
                    "name"        => __( "Feature icon", 'zn_framework' ),
                    "description" => __( "Please select the desired icon to use.", 'zn_framework' ),
                    "id"          => "fb_single_icon",
                    "std"         => "ico1",
                    "options"     => array (
                        'ico1' => __( 'Chat', 'zn_framework' ),
                        'ico2' => __( 'Document', 'zn_framework' ),
                        'ico3' => __( 'Paint', 'zn_framework' ),
                        'ico4' => __( 'Code', 'zn_framework' )
                    ),
                    "type"        => "select",
                ),
            )
        );
        return array (
                array (
                    "name"        => __( "Title", 'zn_framework' ),
                    "description" => __( "Enter a title for your Features element", 'zn_framework' ),
                    "id"          => "fb_title",
                    "std"         => "",
                    "type"        => "text",
                ),
                $extra_options,
        );
    }
}
