File "banner-six.php"
Full Path: /home/flipjqml/onlinebetsolution.com/next_old/wp-content/plugins/cyarb-toolkit/widgets/banner-six.php
File size: 15.86 KB
MIME-type: text/x-php
Charset: utf-8
<?php
/**
* Banner Six Widget
*/
namespace Elementor;
class Cyarb_Banner_Six extends Widget_Base {
public function get_name() {
return 'Cyarb_BannerSix';
}
public function get_title() {
return __( 'Banner Six', 'cyarb-toolkit' );
}
public function get_icon() {
return 'eicon-banner';
}
public function get_categories() {
return [ 'cyarb-elements' ];
}
protected function register_controls() {
$this->start_controls_section(
'Cyarb_Banner_Area',
[
'label' => __( 'Banner Six', 'cyarb-toolkit' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title_type',
[
'label' => __( 'Choose Heading Type', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => [
'h1' => __( 'h1', 'cyarb-toolkit' ),
'h2' => __( 'h2', 'cyarb-toolkit' ),
'h3' => __( 'h3', 'cyarb-toolkit' ),
'h4' => __( 'h4', 'cyarb-toolkit' ),
'h5' => __( 'h5', 'cyarb-toolkit' ),
'h6' => __( 'h6', 'cyarb-toolkit' ),
],
'default' => 'h1'
]
);
$repeater = new Repeater();
$repeater->add_control(
'add_image',
[
'label' => __('Add Banner Image', 'cyarb-toolkit' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
]
]
);
$repeater->add_control(
'banner_title', [
'label' => __( 'Add Banner Title', 'cyarb-toolkit' ),
'type' => Controls_Manager:: TEXTAREA,
]
);
$repeater->add_control(
'banner_desc',
[
'label' =>__('Banner Description', 'cyarb-toolkit'),
'type' => Controls_Manager:: WYSIWYG,
'description' => __('This text editor for p','cyarb-toolkit'),
]
);
$repeater->add_control(
'btn_text1',
[
'label' => esc_html__('Button One Title', 'cyarb-toolkit'),
'type' => Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'link_type',
[
'label' => esc_html__( 'Link Type', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => [
'1' => esc_html__( 'Link To Page', 'cyarb-toolkit' ),
'2' => esc_html__( 'External Link', 'cyarb-toolkit' ),
],
]
);
$repeater->add_control(
'link_to_page',
[
'label' => esc_html__( 'Link Page', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => cyarb_toolkit_get_page_as_list(),
'condition' => [
'link_type' => '1',
]
]
);
$repeater->add_control(
'external_link',
[
'label' => esc_html__('External Link', 'cyarb-toolkit'),
'type' => Controls_Manager:: TEXT,
'condition' => [
'link_type' => '2',
]
]
);
// Button Two
$repeater->add_control(
'btn_text2',
[
'label' => esc_html__('Button Two Title', 'cyarb-toolkit'),
'type' => Controls_Manager:: TEXT,
]
);
$repeater->add_control(
'link_type2',
[
'label' => esc_html__( 'Link Type 2', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => [
'1' => esc_html__( 'Link To Page', 'cyarb-toolkit' ),
'2' => esc_html__( 'External Link', 'cyarb-toolkit' ),
],
]
);
$repeater->add_control(
'link_to_page2',
[
'label' => esc_html__( 'Link Page', 'cyarb-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => cyarb_toolkit_get_page_as_list(),
'condition' => [
'link_type2' => '1',
]
]
);
$repeater->add_control(
'external_link2',
[
'label' => esc_html__('External Link', 'cyarb-toolkit'),
'type' => Controls_Manager:: TEXT,
'condition' => [
'link_type2' => '2',
]
]
);
$this->add_control(
'cyarb_slider_items',
[
'label' => esc_html__('Slider Item', 'cyarb-toolkit'),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_style',
[
'label' => __( 'Style', 'cyarb-toolkit' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_color',
[
'label' => __( 'Title Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .new-main-banner-wrap-slides-content h1, .new-main-banner-wrap-slides-content h2, .new-main-banner-wrap-slides-content h3, .new-main-banner-wrap-slides-content h4, .new-main-banner-wrap-slides-content h5, .new-main-banner-wrap-slides-content h6' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_type_typography',
'label' => __( 'Title Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .new-main-banner-slides-content h1, .new-main-banner-slides-content h2, .new-main-banner-slides-content h3, .new-main-banner-slides-content h4, .new-main-banner-slides-content h5, .new-main-banner-slides-content h6',
]
);
$this->add_control(
'content_color',
[
'label' => __( 'Content Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .new-main-banner-wrap-slides-content p' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'content_type_typography',
'label' => __( 'Content Type Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .new-main-banner-wrap-slides-content p',
]
);
$this->add_control(
'btn_color',
[
'label' => __( 'Button One Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .default-btn-two' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'btn_hcolor',
[
'label' => __( 'Button One Hover Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .default-btn-two:hover' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'btn_type_typography',
'label' => __( 'Button One Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .default-btn',
]
);
$this->add_control(
'btn2_color',
[
'label' => __( 'Button Two Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .optional-btn' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'btn2_hcolor',
[
'label' => __( 'Button Two Hover Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .optional-btn:hover' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'btn2_bordercolor',
[
'label' => __( 'Button Two Border Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .optional-btn' => 'border-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'btn2_type_typography',
'label' => __( 'Button Two Typography', 'cyarb-toolkit' ),
'selector' => '{{WRAPPER}} .optional-btn',
]
);
$this->add_control(
'btn1_bg_color',
[
'label' => esc_html__( 'Button One Background Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'btn1_bg_color',
'types' => ['gradient' ],
'selector' => '{{WRAPPER}} .default-btn-two',
]
);
$this->add_control(
'btn1divider',
[
'type' => Controls_Manager::DIVIDER,
]
);
$this->add_control(
'btn1_bg_hcolor',
[
'label' => esc_html__( 'Button One Background Hover Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'btn1_bg_hcolor',
'types' => ['gradient' ],
'selector' => '{{WRAPPER}} .default-btn-two:hover, .default-btn-two::before',
]
);
$this->add_control(
'btn2divider',
[
'type' => Controls_Manager::DIVIDER,
]
);
$this->add_control(
'btn2_bg_hcolor',
[
'label' => esc_html__( 'Button Two Background Hover Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'btn2_bg_hcolor',
'types' => ['gradient' ],
'selector' => '{{WRAPPER}} .new-main-banner-wrap-slides-content .banner-btn-box li .optional-btn::before',
]
);
$this->add_control(
'divider2',
[
'type' => Controls_Manager::DIVIDER,
]
);
$this->add_control(
'sec_bg_color',
[
'label' => __( 'Section Background Color', 'cyarb-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .new-main-banner-wrap-slides-item::before' => 'background-color: {{VALUE}}',
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$slider = $settings['cyarb_slider_items']; ?>
<div class="new-main-banner-wrap-slides-area">
<div class="new-main-home-wrap-slides owl-carousel owl-theme" data-slider-id="1">
<?php foreach ($slider as $key => $value):
$link_one = '';
if($value['link_type'] == 1){
$link_one = get_page_link($value['link_to_page']);
} else {
$link_one = $value['external_link'];
}
$link_two = '';
if($value['link_type2'] == 1){
$link_two = get_page_link($value['link_to_page2']);
} else {
$link_two = $value['external_link2'];
}
?>
<div class="new-main-banner-wrap-slides-item" style="background-image:url(<?php echo esc_url( $value['add_image']['url'] ); ?>);">
<div class="container">
<div class="new-main-banner-wrap-slides-content">
<<?php echo esc_attr($settings['title_type']);?>><?php echo esc_html( $value['banner_title'] ); ?></<?php echo esc_attr($settings['title_type']);?>>
<p><?php echo wp_kses_post( $value['banner_desc'] ); ?></p>
<?php if( $value['btn_text1'] != '' || $value['btn_text2'] != '' ): ?>
<ul class="banner-btn-box">
<?php if( $value['btn_text1'] != '' ): ?>
<li>
<a href="<?php echo esc_url( $link_one ); ?>" class="default-btn-two"><?php echo esc_html( $value['btn_text1'] ) ?></a>
</li>
<?php endif; ?>
<?php if( $value['btn_text2'] != '' ): ?>
<li>
<a href="<?php echo esc_url( $link_two ); ?>" class="optional-btn"><?php echo esc_html( $value['btn_text2'] ) ?></a>
</li>
<?php endif; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Cyarb_Banner_Six );