get_name(); } public function get_categories() { return [ 'addronix-addons-for-elementor' ]; } public function get_keywords() { return [ 'button', 'origin', 'circle', 'hover', 'expanding', 'directional' ]; } public function get_style_depends() { return [ 'aafe-origin-button-style' ]; } public function get_script_depends() { return [ 'aafe-origin-button-script' ]; } protected function register_controls() { /* ════════════════════════════════════════════════════════════════════════════ * CONTENT TAB * ════════════════════════════════════════════════════════════════════════════ */ $this->start_controls_section( 'section_content', [ 'label' => esc_html__( 'Button Content', 'addronix-addons-for-elementor' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'button_text', [ 'label' => esc_html__( 'Text', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Origin Button', 'addronix-addons-for-elementor' ), 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'button_link', [ 'label' => esc_html__( 'Link', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::URL, 'placeholder' => esc_html__( 'https://your-link.com', 'addronix-addons-for-elementor' ), 'default' => [ 'url' => '#', 'is_external' => false, 'nofollow' => false, ], 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'button_icon', [ 'label' => esc_html__( 'Icon', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::ICONS, ] ); $this->add_control( 'icon_position', [ 'label' => esc_html__( 'Icon Position', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'before' => esc_html__( 'Before Text', 'addronix-addons-for-elementor' ), 'after' => esc_html__( 'After Text', 'addronix-addons-for-elementor' ), ], 'default' => 'before', 'condition' => [ 'button_icon[value]!' => '', ], ] ); $this->add_responsive_control( 'icon_spacing', [ 'label' => esc_html__( 'Icon Spacing', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50 ] ], 'selectors' => [ '{{WRAPPER}} .aafe-origin-button' => 'gap: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'button_icon[value]!' => '', ], ] ); $this->end_controls_section(); /* ════════════════════════════════════════════════════════════════════════════ * STYLE TAB: BUTTON * ════════════════════════════════════════════════════════════════════════════ */ $this->start_controls_section( 'section_button_style', [ 'label' => esc_html__( 'Button Style', 'addronix-addons-for-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'button_align', [ 'label' => esc_html__( 'Alignment', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'addronix-addons-for-elementor' ), 'icon' => 'eicon-text-align-left' ], 'center' => [ 'title' => esc_html__( 'Center', 'addronix-addons-for-elementor' ), 'icon' => 'eicon-text-align-center' ], 'right' => [ 'title' => esc_html__( 'Right', 'addronix-addons-for-elementor' ), 'icon' => 'eicon-text-align-right' ], 'justify' => [ 'title' => esc_html__( 'Justify', 'addronix-addons-for-elementor' ), 'icon' => 'eicon-text-align-justify' ], ], 'default' => 'center', 'prefix_class' => 'aafe-origin-button-align-', ] ); $this->add_responsive_control( 'button_padding', [ 'label' => esc_html__( 'Padding', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .aafe-origin-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'hover_transition', [ 'label' => esc_html__( 'Hover Transition Speed (s)', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 's' ], 'range' => [ 's' => [ 'min' => 0.1, 'max' => 3, 'step' => 0.1 ] ], 'default' => [ 'unit' => 's', 'size' => 0.6 ], 'selectors' => [ '{{WRAPPER}} .aafe-origin-button' => '--aafe-transition: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'label' => esc_html__( 'Typography', 'addronix-addons-for-elementor' ), 'selector' => '{{WRAPPER}} .aafe-origin-button .aafe-origin-button__text', 'fields_options' => [ 'font_family' => [ 'default' => 'Inter' ], 'font_weight' => [ 'default' => '500' ], 'font_size' => [ 'default' => [ 'unit' => 'px', 'size' => 18 ] ], ], ] ); $this->start_controls_tabs( 'tabs_button_colors' ); // Normal State $this->start_controls_tab( 'tab_button_normal', [ 'label' => esc_html__( 'Normal', 'addronix-addons-for-elementor' ), ] ); $this->add_control( 'button_color', [ 'label' => esc_html__( 'Text Color', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#222425', 'selectors' => [ '{{WRAPPER}} .aafe-origin-button .aafe-origin-button__text, {{WRAPPER}} .aafe-origin-button .aafe-origin-button__icon' => 'color: {{VALUE}}; fill: {{VALUE}};' ], ] ); $this->add_control( 'button_bg_color', [ 'label' => esc_html__( 'Background Color', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .aafe-origin-button' => 'background-color: {{VALUE}};' ], ] ); $this->end_controls_tab(); // Hover State $this->start_controls_tab( 'tab_button_hover', [ 'label' => esc_html__( 'Hover', 'addronix-addons-for-elementor' ), ] ); $this->add_control( 'button_hover_color', [ 'label' => esc_html__( 'Hover Text Color', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .aafe-origin-button:hover .aafe-origin-button__text, {{WRAPPER}} .aafe-origin-button:hover .aafe-origin-button__icon' => 'color: {{VALUE}}; fill: {{VALUE}};' ], ] ); $this->add_control( 'button_hover_bg_color', [ 'label' => esc_html__( 'Hover Expanding Circle Color', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#222425', 'selectors' => [ '{{WRAPPER}} .aafe-origin-button::before' => 'background-color: {{VALUE}};' ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'button_border_radius', [ 'label' => esc_html__( 'Border Radius', 'addronix-addons-for-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .aafe-origin-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'label' => esc_html__( 'Border', 'addronix-addons-for-elementor' ), 'selector' => '{{WRAPPER}} .aafe-origin-button', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'button_box_shadow', 'label' => esc_html__( 'Box Shadow', 'addronix-addons-for-elementor' ), 'selector' => '{{WRAPPER}} .aafe-origin-button', ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( 'wrapper', 'class', 'aafe-origin-button-wrapper' ); $this->add_render_attribute( 'button', 'class', 'aafe-origin-button' ); if ( ! empty( $settings['button_link']['url'] ) ) { $this->add_link_attributes( 'button', $settings['button_link'] ); } $text = ! empty( $settings['button_text'] ) ? $settings['button_text'] : ''; $has_icon = ! empty( $settings['button_icon']['value'] ); $icon_html = ''; if ( $has_icon ) { ob_start(); Icons_Manager::render_icon( $settings['button_icon'], [ 'aria-hidden' => 'true' ] ); $icon_html = '' . ob_get_clean() . ''; } ?>
print_render_attribute_string( 'wrapper' ); ?>> print_render_attribute_string( 'button' ); ?>>