Sid Gifari File Manager
🏠 Root
/
home
/
ailwtbdh
/
public_html
/
wp-content
/
plugins
/
profundcore
/
addons
/
widgets
/
Editing: button.php
<?php namespace Elementor; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * profundcore button widget. * * profundcore widget that displays a button with the ability to control every * aspect of the button design. * * @since 1.0.0 */ class profund_Arrow_Button extends Widget_Base { /** * Get widget name. * * Retrieve button widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'profund_button'; } /** * Get widget title. * * Retrieve button widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return __( 'Button', 'profundcore' ); } /** * Get widget icon. * * Retrieve button widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'eicon-button'; } /** * Get widget categories. * * Retrieve the list of categories the button widget belongs to. * * Used to determine where to display the widget in the editor. * * @since 2.0.0 * @access public * * @return array Widget categories. */ public function get_categories() { return [ 'profund-addons' ]; } public function get_script_depends() { return [ 'lity', 'el-widget-active' ]; } public function get_style_depends() { return [ 'lity', ]; } /** * Register button widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @since 1.0.0 * @access protected */ protected function register_controls() { $this->start_controls_section( 'section_button', [ 'label' => __( 'Button', 'profundcore' ), ] ); $this->add_control( 'button_label', [ 'label' => __( 'Label', 'profundcore' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'text', [ 'label' => __( 'Text', 'profundcore' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'default' => __( 'button text', 'profundcore' ), 'placeholder' => __( 'type your button text...', 'profundcore' ), ] ); $this->add_control( 'link', [ 'label' => __( 'Link', 'profundcore' ), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true, ], 'placeholder' => __( 'https://your-link.com', 'profundcore' ), 'default' => [ 'url' => '#', ], ] ); $this->add_control( 'show_icon', [ 'label' => __( 'Enable Icon', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'profundcore' ), 'label_off' => __( 'Hide', 'profundcore' ), 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_control( 'icon', [ 'label' => __( 'Icon', 'profundcore' ), 'type' => Controls_Manager::ICON, 'label_block' => true, 'default' => 'fal fa-long-arrow-right', 'condition' => [ 'show_icon' => 'yes', ], ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'profundcore' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->add_control( 'button_css_id', [ 'label' => __( 'Button ID', 'profundcore' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'default' => '', 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'profundcore' ), 'label_block' => false, 'description' => __( 'Please make sure the ID is unique and not used elsewhere on the page this form is displayed. This field allows <code>A-z 0-9</code> & underscore chars without spaces.', 'profundcore' ), 'separator' => 'before', ] ); $this->add_control( 'lightbox_enabel', [ 'label' => __( 'Lightbox Enable', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'profundcore' ), 'label_off' => __( 'Hide', 'profundcore' ), 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_control( 'mouse_direction', [ 'label' => __( 'Direction Effect', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'profundcore' ), 'label_off' => __( 'Hide', 'profundcore' ), 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_responsive_control( 'button_wrap_align', [ 'label' => __( 'Alignment', 'profundcore' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'profundcore' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'profundcore' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'profundcore' ), 'icon' => 'fa fa-align-right', ] ], 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], 'separator' =>'before', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style', [ 'label' => __( 'Button', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_button_style' ); $this->start_controls_tab( 'tab_button_normal', [ 'label' => __( 'Normal', 'profundcore' ), ] ); $this->add_control( 'button_text_color', [ 'label' => __( 'Text Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default' => '#6e7c90', 'selectors' => [ '{{WRAPPER}} .arrow-button' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'background_color', 'label' => __( 'Background', 'profundcore' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .arrow-button', ] ); $this->add_responsive_control( 'button_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'default' => [ 'top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'isLinked' => false ], 'selectors' => [ '{{WRAPPER}}' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'button_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'default' => [ 'top' => '15', 'right' => '40', 'bottom' => '15', 'left' => '40', 'isLinked' => false ], 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .arrow-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'button_width', [ 'label' => __( 'Width', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}}, {{WRAPPER}} .arrow-button' => 'width: {{SIZE}}{{UNIT}};' ], ] ); $this->add_responsive_control( 'button_height', [ 'label' => __( 'Height', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .arrow-button' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'selector' => '{{WRAPPER}} .arrow-button', ] ); $this->add_control( 'button_radius', [ 'label' => __( 'Border Radius', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'default' => [ 'top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'isLinked' => false ], 'selectors' => [ '{{WRAPPER}} .arrow-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'button_box_shadow', 'selector' => '{{WRAPPER}} .arrow-button', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_button_hover', [ 'label' => __( 'Hover', 'profundcore' ), ] ); $this->add_control( 'button_hover_color', [ 'label' => __( 'Text Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default' => '#004dcc', 'selectors' => [ '{{WRAPPER}} .arrow-button:hover' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'hover_background', 'label' => __( 'Hover Background', 'profundcore' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .arrow-button:hover', ] ); $this->add_control( 'button_hover_border_color', [ 'label' => __( 'Border Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .arrow-button:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'button_hover_box_shadow', 'selector' => '{{WRAPPER}} .arrow-button:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'button_text_align', [ 'label' => __( 'Alignment', 'profundcore' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'profundcore' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'profundcore' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'profundcore' ), 'icon' => 'fa fa-align-right', ] ], 'selectors' => [ '{{WRAPPER}} .arrow-button' => 'text-align: {{VALUE}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'button_display', [ 'label' => __( 'Display', 'profundcore' ), 'type' => Controls_Manager::SELECT, 'default' => 'inline-block', 'options' => [ 'block' => __( 'Block', 'profundcore' ), 'inline-block' => __( 'Inline Block', 'profundcore' ), 'flex' => __( 'Flex', 'profundcore' ), ], 'selectors' => [ '{{WRAPPER}}, {{WRAPPER}} .arrow-button' => 'display: {{VALUE}};', ], ] ); $this->end_controls_section(); // Text Box Style tab section $this->start_controls_section( 'text_style_section', [ 'label' => __( 'Text Style', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'text!' => '' ] ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_text_typography', 'selector' => '{{WRAPPER}} .arrow-button .button-text .button-title', ] ); $this->add_control( 'button_title_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .arrow-button .button-text .button-title' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_title_color', [ 'label' => __( 'Hover Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .arrow-button:hover .button-text .button-title' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'button_text_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'default' => [ 'top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'isLinked' => true ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'button_text_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'default' => [ 'top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'isLinked' => true ], 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_text_border', 'label' => __( 'Border', 'profundcore' ), 'selector' => '{{WRAPPER}} .arrow-button .button-text', ] ); $this->end_controls_section(); // Text Box Style tab section $this->start_controls_section( 'label_style_section', [ 'label' => __( 'Label Style', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'button_label!' => '' ] ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_label_typography', 'selector' => '{{WRAPPER}} .arrow-button .button-text .top_label', ] ); $this->add_control( 'button_label_color', [ 'label' => __( 'Label Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .arrow-button .button-text .top_label' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_label_color', [ 'label' => __( 'Hover Label Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .arrow-button:hover .button-text .top_label' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'button_label_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'default' => [ 'top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'isLinked' => true ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-text .top_label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'button_label_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'default' => [ 'top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'isLinked' => true ], 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-text .top_label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_label_border', 'label' => __( 'Border', 'profundcore' ), 'selector' => '{{WRAPPER}} .arrow-button .button-text .top_label', ] ); $this->add_responsive_control( 'button_label_display', [ 'label' => __( 'Display', 'profundcore' ), 'type' => Controls_Manager::SELECT, 'default' => 'block', 'options' => [ 'block' => __( 'Block', 'profundcore' ), 'inline-block' => __( 'Inline Block', 'profundcore' ), 'flex' => __( 'Flex', 'profundcore' ), ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-text .top_label' => 'display: {{VALUE}};', ], ] ); $this->end_controls_section(); // Feature Style tab section $this->start_controls_section( 'box_icon_section', [ 'label' => __( 'Icon Style', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'show_icon' => 'yes' ] ] ); $this->add_control( 'button_icon_color', [ 'label' => __( 'Icon Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .arrow-button .button-icon' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_icon_color', [ 'label' => __( 'Hover Icon Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .arrow-button:hover .button-icon' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'icon_width', [ 'label' => __( 'Width', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-icon' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'icon_height', [ 'label' => __( 'Height', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-icon' => 'height: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .arrow-button .button-icon' => 'line-height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'icon_size', [ 'label' => __( 'Font Icon Size', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => 16, ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-icon' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'icon_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'default' => [ 'top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'isLinked' => false ], 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'icon_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'default' => [ 'top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'isLinked' => false ], 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'icon_floting', [ 'label' => __( 'Float', 'profundcore' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'profundcore' ), 'icon' => 'fa fa-align-left', ], 'none' => [ 'title' => __( 'Center', 'profundcore' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'profundcore' ), 'icon' => 'fa fa-align-right', ] ], 'selectors' => [ '{{WRAPPER}} .arrow-button .button-icon' => 'float: {{VALUE}};', ], 'separator' =>'before', ] ); $this->end_controls_section(); // Feature Style tab section $this->start_controls_section( 'button_dir_style', [ 'label' => __( 'Overlay', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'mouse_direction' => 'yes' ] ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'dir_background_color', 'label' => __( 'Background', 'profundcore' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .mouse-dir .dir-part', ] ); $this->end_controls_section(); } /** * Render button widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( 'button_attr', 'class', 'arrow-button' ); if( $settings['lightbox_enabel'] == 'yes' ){ $this->add_render_attribute( 'button_attr', 'data-lity', 'true' ); } if( $settings['mouse_direction'] == 'yes' ){ $this->add_render_attribute( 'button_attr', 'class', 'mouse-dir' ); } if( !empty($settings['button_css_id']) ){ $this->add_render_attribute( 'button_attr', 'id', 'arrow-button-'.$settings['button_css_id'] ); } // Link Generate if ( !empty( $settings['link']['url'] ) ) { $this->add_render_attribute( 'button_attr', 'href', esc_url($settings['link']['url']) ); if ( $settings['link']['is_external'] ) { $this->add_render_attribute( 'button_attr', 'target', '_blank' ); } if ( !empty( $settings['link']['nofollow'] ) ) { $this->add_render_attribute( 'button_attr', 'rel', 'nofollow' ); } } $output = $output_content = ''; if( !empty($settings['icon'] and $settings['show_icon'] == 'yes' )){ $output_content .= '<span class="button-icon">'; $output_content .= '<i class="'.esc_attr($settings['icon']).'"></i>'; $output_content .= '</span>'; } if( !empty($settings['text']) ){ $output_content .= '<span class="button-text">'.( (!empty($settings['button_label'])) ? '<span class="top_label">'.esc_html($settings['button_label']).'</span>' : '' ).'<span class="button-title" >'.esc_html($settings['text']).'</span></span>'; } if( $settings['mouse_direction'] == 'yes' ){ $output_content .= '<span class="dir-part" ></span>'; } if( !empty($output_content) ){ $output .= '<a '.$this->get_render_attribute_string( 'button_attr' ).'>'; $output .= $output_content; $output .= '</a>'; } echo $output; } } Plugin::instance()->widgets_manager->register_widget_type( new profund_Arrow_Button );
Save
Cancel