/
home
/
rekodeb
/
webrennes
/
wp-content
/
plugins
/
windfall-core
/
elementor
/
widgets
/
Upload File
HOME
<?php /* * Elementor Windfall Callout Widget * Author & Copyright: VictorTheme */ namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Windfall_Callout extends Widget_Base{ /** * Retrieve the widget name. */ public function get_name(){ return 'vt-windfall_callout'; } /** * Retrieve the widget title. */ public function get_title(){ return esc_html__( 'Callout', 'windfall-core' ); } /** * Retrieve the widget icon. */ public function get_icon() { return 'fa fa-bullhorn'; } /** * Retrieve the list of categories the widget belongs to. */ public function get_categories() { return ['victortheme-category']; } /** * Retrieve the list of scripts the Windfall Callout widget depended on. * Used to set scripts dependencies required to run the widget. */ /* public function get_script_depends() { return ['vt-windfall_callout']; } */ /** * Register Windfall Callout widget controls. * Adds different input fields to allow the user to change and customize the widget settings. */ protected function register_controls(){ $this->start_controls_section( 'section_Callout', [ 'label' => esc_html__( 'Callout Options', 'windfall-core' ), ] ); $this->add_control( 'callout_content', [ 'label' => esc_html__( 'Content', 'windfall-core' ), 'default' => esc_html__( 'your content text', 'windfall-core' ), 'placeholder' => esc_html__( 'Type your content here', 'windfall-core' ), 'type' => Controls_Manager::TEXTAREA, 'label_block' => true, ] ); $this->add_responsive_control( 'section_max_width', [ 'label' => esc_html__( 'Content Width', 'windfall-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 200, 'max' => 1000, 'step' => 2, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .callout-title' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section();// end: Section // Button One $this->start_controls_section( 'section_steps_btn', [ 'label' => esc_html__( 'Button Options', 'windfall-core' ), ] ); $this->add_control( 'btn_text', [ 'label' => esc_html__( 'Button Text', 'windfall-core' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Button Text', 'windfall-core' ), 'placeholder' => esc_html__( 'Type btn text here', 'windfall-core' ), 'label_block' => true, ] ); $this->add_control( 'btn_link', [ 'label' => esc_html__( 'Button Link', 'windfall-core' ), 'type' => Controls_Manager::URL, 'placeholder' => 'https://your-link.com', 'default' => [ 'url' => '', ], 'label_block' => true, ] ); $this->end_controls_section();// end: Section // Content $this->start_controls_section( 'section_content_style', [ 'label' => esc_html__( 'Content', 'windfall-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'background_color', [ 'label' => esc_html__( 'Callout Background Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-callout' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'selector' => '{{WRAPPER}} .callout-title', ] ); $this->add_control( 'content_color', [ 'label' => esc_html__( 'Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .callout-title' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'content_padding', [ 'label' => __( 'Content Padding', 'windfall-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .callout-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section();// end: Section // Button One Style $this->start_controls_section( 'section_button_style', [ 'label' => esc_html__( 'Button', 'windfall-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'selector' => '{{WRAPPER}} .wndfal-callout .wndfal-btn', ] ); $this->add_responsive_control( 'button_min_width', [ 'label' => esc_html__( 'Width', 'windfall-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 500, 'step' => 1, ], ], 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .wndfal-callout .wndfal-btn' => 'min-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'button_padding', [ 'label' => __( 'Padding', 'windfall-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'selectors' => [ '{{WRAPPER}} .wndfal-callout .wndfal-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'button_border_radius', [ 'label' => __( 'Border Radius', 'windfall-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .wndfal-callout .wndfal-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'button_style' ); $this->start_controls_tab( 'button_normal', [ 'label' => esc_html__( 'Normal', 'windfall-core' ), ] ); $this->add_control( 'button_color', [ 'label' => esc_html__( 'Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-callout .wndfal-btn' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_bg_color', [ 'label' => esc_html__( 'Background Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-callout .wndfal-btn' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'buttn_border_color', [ 'label' => esc_html__( 'Border Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-border-btn .btn-text' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'label' => esc_html__( 'Border', 'windfall-core' ), 'selector' => '{{WRAPPER}} .wndfal-callout .wndfal-btn', ] ); $this->end_controls_tab(); // end:Normal tab $this->start_controls_tab( 'button_hover', [ 'label' => esc_html__( 'Hover', 'windfall-core' ), ] ); $this->add_control( 'button_hover_color', [ 'label' => esc_html__( 'Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-callout .wndfal-btn:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_bg_hover_color', [ 'label' => esc_html__( 'Background Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-callout .wndfal-btn:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_border_hover_color', [ 'label' => esc_html__( 'Border Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-btn:before, {{WRAPPER}} .wndfal-btn:after, {{WRAPPER}} .wndfal-btn .btn-text-wrap:before, {{WRAPPER}} .wndfal-btn .btn-text-wrap:after' => 'background: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_hover_border', 'label' => esc_html__( 'Border', 'windfall-core' ), 'selector' => '{{WRAPPER}} .wndfal-callout .wndfal-btn:hover', ] ); $this->end_controls_tab(); // end:Hover tab $this->end_controls_tabs(); // end tabs $this->end_controls_section();// end: Section } /** * Render Callout widget output on the frontend. * Written in PHP and used to generate the final HTML. */ protected function render() { $settings = $this->get_settings_for_display(); $callout_content = !empty( $settings['callout_content'] ) ? $settings['callout_content'] : ''; // Button One $btn_text = !empty( $settings['btn_text'] ) ? $settings['btn_text'] : ''; $btn_link = !empty( $settings['btn_link']['url'] ) ? $settings['btn_link']['url'] : ''; $btn_external = !empty( $settings['btn_link']['is_external'] ) ? 'target="_blank"' : ''; $btn_nofollow = !empty( $settings['btn_link']['nofollow'] ) ? 'rel="nofollow"' : ''; $btn_link_attr = !empty( $btn_link ) ? $btn_external.' '.$btn_nofollow : ''; $button_one = $btn_link ? '<a href="'.$btn_link.'" '.$btn_link_attr.' class="wndfal-btn wndfal-border-btn"><span class="btn-text-wrap"><span class="btn-text">'.$btn_text.'</span></span></a>' : '<span class="wndfal-btn wndfal-border-btn"><span class="btn-text-wrap"><span class="btn-text">'.$btn_text.'</span></span></span>'; $button_actual = $btn_text ? $button_one : ''; $callout_content = $callout_content ? '<h2 class="callout-title">'.$callout_content.'</h2>' : ''; $output = '<div class="wndfal-callout"> <div class="container"> <div class="row align-items-center"> <div class="col-lg-9"> '.$callout_content.' </div> <div class="col-lg-3 textright"> '.$button_actual.' </div> </div> </div> </div>'; echo $output; } /** * Render Callout widget output in the editor. * Written as a Backbone JavaScript template and used to generate the live preview. */ //protected function _content_template(){} } Plugin::instance()->widgets_manager->register_widget_type( new Windfall_Callout() );