/
home
/
rekodeb
/
webrennes
/
wp-content
/
plugins
/
windfall-core
/
elementor
/
widgets
/
Upload File
HOME
<?php /* * Elementor Windfall Section Title Widget * Author & Copyright: VictorTheme */ namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Windfall_Section_Title extends Widget_Base{ /** * Retrieve the widget name. */ public function get_name(){ return 'vt-windfall_section_title'; } /** * Retrieve the widget title. */ public function get_title(){ return esc_html__( 'Section Title', 'windfall-core' ); } /** * Retrieve the widget icon. */ public function get_icon() { return 'fa fa-header'; } /** * Retrieve the list of categories the widget belongs to. */ public function get_categories() { return ['victortheme-category']; } /** * Retrieve the list of scripts the Windfall Section Title widget depended on. * Used to set scripts dependencies required to run the widget. */ /* public function get_script_depends() { return ['vt-windfall_section_title']; } */ /** * Register Windfall Section Title 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_sect_setting', [ 'label' => esc_html__( 'Settings', 'windfall-core' ), ] ); $this->add_control( 'section_title', [ 'label' => esc_html__( 'Title', 'windfall-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => esc_html__( 'Section Title', 'windfall-core' ), 'placeholder' => esc_html__( 'Type your title here', 'windfall-core' ), ] ); $this->add_control( 'section_content', [ 'label' => esc_html__( 'Content', 'windfall-core' ), 'type' => Controls_Manager::TEXTAREA, 'label_block' => true, 'default' => esc_html__( 'This is Content text', 'windfall-core' ), 'placeholder' => esc_html__( 'Type your content text here', 'windfall-core' ), ] ); $this->add_responsive_control( 'section_align', [ 'label' => esc_html__( 'Alignment', 'windfall-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'windfall-core' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'windfall-core' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'windfall-core' ), 'icon' => 'fa fa-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .wndfal-sectTitleElementor.section-title-wrap' => 'text-align: {{VALUE}};', ], ] ); $this->add_responsive_control( 'section_max_width', [ 'label' => esc_html__( 'Width', 'windfall-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 2, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .wndfal-sectTitleElementor' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'btn_txt', [ 'label' => esc_html__( 'Button Text', 'windfall-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'placeholder' => esc_html__( 'Type your button text here', 'windfall-core' ), ] ); $this->add_control( 'button_link', [ 'label' => esc_html__( 'Button Link', 'windfall-core' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'https://your-link.com', 'windfall-core' ), 'show_external' => true, 'default' => [ 'url' => '', 'is_external' => true, 'nofollow' => true, ], ] ); $this->end_controls_section();// end: Section $this->start_controls_section( 'section_title_style', [ 'label' => esc_html__( 'Title', 'windfall-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .wndfal-sectTitleElementor .section-title', ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-sectTitleElementor .section-title' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'section_bottom_space', [ 'label' => esc_html__( 'Section Bottom space', 'windfall-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, 'step' => 2, ], ], 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .wndfal-sectTitleElementor' => 'padding-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'title_bottom_space', [ 'label' => esc_html__( 'Title Bottom space', 'windfall-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, 'step' => 2, ], ], 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .wndfal-sectTitleElementor .section-title' => 'padding-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section();// end: Section $this->start_controls_section( 'section_content_style', [ 'label' => esc_html__( 'Content', 'windfall-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'selector' => '{{WRAPPER}} .wndfal-sectTitleElementor p', ] ); $this->add_control( 'content_color', [ 'label' => esc_html__( 'Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-sectTitleElementor p' => 'color: {{VALUE}};', ], ] ); $this->end_controls_section();// end: Section // Button 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-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-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-btn .btn-text' => '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-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-btn' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_bg_color', [ 'label' => esc_html__( 'Background Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-btn .btn-text-wrap' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'bttn_border_color', [ 'label' => esc_html__( 'Border Color', 'windfall-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .wndfal-border-btn .btn-text' => 'border-color: {{VALUE}};', ], ] ); $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-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-btn:hover .btn-text-wrap' => '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->end_controls_tab(); // end:Hover tab $this->end_controls_tabs(); // end tabs $this->end_controls_section();// end: Section } /** * Render Section Title widget output on the frontend. * Written in PHP and used to generate the final HTML. */ protected function render() { $settings = $this->get_settings_for_display(); $section_title = !empty( $settings['section_title'] ) ? $settings['section_title'] : ''; $section_content = !empty( $settings['section_content'] ) ? $settings['section_content'] : ''; $section_align = !empty( $settings['section_align'] ) ? $settings['section_align'] : ''; // Button $btn_text = !empty( $settings['btn_txt'] ) ? $settings['btn_txt'] : ''; $btn_link = !empty( $settings['button_link']['url'] ) ? $settings['button_link']['url'] : ''; $btn_external = !empty( $settings['button_link']['is_external'] ) ? 'target="_blank"' : ''; $btn_nofollow = !empty( $settings['button_link']['nofollow'] ) ? 'rel="nofollow"' : ''; $btn_link_attr = !empty( $btn_link ) ? $btn_external.' '.$btn_nofollow : ''; // Button Styling $button_main = $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 ? '<div class="wndfal-btns-group">'.$button_main.'</div>' : ''; $styled_class = ' wndfal-sectTitleElementor '; if($section_align === 'left') { $align_cls = 'section-left-align'; } elseif($section_align === 'right') { $align_cls = 'section-right-align'; } else { $align_cls = ''; } $sec_title = $section_title ? '<h2 class="section-title">'.$section_title.'</h2>' : ''; $sec_content = $section_content ? '<p>'.$section_content.'</p>' : ''; $output = ''; $output .= '<div class="section-title-wrap '.$align_cls.''.$styled_class.'">'.$sec_title.''.$sec_content.$button_actual.'</div>'; echo $output; } /** * Render Section Title 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_Section_Title() );