register_content_section(); $this->register_animation_section(); $this->register_style_section(); $this->register_style_animated_section(); $this->eppro_register_entrance_animation_controls(); } // ── Content ─────────────────────────────────────────────────────────────── private function register_content_section(): void { $this->start_controls_section( 'section_content', [ 'label' => __( 'Content', 'admore-widgets-suite' ), ] ); $this->add_control( 'before_text', [ 'label' => __( 'Before Text', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'We build', 'admore-widgets-suite' ), 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'animated_text', [ 'label' => __( 'Animated Text', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXTAREA, 'default' => "amazing websites\nstunning designs\npowerful apps", 'description' => __( 'One phrase per line. These will rotate/type.', 'admore-widgets-suite' ), ] ); $this->add_control( 'after_text', [ 'label' => __( 'After Text', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'heading_tag', [ 'label' => __( 'HTML Tag', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'h2', 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', 'span' => 'span', 'p' => 'p', ], ] ); $this->add_control( 'link', [ 'label' => __( 'Link', 'admore-widgets-suite' ), 'type' => Controls_Manager::URL, ] ); $this->add_responsive_control( 'alignment', [ 'label' => __( 'Alignment', 'admore-widgets-suite' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-left' ], 'center' => [ 'title' => __( 'Center', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-center' ], 'right' => [ 'title' => __( 'Right', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-right' ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .eppro-ah-wrap' => 'text-align: {{VALUE}};' ], ] ); $this->end_controls_section(); } // ── Animation Settings ──────────────────────────────────────────────────── private function register_animation_section(): void { $this->start_controls_section( 'section_animation', [ 'label' => __( 'Animation', 'admore-widgets-suite' ), ] ); $this->add_control( 'animation_type', [ 'label' => __( 'Effect', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'typewriter', 'options' => [ 'typewriter' => __( 'Typewriter', 'admore-widgets-suite' ), 'rotate' => __( 'Rotate (Fade)', 'admore-widgets-suite' ), 'slide' => __( 'Slide Up', 'admore-widgets-suite' ), 'clip' => __( 'Clip', 'admore-widgets-suite' ), 'zoom' => __( 'Zoom', 'admore-widgets-suite' ), 'bounce' => __( 'Bounce', 'admore-widgets-suite' ), 'highlight' => __( 'Highlight', 'admore-widgets-suite' ), ], ] ); $this->add_control( 'highlight_shape', [ 'label' => __( 'Highlight Shape', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'underline', 'options' => [ 'underline' => __( 'Underline', 'admore-widgets-suite' ), 'double_line' => __( 'Double Underline', 'admore-widgets-suite' ), 'circle' => __( 'Circle', 'admore-widgets-suite' ), 'curly' => __( 'Curly', 'admore-widgets-suite' ), 'strikethrough' => __( 'Strikethrough', 'admore-widgets-suite' ), 'x' => __( 'X', 'admore-widgets-suite' ), ], 'condition' => [ 'animation_type' => 'highlight' ], ] ); $this->add_control( 'highlight_color', [ 'label' => __( 'Highlight Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#7c3aed', 'condition' => [ 'animation_type' => 'highlight' ], ] ); $this->add_control( 'highlight_width', [ 'label' => __( 'Highlight Stroke Width', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 20 ] ], 'default' => [ 'size' => 8 ], 'condition' => [ 'animation_type' => 'highlight' ], ] ); $this->add_control( 'type_speed', [ 'label' => __( 'Type Speed (ms)', 'admore-widgets-suite' ), 'type' => Controls_Manager::NUMBER, 'default' => 80, 'min' => 20, 'max' => 300, 'condition' => [ 'animation_type' => 'typewriter' ], ] ); $this->add_control( 'delete_speed', [ 'label' => __( 'Delete Speed (ms)', 'admore-widgets-suite' ), 'type' => Controls_Manager::NUMBER, 'default' => 40, 'min' => 10, 'max' => 200, 'condition' => [ 'animation_type' => 'typewriter' ], ] ); $this->add_control( 'pause_time', [ 'label' => __( 'Pause Between Phrases (ms)', 'admore-widgets-suite' ), 'type' => Controls_Manager::NUMBER, 'default' => 2000, 'min' => 500, 'max' => 10000, 'step' => 100, ] ); $this->add_control( 'loop', [ 'label' => __( 'Loop', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'show_cursor', [ 'label' => __( 'Show Cursor', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'animation_type' => 'typewriter' ], ] ); $this->add_control( 'cursor_char', [ 'label' => __( 'Cursor Character', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => '|', 'condition' => [ 'animation_type' => 'typewriter', 'show_cursor' => 'yes' ], ] ); $this->end_controls_section(); } // ── Style: Whole Heading ────────────────────────────────────────────────── private function register_style_section(): void { $this->start_controls_section( 'style_heading', [ 'label' => __( 'Heading', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'heading_typography', 'selector' => '{{WRAPPER}} .eppro-ah-heading', ] ); $this->add_control( 'heading_color', [ 'label' => __( 'Text Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-ah-heading' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'heading_shadow', 'selector' => '{{WRAPPER}} .eppro-ah-heading', ] ); $this->end_controls_section(); } // ── Style: Animated Part ────────────────────────────────────────────────── private function register_style_animated_section(): void { $this->start_controls_section( 'style_animated', [ 'label' => __( 'Animated Text', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'animated_color', [ 'label' => __( 'Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#7c3aed', 'selectors' => [ '{{WRAPPER}} .eppro-ah-animated' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'animated_typography', 'selector' => '{{WRAPPER}} .eppro-ah-animated', ] ); $this->add_control( 'animated_bg', [ 'label' => __( 'Background Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-ah-animated' => 'background-color: {{VALUE}}; padding: 0 0.15em;', ], ] ); $this->add_control( 'animated_radius', [ 'label' => __( 'Border Radius', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 20 ] ], 'selectors' => [ '{{WRAPPER}} .eppro-ah-animated' => 'border-radius: {{SIZE}}{{UNIT}};' ], ] ); $this->add_control( 'animated_gradient', [ 'label' => __( 'Gradient Text', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'description' => __( 'Apply a gradient effect to the animated text.', 'admore-widgets-suite' ), ] ); $this->add_control( 'gradient_from', [ 'label' => __( 'Gradient From', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#7c3aed', 'condition' => [ 'animated_gradient' => 'yes' ], 'selectors' => [ '{{WRAPPER}} .eppro-ah-animated.eppro-ah-gradient' => '--eppro-ah-grad-from: {{VALUE}};', ], ] ); $this->add_control( 'animated_gradient_to', [ 'label' => __( 'Gradient To', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#ec4899', 'condition' => [ 'animated_gradient' => 'yes' ], 'selectors' => [ '{{WRAPPER}} .eppro-ah-animated.eppro-ah-gradient' => '--eppro-ah-grad-to: {{VALUE}};', ], ] ); $this->add_responsive_control( 'animated_letter_spacing', [ 'label' => __( 'Letter Spacing', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em' ], 'range' => [ 'px' => [ 'min' => -2, 'max' => 20 ] ], 'selectors' => [ '{{WRAPPER}} .eppro-ah-animated' => 'letter-spacing: {{SIZE}}{{UNIT}};' ], 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'animated_text_shadow', 'selector' => '{{WRAPPER}} .eppro-ah-animated', ] ); $this->add_control( 'animated_bottom_border', [ 'label' => __( 'Bottom Border', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'animated_border_color', [ 'label' => __( 'Border Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#7c3aed', 'selectors' => [ '{{WRAPPER}} .eppro-ah-animated.eppro-ah-has-border' => 'border-bottom: 3px solid {{VALUE}};', ], 'condition' => [ 'animated_bottom_border' => 'yes' ], ] ); $this->add_control( 'cursor_color', [ 'label' => __( 'Cursor Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#7c3aed', 'selectors' => [ '{{WRAPPER}} .eppro-ah-cursor' => 'color: {{VALUE}};' ], 'separator' => 'before', 'condition' => [ 'animation_type' => 'typewriter' ], ] ); $this->end_controls_section(); } // ========================================================================= // Render // ========================================================================= protected function render(): void { $s = $this->get_settings_for_display(); $tag = in_array( $s['heading_tag'] ?? 'h2', [ 'h1','h2','h3','h4','h5','h6','div','span','p' ], true ) ? $s['heading_tag'] : 'h2'; $before = $s['before_text'] ?? ''; $after = $s['after_text'] ?? ''; $anim_type = sanitize_key( $s['animation_type'] ?? 'typewriter' ); $phrases = array_filter( array_map( 'trim', explode( "\n", $s['animated_text'] ?? '' ) ) ); $show_cursor = 'yes' === ( $s['show_cursor'] ?? 'yes' ) && 'typewriter' === $anim_type; $cursor_char = $s['cursor_char'] ?? '|'; if ( empty( $phrases ) ) { $phrases = [ __( 'amazing websites', 'admore-widgets-suite' ) ]; } $data = wp_json_encode( [ 'type' => $anim_type, 'phrases' => array_values( $phrases ), 'typeSpeed' => absint( $s['type_speed'] ?? 80 ), 'deleteSpeed' => absint( $s['delete_speed'] ?? 40 ), 'pauseTime' => absint( $s['pause_time'] ?? 2000 ), 'loop' => 'yes' === ( $s['loop'] ?? 'yes' ), 'highlightShape' => sanitize_key( $s['highlight_shape'] ?? 'underline' ), 'highlightColor' => $s['highlight_color'] ?? '#7c3aed', 'highlightWidth' => absint( $s['highlight_width']['size'] ?? 8 ), ], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); $link_url = $s['link']['url'] ?? ''; ?>