Your IP : 216.73.216.0
<?php
namespace Layerdrops\Zeinet\Widgets;
class Faq extends \Elementor\Widget_Base
{
public function get_name()
{
return 'zeinet-faq';
}
public function get_title()
{
return __('FAQ', 'zeinet-addon');
}
public function get_icon()
{
return 'eicon-cogs';
}
public function get_categories()
{
return ['zeinet-category'];
}
protected function register_controls()
{
$this->start_controls_section(
'layout_section',
[
'label' => __('Layout', 'zeinet-addon'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'layout_type',
[
'label' => __('Select Layout', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::SELECT2,
'default' => 'layout_one',
'options' => [
'layout_one' => __('Layout One', 'zeinet-addon'),
'layout_two' => __('Layout Two', 'zeinet-addon'),
'layout_three' => __('Layout Three', 'zeinet-addon'),
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_section',
[
'label' => __('Content', 'zeinet-addon'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
'condition' => [
'layout_type' => 'layout_one'
]
]
);
$this->add_control(
'layout_one_sec_title',
[
'label' => __('Section Title', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'placeholder' => __('Add title', 'zeinet-addon'),
'default' => __('Default Title', 'zeinet-addon'),
]
);
$this->add_control(
'layout_one_sec_sub_title',
[
'label' => __('Section Sub Title', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'placeholder' => __('Add Sub title', 'zeinet-addon'),
'default' => __('Default Sub Title', 'zeinet-addon'),
]
);
$this->add_control(
'layout_one_summary',
[
'label' => __('Summary', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'placeholder' => __('Add Summary', 'zeinet-addon'),
'default' => __('Default Summary text', 'zeinet-addon'),
]
);
$faq = new \Elementor\Repeater();
$faq->add_control(
'question',
[
'label' => __('Question', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXT,
'placeholder' => __('Add Question', 'zeinet-addon'),
'label_block' => true,
'default' => __('Default Question', 'zeinet-addon')
]
);
$faq->add_control(
'answer',
[
'label' => __('Answer', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'placeholder' => __('Add Answer', 'zeinet-addon'),
'label_block' => true,
'default' => __('Default Answer', 'zeinet-addon')
]
);
$faq->add_control(
'active_status',
[
'label' => __('Is active?', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'zeinet-addon'),
'label_off' => __('No', 'zeinet-addon'),
'return_value' => 'yes',
'default' => 'no',
]
);
$this->add_control(
'faq_lists',
[
'label' => __('FAQ', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $faq->get_controls(),
'title_field' => '{{{ question }}}',
]
);
$this->add_control(
'layout_one_image_one',
[
'label' => __('Image One', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [],
]
);
$this->end_controls_section();
$this->start_controls_section(
'layout_two_content_section',
[
'label' => __('Content', 'zeinet-addon'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
'condition' => [
'layout_type' => 'layout_two'
]
]
);
$layout_two_faq = new \Elementor\Repeater();
$layout_two_faq->add_control(
'question',
[
'label' => __('Question', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXT,
'placeholder' => __('Add Question', 'zeinet-addon'),
'label_block' => true,
'default' => __('Default Question', 'zeinet-addon')
]
);
$layout_two_faq->add_control(
'answer',
[
'label' => __('Answer', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'placeholder' => __('Add Answer', 'zeinet-addon'),
'label_block' => true,
'default' => __('Default Answer', 'zeinet-addon')
]
);
$layout_two_faq->add_control(
'active_status',
[
'label' => __('Is active?', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'zeinet-addon'),
'label_off' => __('No', 'zeinet-addon'),
'return_value' => 'yes',
'default' => 'no',
]
);
$this->add_control(
'layout_two_faq_lists',
[
'label' => __('FAQ', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $layout_two_faq->get_controls(),
'title_field' => '{{{ question }}}',
]
);
$this->end_controls_section();
$this->start_controls_section(
'layout_three_content_section',
[
'label' => __('Content', 'zeinet-addon'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
'condition' => [
'layout_type' => 'layout_three'
]
]
);
$this->add_control(
'layout_three_sec_title',
[
'label' => __('Section Title', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'placeholder' => __('Add title', 'zeinet-addon'),
'default' => __('Default Title', 'zeinet-addon')
]
);
$this->add_control(
'layout_three_sec_sub_title',
[
'label' => __('Section Sub Title', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'placeholder' => __('Add Sub title', 'zeinet-addon'),
'default' => __('Default Sub Title', 'zeinet-addon')
]
);
$layout_three_faq = new \Elementor\Repeater();
$layout_three_faq->add_control(
'question',
[
'label' => __('Question', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXT,
'placeholder' => __('Add Question', 'zeinet-addon'),
'label_block' => true,
'default' => __('Default Question', 'zeinet-addon')
]
);
$layout_three_faq->add_control(
'answer',
[
'label' => __('Answer', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'placeholder' => __('Add Answer', 'zeinet-addon'),
'label_block' => true,
'default' => __('Default Answer', 'zeinet-addon')
]
);
$layout_three_faq->add_control(
'image',
[
'label' => __('Image ', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [],
]
);
$layout_three_faq->add_control(
'active_status',
[
'label' => __('Is active?', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'zeinet-addon'),
'label_off' => __('No', 'zeinet-addon'),
'return_value' => 'yes',
'default' => 'no',
]
);
$this->add_control(
'layout_three_faq_lists',
[
'label' => __('FAQ', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $layout_three_faq->get_controls(),
'title_field' => '{{{ question }}}',
]
);
$this->add_control(
'layout_three_image',
[
'label' => __('Image ', 'zeinet-addon'),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$this->end_controls_section();
//General style
$this->start_controls_section(
'general_style',
[
'label' => esc_html__('Style Options', 'zeinet-addon'),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
]
);
zeinet_typo_and_color_options($this, 'Section Title', '{{WRAPPER}} .section-title__title', ['layout_one', 'layout_three']);
zeinet_typo_and_color_options($this, 'Section Sub Title', '{{WRAPPER}} .section-title__tagline', ['layout_one', 'layout_three']);
zeinet_typo_and_color_options($this, 'Question', '{{WRAPPER}} .faq-one-accrodion .accrodion-title h4,{{WRAPPER}} .faq-two__accrodion .accrodion .accrodion-title h4', ['layout_one', 'layout_two', 'layout_three']);
zeinet_typo_and_color_options($this, 'Answer', '{{WRAPPER}} .faq-one-accrodion .accrodion-content p,{{WRAPPER}} .faq-two__accrodion .accrodion .inner p', ['layout_one', 'layout_two', 'layout_three']);
$this->end_controls_section();
}
protected function render()
{
$settings = $this->get_settings_for_display();
include zeinet_get_template('faq-one.php');
include zeinet_get_template('faq-two.php');
include zeinet_get_template('faq-three.php');
}
}