Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
firepot
/
wp-content
/
plugins
/
cyarb-toolkit
/
widgets
:
banner-five.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /** * Banner Five Widget */ namespace Elementor; class Cyarb_Banner_Five extends Widget_Base { public function get_name() { return 'Cyarb_BannerFive'; } public function get_title() { return __( 'Banner Five', '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 Five', '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( 'top_title', [ 'label' => __( 'Add Top Title', 'cyarb-toolkit' ), 'type' => Controls_Manager:: TEXTAREA, ] ); $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', ] ] ); $repeater->add_control( 'thumb_text', [ 'label' => esc_html__('Thumb Text', 'cyarb-toolkit'), 'type' => Controls_Manager:: TEXTAREA, ] ); $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_group_control( Group_Control_Background::get_type(), [ 'name' => 'top_title_color', 'label' => esc_html__( 'Top Title Color', 'cyarb-toolkit' ), 'types' => ['gradient' ], 'selector' => '{{WRAPPER}} .new-main-banner-slides-content .sub-title', ] ); $this->add_control( 'top_td', [ 'type' => Controls_Manager::DIVIDER, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'top_title_typography', 'label' => __( 'Top Title Typography', 'cyarb-toolkit' ), 'selector' => '{{WRAPPER}} .new-main-banner-slides-content .sub-title', ] ); $this->add_control( 'title_color', [ 'label' => __( 'Title Color', 'cyarb-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{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' => '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-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-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_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_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( 'thumb_text_color', [ 'label' => __( 'Thumb Text Color', 'cyarb-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .thumbs-wrap .owl-thumbs .owl-thumb-item span' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'thumb_text_actcolor', [ 'label' => __( 'Thumb Text Active Color', 'cyarb-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .thumbs-wrap .owl-thumbs .owl-thumb-item.active span, .thumbs-wrap .owl-thumbs .owl-thumb-item:hover span' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'thumb_Text_typography', 'label' => __( 'Thumb Text Typography', 'cyarb-toolkit' ), 'selector' => '{{WRAPPER}} .thumbs-wrap .owl-thumbs .owl-thumb-item span', ] ); $this->add_control( 'sec_bg_color', [ 'label' => __( 'Section Background Color', 'cyarb-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .new-main-banner-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-slides-area"> <div class="new-main-home-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-slides-item" style="background-image:url(<?php echo esc_url( $value['add_image']['url'] ); ?>);"> <div class="container-fluid"> <div class="new-main-banner-slides-content"> <span class="sub-title"><?php echo esc_html( $value['top_title'] ); ?></span> <<?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 class="thumbs-wrap"> <div class="owl-thumbs home-slides-thumb" data-slider-id="1"> <?php foreach ($slider as $key => $value): ?> <?php if( $value['thumb_text'] != '' ): ?> <div class="owl-thumb-item"> <span><?php echo wp_kses_post( $value['thumb_text'] ); ?></span> </div> <?php endif; ?> <?php endforeach; ?> </div> </div> </div> <?php } } Plugin::instance()->widgets_manager->register_widget_type( new Cyarb_Banner_Five );