get_settings_for_display(); $content_items = $settings['lqd_text_content']; if ( !empty( $settings['lqd_text_split_type'] ) ) { $behavior[] = [ 'behaviorClass' => 'LiquidSplitTextBehavior', 'options' => [ 'splitDoneFromBackend' => true, 'splitType' => "'" . $settings['lqd_text_split_type'] . "'" ] ]; } if ( $settings['lqd_adaptive_color'] === 'yes' ) { $behavior[] = [ 'behaviorClass' => 'LiquidGetElementComputedStylesBehavior', 'options' => [ 'includeSelf' => 'true', 'getRect' => 'true', 'getStyles' => ["'position'"], ] ]; $behavior[] = [ 'behaviorClass' => 'LiquidAdaptiveColorBehavior', ]; } foreach ( $content_items as $item ) { if ( !empty( $item['image']['url'] ) && !empty( $item['look_mouse'] ) ) { $behavior[] = [ 'behaviorClass' => 'LiquidLookAtMouseBehavior', ]; } } return $behavior; } public function get_behavior_pageContent() { $settings = $this->get_settings_for_display(); $adaptive_color = $settings['lqd_adaptive_color']; $behavior = []; if ( !$adaptive_color ){ return $behavior; } $behavior[] = [ 'behaviorClass' => 'LiquidGetElementComputedStylesBehavior', 'options' => [ 'includeChildren' => true, 'includeSelf' => true, 'getOnlyContainers' => true, 'getStyles' => ["'backgroundColor'"], 'getBrightnessOf' => ["'backgroundColor'"], 'getRect' => true ] ]; return $behavior; } protected function register_controls() { $elementor_doc_selector = '.elementor'; $dark_selectors = '[data-lqd-page-color-scheme=dark] {{WRAPPER}} .lqd-text-el, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark].elementor-element.elementor-element-{{ID}} .lqd-text-el, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark] .elementor-element.elementor-element-{{ID}} .lqd-text-el'; $dark_selectors_hover = '[data-lqd-page-color-scheme=dark] {{WRAPPER}}:hover .lqd-text-el, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark].elementor-element.elementor-element-{{ID}}:hover .lqd-text-el, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark] .elementor-element.elementor-element-{{ID}}:hover .lqd-text-el'; $dark_repeater_item_selectors = '[data-lqd-page-color-scheme=dark] {{WRAPPER}} {{CURRENT_ITEM}}, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark].elementor-element.elementor-element-{{ID}} {{CURRENT_ITEM}}, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark] .elementor-element.elementor-element-{{ID}} {{CURRENT_ITEM}}'; $dark_repeater_item_selectors_hover = '[data-lqd-page-color-scheme=dark] {{WRAPPER}}:hover {{CURRENT_ITEM}}, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark].elementor-element.elementor-element-{{ID}}:hover {{CURRENT_ITEM}}, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark] .elementor-element.elementor-element-{{ID}}:hover {{CURRENT_ITEM}}'; $this->start_controls_section( 'section_section_title', [ 'label' => __( 'Title', 'hub-elementor-elementor' ), ] ); $lqd_text_repeater = new Repeater(); $lqd_text_repeater->add_control( 'text', [ 'label' => esc_html__( 'Text', 'aihub-core' ), 'type' => Controls_Manager::TEXTAREA, 'default' => esc_html__( 'Edit this Liquid Text.' , 'aihub-core' ), 'label_block' => true, 'dynamic' => [ 'active' => true ] ] ); $lqd_text_repeater->add_control( 'item_link', [ 'label' => __( 'Item link', 'aihub-core' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'https://your-link.com', 'aihub-core' ), 'dynamic' => [ 'active' => true, ], 'show_external' => true, 'default' => [ 'url' => '', 'is_external' => false, 'nofollow' => false, ], ] ); $lqd_text_repeater->add_control( 'text_individual_styles', [ 'label' => esc_html__( 'Individual styling?', 'aihub-core' ), 'type' => Controls_Manager::SWITCHER, ] ); $lqd_text_repeater->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography', 'label' => __( 'Typography', 'aihub-core' ), 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}', 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'item_margin', [ 'label' => esc_html__( 'Margin', 'aihub-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'custom' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'item_padding', [ 'label' => esc_html__( 'Padding', 'aihub-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'custom' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->start_controls_tabs( 'item_colors_tab', ); $lqd_text_repeater->start_controls_tab( 'item_color_normal_tab', [ 'label' => esc_html__( 'Normal', 'aihub-core' ), 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'item_color', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'color: {{VALUE}}', ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( 'liquid-background-css', [ 'name' => 'item_background', 'label' => __( 'Background', 'aihub-core' ), 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}', 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'item_border', 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}', 'fields_options' => [ 'color' => [ 'type' => 'liquid-color', 'types' => [ 'solid' ], ], ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'item_border_radius', [ 'label' => esc_html__( 'Border radius', 'aihub-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'custom' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'item_opacity', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'opacity: {{SIZE}};', ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->end_controls_tab(); $lqd_text_repeater->start_controls_tab( 'item_color_hover_tab', [ 'label' => esc_html__( 'Hover', 'aihub-core' ), 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'item_color_hover', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ '{{WRAPPER}}:hover {{CURRENT_ITEM}}' => 'color: {{VALUE}}', ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( 'liquid-background-css', [ 'name' => 'item_background_hover', 'label' => __( 'Background', 'aihub-core' ), 'selector' => '{{WRAPPER}}:hover {{CURRENT_ITEM}}', 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'item_border_hover', 'selector' => '{{WRAPPER}}:hover {{CURRENT_ITEM}}', 'fields_options' => [ 'color' => [ 'type' => 'liquid-color', 'types' => [ 'solid' ], ], ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'item_border_radius_hover', [ 'label' => esc_html__( 'Border radius', 'aihub-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'custom' ], 'selectors' => [ '{{WRAPPER}}:hover {{CURRENT_ITEM}}' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'item_opacity_hover', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'selectors' => [ '{{WRAPPER}}:hover {{CURRENT_ITEM}}' => 'opacity: {{SIZE}};', ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->end_controls_tab(); $lqd_text_repeater->end_controls_tabs(); $lqd_text_repeater->add_control( 'v_align', [ 'label' => esc_html__( 'Vertical align', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => 'Default', 'baseline' => 'Baseline', 'sub' => 'Subscript', 'sup' => 'Superscript', 'top' => 'Top', 'text-top' => 'Text top', 'middle' => 'Middle', 'bottom' => 'Bottom', 'text-bottom' => 'Text bottom', ], 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'vertical-align: {{VALUE}};', ], 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Text_Stroke::get_type(), [ 'name' => 'text_stroke', 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'insert_image', [ 'label' => __( 'Image', 'aihub-core' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->start_popover(); $lqd_text_repeater->add_control( 'image', [ 'label' => esc_html__( 'Choose image', 'aihub-core' ), 'type' => Controls_Manager::MEDIA, 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'image_placement', [ 'label' => esc_html__( 'Placement', 'aihub-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => esc_html__( 'Start', 'aihub-core' ), 'icon' => 'eicon-h-align-left', ], 'end' => [ 'title' => esc_html__( 'End', 'aihub-core' ), 'icon' => 'eicon-h-align-right', ], 'floating' => [ 'title' => esc_html__( 'Floating', 'aihub-core' ), 'icon' => 'eicon-square', ], ], 'default' => 'end', 'toggle' => false, 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'image_placement_floating_orientation_h', [ 'label' => esc_html__( 'Horizontal orientation', 'aihub-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => esc_html__( 'Start', 'aihub-core' ), 'icon' => 'eicon-h-align-left', ], 'end' => [ 'title' => esc_html__( 'End', 'aihub-core' ), 'icon' => 'eicon-h-align-right', ], ], 'toggle' => false, 'default' => 'start', 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes', 'image_placement' => 'floating', ] ] ); $lqd_text_repeater->add_responsive_control( 'image_placement_floating_offset_x', [ 'label' => esc_html__( 'Horizontal offset', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'vw', 'custom' ], 'default' => [ 'unit' => '%', 'size' => '0' ], 'range' => [ 'px' => [ 'min' => -500, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => -100, 'max' => 100, 'step' => 1 ], 'vw' => [ 'min' => -100, 'max' => 100, 'step' => 1 ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .lqd-text-img' => 'inset-inline-end: auto; inset-inline-start: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes', 'image_placement' => 'floating', 'image_placement_floating_orientation_h' => 'start' ] ] ); $lqd_text_repeater->add_responsive_control( 'image_placement_floating_offset_x_end', [ 'label' => esc_html__( 'Horizontal offset', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'vw', 'custom' ], 'default' => [ 'unit' => '%', 'size' => '0' ], 'range' => [ 'px' => [ 'min' => -500, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => -100, 'max' => 100, 'step' => 1 ], 'vw' => [ 'min' => -100, 'max' => 100, 'step' => 1 ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .lqd-text-img' => 'inset-inline-start: auto; inset-inline-end: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes', 'image_placement' => 'floating', 'image_placement_floating_orientation_h' => 'end' ] ] ); $lqd_text_repeater->add_responsive_control( 'image_placement_floating_orientation_v', [ 'label' => esc_html__( 'Vertical orientation', 'aihub-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'top' => [ 'title' => esc_html__( 'Top', 'aihub-core' ), 'icon' => 'eicon-v-align-top', ], 'bottom' => [ 'title' => esc_html__( 'Bottom', 'aihub-core' ), 'icon' => 'eicon-v-align-bottom', ], ], 'toggle' => false, 'default' => 'bottom', 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes', 'image_placement' => 'floating', ] ] ); $lqd_text_repeater->add_responsive_control( 'image_placement_floating_offset_y', [ 'label' => esc_html__( 'Vertical offset', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'vh', 'custom' ], 'default' => [ 'unit' => '%', 'size' => '0' ], 'range' => [ 'px' => [ 'min' => -500, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => -100, 'max' => 100, 'step' => 1 ], 'vh' => [ 'min' => -100, 'max' => 100, 'step' => 1 ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .lqd-text-img' => 'bottom: auto; top: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes', 'image_placement' => 'floating', 'image_placement_floating_orientation_v' => 'top', ] ] ); $lqd_text_repeater->add_responsive_control( 'image_placement_floating_offset_y_bottom', [ 'label' => esc_html__( 'Vertical offset', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'vh', 'custom' ], 'default' => [ 'unit' => '%', 'size' => '0' ], 'range' => [ 'px' => [ 'min' => -500, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => -100, 'max' => 100, 'step' => 1 ], 'vh' => [ 'min' => -100, 'max' => 100, 'step' => 1 ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .lqd-text-img' => 'top: auto; bottom: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes', 'image_placement' => 'floating', 'image_placement_floating_orientation_v' => 'bottom', ] ] ); $lqd_text_repeater->add_responsive_control( 'image_width', [ 'label' => esc_html__( 'Width', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'vw' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 1000, ], 'vw' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} img' => 'width: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'image_v_align', [ 'label' => esc_html__( 'Vertical align', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'baseline' => 'Baseline', 'sub' => 'Subscript', 'sup' => 'Superscript', 'top' => 'Top', 'text-top' => 'Text top', 'middle' => 'Middle', 'bottom' => 'Bottom', 'text-bottom' => 'Text bottom', ], 'default' => 'middle', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} img' => 'vertical-align: {{VALUE}};', ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_border', 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}} img', 'fields_options' => [ 'color' => [ 'type' => 'liquid-color', 'types' => [ 'solid' ], ], ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'border_radius', [ 'label' => esc_html__( 'Border radius', 'aihub-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'image_margin', [ 'label' => esc_html__( 'Margin', 'aihub-core' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'custom' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'look_mouse', [ 'label' => esc_html__( 'Look at cursor?', 'aihub-core' ), 'type' => Controls_Manager::SWITCHER, 'separator' => 'before', ] ); $lqd_text_repeater->end_popover(); $lqd_text_repeater->add_control( 'enable_highlight', [ 'label' => __( 'Highlight', 'aihub-core' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->start_popover(); $lqd_text_repeater->add_control( 'highlight_style', [ 'label' => __( 'Style', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'default' => 'lqd-highlight-basic', 'options' => [ 'lqd-highlight-basic' => __( 'Basic', 'aihub-core' ), 'lqd-highlight-custom lqd-highlight-custom-1' => __( 'Custom 1', 'aihub-core' ), 'lqd-highlight-custom lqd-highlight-custom-2' => __( 'Custom 2', 'aihub-core' ), 'lqd-highlight-custom lqd-highlight-custom-3' => __( 'Custom 3', 'aihub-core' ), 'lqd-highlight-custom lqd-highlight-custom-4' => __( 'Custom 4', 'aihub-core' ), 'lqd-highlight-custom lqd-highlight-custom-5' => __( 'Custom 5', 'aihub-core' ), 'lqd-highlight-custom lqd-highlight-custom-6' => __( 'Custom 6', 'aihub-core' ), ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'highlight_fill_color', 'types' => [ 'classic', 'gradient' ], 'exclude' => [ 'image' ], // By default selector is the element itself 'selector' => '', 'fields_options' => [ 'background' => [ 'default' => 'classic', ], 'color' => [ 'type' => 'liquid-color', 'types' => ['solid'], ], 'color_b' => [ 'type' => 'liquid-color', 'types' => ['solid'], ], 'gradient_type' => [ 'type' => Controls_Manager::HIDDEN ] ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ], ] ); $lqd_text_repeater->add_control( 'highlight_extra_svg_fill_color', [ 'label' => __( 'Pen color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .lqd-highlight-pen' => 'fill: {{VALUE}};' ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', 'highlight_style' => 'lqd-highlight-custom lqd-highlight-custom-2' ] ] ); $lqd_text_repeater->add_control( 'highlight_animation_divider', [ 'type' => Controls_Manager::DIVIDER, ] ); $lqd_text_repeater->add_responsive_control( 'highlight_animation_duration', [ 'label' => esc_html__( 'Animation duration', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, ], ], 'default' => [ 'size' => '0.85' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => '--lqd-highlight-animation-duration: {{SIZE}}s;', ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ], ] ); $lqd_text_repeater->add_responsive_control( 'highlight_animation_delay', [ 'label' => esc_html__( 'Animation delay', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => '--lqd-highlight-animation-delay: {{SIZE}}s;', ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ] ] ); $lqd_text_repeater->add_responsive_control( 'highlight_width', [ 'label' => esc_html__( 'Width', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', '%' ], 'default' => [ 'unit' => '%', 'size' => '100' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => '--lqd-highlight-width: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ] ] ); $lqd_text_repeater->add_responsive_control( 'highlight_height', [ 'label' => esc_html__( 'Height', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', '%' ], 'default' => [ 'unit' => '%', 'size' => '100' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => '--lqd-highlight-height: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ] ] ); $lqd_text_repeater->add_responsive_control( 'highlight_offset_bottom', [ 'label' => esc_html__( 'Offset from bottom', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', '%', 'custom' ], 'range' => [ 'px' => [ 'min' => -300, 'max' => 300, ], 'em' => [ 'min' => -10, 'max' => 10, ], '%' => [ 'min' => -100, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => '0' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => '--lqd-highlight-offset-bottom: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ] ] ); $lqd_text_repeater->add_responsive_control( 'highlight_offset_left', [ 'label' => esc_html__( 'Offset from start', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', '%', 'custom' ], 'range' => [ 'px' => [ 'min' => -300, 'max' => 300, ], 'em' => [ 'min' => -10, 'max' => 10, ], '%' => [ 'min' => -100, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => '0' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => '--lqd-highlight-offset-start: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ] ] ); $lqd_text_repeater->add_responsive_control( 'highlight_opacity', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05 ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => '--lqd-highlight-opacity: {{SIZE}};', ], 'condition' => [ 'enable_highlight' => 'yes', 'text_individual_styles' => 'yes', ] ] ); $lqd_text_repeater->end_popover(); // Highlight $lqd_text_repeater->add_control( 'enable_item_mask', [ 'label' => __( 'Mask & gradient', 'aihub-core' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->start_popover(); $lqd_text_repeater->add_control( 'item_mask_type', [ 'label' => esc_html__( 'Mask type', 'aihub-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'color' => [ 'title' => esc_html__( 'Color', 'aihub-core' ), 'icon' => 'eicon-paint-brush', ], 'image' => [ 'title' => esc_html__( 'Image', 'aihub-core' ), 'icon' => 'eicon-image-bold', ], ], 'default' => 'color', 'condition' => [ 'enable_item_mask' => 'yes', 'text_individual_styles' => 'yes', ] ] ); $lqd_text_repeater->add_control( 'item_mask_color', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.lqd-text-item' => 'background: {{VALUE}}; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; text-fill-color: transparent !important;' ], 'condition' => [ 'enable_item_mask' => 'yes', 'text_individual_styles' => 'yes', 'item_mask_type' => 'color' ] ] ); $lqd_text_repeater->add_control( 'item_mask_gradient_parallax', [ 'label' => esc_html__( 'Parallax gradient?', 'aihub-core' ), 'type' => Controls_Manager::SWITCHER, 'description' => esc_html__( 'This option only works in desktop and gradient mask.', 'aihub-core' ), 'selectors' => [ '(desktop+){{WRAPPER}} {{CURRENT_ITEM}}.lqd-text-item' => 'background-attachment: fixed' ], 'condition' => [ 'enable_item_mask' => 'yes', 'text_individual_styles' => 'yes', 'item_mask_type' => 'color' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'item_mask_image', 'types' => [ 'classic' ], 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.lqd-text-item', 'fields_options' => [ 'background' => [ 'type' => Controls_Manager::HIDDEN, 'default' => 'classic', 'selectors' => [ '{{SELECTOR}}' => '-webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; text-fill-color: transparent !important;' ] ], 'color' => [ 'type' => Controls_Manager::HIDDEN, ], ], 'condition' => [ 'enable_item_mask' => 'yes', 'text_individual_styles' => 'yes', 'item_mask_type' => 'image' ] ] ); $lqd_text_repeater->end_popover(); // Mask text $lqd_text_repeater->add_control( 'blend_mode', [ 'label' => esc_html__( 'Blend mode', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__( 'Normal', 'aihub-core' ), 'multiply' => 'Multiply', 'screen' => 'Screen', 'overlay' => 'Overlay', 'darken' => 'Darken', 'lighten' => 'Lighten', 'color-dodge' => 'Color Dodge', 'hard-light' => 'Hard light', 'saturation' => 'Saturation', 'color' => 'Color', 'difference' => 'Difference', 'exclusion' => 'Exclusion', 'hue' => 'Hue', 'luminosity' => 'Luminosity', ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.lqd-text-item' => 'mix-blend-mode: {{VALUE}}', ], 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'position', [ 'label' => esc_html__( 'Position', 'aihub-core' ), 'type' => Controls_Manager::DIMENSIONS, 'allowed_dimensions' => ['top', 'left'], 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'top: {{TOP}}{{UNIT}}; left: {{LEFT}}{{UNIT}};', ], 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'item_z_index', [ 'label' => esc_html__( 'Z-index', 'aihub-core' ), 'type' => Controls_Manager::NUMBER, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'z-index: {{VALUE}};', ], 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'dark_repeater_text_heading', [ 'label' => __( 'Dark 🌘', 'aihub-core' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'dark_insert_image', [ 'label' => __( 'Image', 'aihub-core' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->start_popover(); $lqd_text_repeater->add_control( 'dark_image', [ 'label' => esc_html__( 'Choose image', 'aihub-core' ), 'type' => Controls_Manager::MEDIA, 'condition' => [ 'dark_insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'dark_image_border', 'selector' => $dark_repeater_item_selectors . ' img', 'fields_options' => [ 'color' => [ 'type' => 'liquid-color', 'types' => [ 'solid' ], ], ], 'condition' => [ 'dark_insert_image' => 'yes', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->end_popover(); $lqd_text_repeater->add_control( 'dark_enable_item_mask', [ 'label' => __( 'Mask & gradient', 'aihub-core' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'separator' => 'before', 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->start_popover(); $lqd_text_repeater->add_control( 'dark_item_mask_type', [ 'label' => esc_html__( 'Mask type', 'aihub-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'color' => [ 'title' => esc_html__( 'Color', 'aihub-core' ), 'icon' => 'eicon-paint-brush', ], 'image' => [ 'title' => esc_html__( 'Image', 'aihub-core' ), 'icon' => 'eicon-image-bold', ], ], 'default' => 'color', 'condition' => [ 'text_individual_styles' => 'yes', 'dark_enable_item_mask' => 'yes', ] ] ); $lqd_text_repeater->add_control( 'dark_item_mask_color', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'selectors' => [ $dark_repeater_item_selectors => 'background: {{VALUE}}; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; text-fill-color: transparent !important;' ], 'condition' => [ 'text_individual_styles' => 'yes', 'dark_enable_item_mask' => 'yes', 'dark_item_mask_type' => 'color' ] ] ); $lqd_text_repeater->add_control( 'dark_item_mask_gradient_parallax', [ 'label' => esc_html__( 'Parallax gradient?', 'aihub-core' ), 'type' => Controls_Manager::SWITCHER, 'description' => esc_html__( 'This option only works in desktop and gradient mask.', 'aihub-core' ), 'selectors' => [ '(desktop+)' . $dark_repeater_item_selectors => 'background-attachment: fixed' ], 'condition' => [ 'text_individual_styles' => 'yes', 'dark_enable_item_mask' => 'yes', 'dark_item_mask_type' => 'color' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'dark_item_mask_image', 'types' => [ 'classic' ], 'selector' => $dark_repeater_item_selectors, 'fields_options' => [ 'background' => [ 'type' => Controls_Manager::HIDDEN, 'default' => 'classic', 'selectors' => [ '{{SELECTOR}}' => '-webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; text-fill-color: transparent !important;' ] ], 'color' => [ 'type' => Controls_Manager::HIDDEN, ], ], 'condition' => [ 'text_individual_styles' => 'yes', 'dark_enable_item_mask' => 'yes', 'dark_item_mask_type' => 'image' ] ] ); $lqd_text_repeater->end_popover(); // Mask text $lqd_text_repeater->start_controls_tabs( 'dark_item_colors_tab' ); $lqd_text_repeater->start_controls_tab( 'dark_item_color_normal_tab', [ 'label' => esc_html__( 'Normal', 'aihub-core' ), 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'dark_item_color', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ $dark_repeater_item_selectors => 'color: {{VALUE}}', ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( 'liquid-background-css', [ 'name' => 'dark_item_background', 'label' => __( 'Background', 'aihub-core' ), 'selector' => $dark_repeater_item_selectors, 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'dark_item_border', 'selector' => $dark_repeater_item_selectors, 'fields_options' => [ 'color' => [ 'type' => 'liquid-color', 'types' => [ 'solid' ], ], ], 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'dark_item_opacity', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'selectors' => [ $dark_repeater_item_selectors => 'opacity: {{SIZE}};', ], 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->end_controls_tab(); $lqd_text_repeater->start_controls_tab( 'dark_item_color_hover_tab', [ 'label' => esc_html__( 'Hover', 'aihub-core' ), 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_control( 'dark_item_color_hover', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ $dark_repeater_item_selectors_hover => 'color: {{VALUE}}', ], 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( 'liquid-background-css', [ 'name' => 'dark_item_background_hover', 'label' => __( 'Background', 'aihub-core' ), 'selector' => $dark_repeater_item_selectors_hover, 'condition' => [ 'enable_item_mask' => '', 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'dark_item_border_hover', 'selector' => $dark_repeater_item_selectors_hover, 'fields_options' => [ 'color' => [ 'type' => 'liquid-color', 'types' => [ 'solid' ], ], ], 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->add_responsive_control( 'dark_item_opacity_hover', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'selectors' => [ $dark_repeater_item_selectors_hover => 'opacity: {{SIZE}};', ], 'condition' => [ 'text_individual_styles' => 'yes' ] ] ); $lqd_text_repeater->end_controls_tab(); $lqd_text_repeater->end_controls_tabs(); $this->add_control( 'lqd_text_content', [ 'label' => esc_html__( 'Content', 'aihub-core' ), 'type' => Controls_Manager::REPEATER, 'fields' => $lqd_text_repeater->get_controls(), 'default' => [ [ 'text' => esc_html__( 'Edit this Liquid Text.', 'aihub-core' ) ], ], 'title_field' => '{{{ text }}}', 'button_text' => esc_html__( 'Add a span', 'aihub-core' ) ] ); $this->add_control( 'lqd_text_link', [ 'label' => __( 'Link', 'aihub-core' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'https://your-link.com', 'aihub-core' ), 'dynamic' => [ 'active' => true, ], 'show_external' => true, 'default' => [ 'url' => '', 'is_external' => false, 'nofollow' => false, ], ] ); $this->add_control( 'lqd_text_tag', [ 'label' => esc_html__( 'HTML tag', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', 'span' => 'span', 'p' => 'p', ], 'default' => 'h2', 'prefix_class' => 'lqd-text-tag-', 'render_type' => 'template' ] ); $this->add_control( 'block_level_spans', [ 'label' => __( 'Block level spans?', 'aihub-core' ), 'type' => Controls_Manager::SWITCHER, 'separator' => 'before' ] ); $this->add_control( 'lqd_text_split_type', [ 'label' => __( 'Split type', 'aihub-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'words' => [ 'title' => __( 'Words', 'aihub-core' ), 'icon' => 'eicon-ellipsis-h', ], 'chars,words' => [ 'title' => __( 'Characters', 'aihub-core' ), 'icon' => 'eicon-t-letter-bold', ], ], 'separator' => 'before', ] ); $this->add_control( 'lqd_text_vertical', [ 'label' => __( 'Vertical text?', 'aihub-core' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'vertical', 'prefix_class' => 'lqd-widget-container-text-', 'selectors' => [ '{{WRAPPER}} > .elementor-widget-container' => 'height:auto' ], 'separator' => 'before' ] ); $this->add_responsive_control( 'lqd_text_whitespace', [ 'label' => __( 'Whitespace', 'aihub-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ '' => [ 'title' => __( 'Normal', 'aihub-core' ), 'icon' => 'eicon-wrap' ], 'nowrap' => [ 'title' => __( 'Nowrap', 'aihub-core' ), 'icon' => 'eicon-nowrap' ], ], 'default' => '', 'selectors' => [ '{{WRAPPER}}' => 'white-space: {{VALUE}};' ], 'separator' => 'before' ] ); $this->add_control( 'lqd_adaptive_color', [ 'label' => esc_html__( 'Enable adaptive color?', 'aihub-core' ), 'description' => esc_html__( 'Useful for elements with fixed css position or when inside sticky header. This option make the element chage color dynamically when it is over light or dark sections.', 'aihub-core' ), 'type' => Controls_Manager::SWITCHER, 'separator' => 'before' ] ); $this->end_controls_section(); $this->start_controls_section( 'section_title_style', [ 'label' => esc_html__( 'Style', 'aihub-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'lqd_text_typography', 'label' => __( 'Typography', 'aihub-core' ), 'selector' => '{{WRAPPER}} .lqd-text-el', ] ); $this->add_responsive_control( 'lqd_text_alignment', [ 'label' => __( 'Alignment', 'aihub-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'aihub-core' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => __( 'Center', 'aihub-core' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => __( 'Right', 'aihub-core' ), 'icon' => 'eicon-text-align-right', ], 'justify' => [ 'title' => __( 'Justify', 'aihub-core' ), 'icon' => 'eicon-text-align-justify', ], ], 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}}', ], ] ); $this->start_controls_tabs( 'lqd_text_colors_tab', ); $this->start_controls_tab( 'lqd_text_color_normal_tab', [ 'label' => esc_html__( 'Normal', 'aihub-core' ), ] ); $this->add_control( 'lqd_text_color', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ '{{WRAPPER}}' => '--lqd-text-color: {{VALUE}}', '{{WRAPPER}} .lqd-text-el' => 'color: var(--lqd-text-color)', ] ] ); $this->add_responsive_control( 'lqd_text_opacity', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .lqd-text-el' => 'opacity: {{SIZE}};', ], 'separator' => 'after' ] ); $this->end_controls_tab(); $this->start_controls_tab( 'lqd_text_color_hover_tab', [ 'label' => esc_html__( 'Hover', 'aihub-core' ), ] ); $this->add_control( 'lqd_text_color_hover', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ '{{WRAPPER}}:hover' => '--lqd-text-color: {{VALUE}}', '{{WRAPPER}}:hover .lqd-text-el' => 'color: var(--lqd-text-color)', ], ] ); $this->add_responsive_control( 'lqd_text_opacity_hover', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'selectors' => [ '{{WRAPPER}}:hover .lqd-text-el' => 'opacity: {{SIZE}};', ], 'separator' => 'after' ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Text_Stroke::get_type(), [ 'name' => 'lqd_text_text_stroke', 'selector' => '{{WRAPPER}} .lqd-text-el', ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'lqd_text_text_shadow', 'selector' => '{{WRAPPER}} .lqd-text-el', ] ); $this->end_controls_section(); $this->start_controls_section( 'dark_title_style', [ 'label' => __( 'Dark 🌘', 'aihub-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'dark_lqd_text_colors_tab', ); $this->start_controls_tab( 'dark_lqd_text_color_normal_tab', [ 'label' => esc_html__( 'Normal', 'aihub-core' ), ] ); $this->add_control( 'dark_lqd_text_color', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ '[data-lqd-page-color-scheme=dark] {{WRAPPER}}, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark].elementor-element.elementor-element-{{ID}}, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark] .elementor-element.elementor-element-{{ID}}' => '--lqd-text-color: {{VALUE}}', $dark_selectors => 'color: var(--lqd-text-color)', ] ] ); $this->add_responsive_control( 'dark_lqd_text_opacity', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'selectors' => [ $dark_selectors => 'opacity: {{SIZE}};', ], 'separator' => 'after' ] ); $this->end_controls_tab(); $this->start_controls_tab( 'dark_lqd_text_color_hover_tab', [ 'label' => esc_html__( 'Hover', 'aihub-core' ), ] ); $this->add_control( 'dark_lqd_text_color_hover', [ 'label' => __( 'Color', 'aihub-core' ), 'type' => 'liquid-color', 'types' => [ 'solid' ], 'selectors' => [ '[data-lqd-page-color-scheme=dark] {{WRAPPER}}:hover, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark].elementor-element.elementor-element-{{ID}}:hover, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark] .elementor-element.elementor-element-{{ID}}:hover' => '--lqd-text-color: {{VALUE}}', $dark_selectors_hover => 'color: var(--lqd-text-color)', ], ] ); $this->add_responsive_control( 'dark_lqd_text_opacity_hover', [ 'label' => esc_html__( 'Opacity', 'aihub-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'selectors' => [ $dark_selectors_hover => 'opacity: {{SIZE}};', ], 'separator' => 'after' ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Text_Stroke::get_type(), [ 'name' => 'dark_lqd_text_text_stroke', 'selector' => $dark_selectors, ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'dark_lqd_text_text_shadow', 'selector' => $dark_selectors, ] ); $this->add_control( 'dark_blend_mode', [ 'label' => esc_html__( 'Blend mode', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__( 'Normal', 'aihub-core' ), 'multiply' => 'Multiply', 'screen' => 'Screen', 'overlay' => 'Overlay', 'darken' => 'Darken', 'lighten' => 'Lighten', 'color-dodge' => 'Color Dodge', 'hard-light' => 'Hard light', 'saturation' => 'Saturation', 'color' => 'Color', 'difference' => 'Difference', 'exclusion' => 'Exclusion', 'hue' => 'Hue', 'luminosity' => 'Luminosity', ], 'selectors' => [ '[data-lqd-page-color-scheme=dark] {{WRAPPER}}, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark].elementor-element.elementor-element-{{ID}}, ' . $elementor_doc_selector . ' [data-lqd-color-scheme=dark] .elementor-element.elementor-element-{{ID}}' => 'mix-blend-mode: {{VALUE}}', ], ] ); $this->end_controls_section(); } protected function add_render_attributes() { parent::add_render_attributes(); $settings = $this->get_settings_for_display(); $attrs = []; if ( !empty( $settings['lqd_text_split_type'] ) ) { $attrs['data-lqd-has-inner-animatables'] = 'true'; } $this->add_render_attribute( '_wrapper', $attrs ); } private function get_highlight_svg( $highlight_style ) { $svg = ''; switch( $highlight_style ) { case 'lqd-highlight-custom lqd-highlight-custom-1': $svg = ''; break; case 'lqd-highlight-custom lqd-highlight-custom-2': $svg = ''; break; case 'lqd-highlight-custom lqd-highlight-custom-3': $svg = ''; break; case 'lqd-highlight-custom lqd-highlight-custom-4': $svg = ''; break; case 'lqd-highlight-custom lqd-highlight-custom-5': $svg = ''; break; case 'lqd-highlight-custom lqd-highlight-custom-6': $svg = ''; break; default: $svg = ''; break; } return $svg; } /** * Thanks to https://github.com/vibbio/css-gradient-angle-to-svg-gradient-coordinates */ private function angleToCoordinates( $angleInDegrees, $sizeOfSquare = 1 ) { $constrainedAngle = $angleInDegrees % 360; if ( $constrainedAngle < 0 ) $constrainedAngle += 360; $angleBetween0and45deg = $constrainedAngle % 45; $angle45InRadians = pi() / 180 * $angleBetween0and45deg; $delta = 1 / cos($angle45InRadians) * sin($angle45InRadians); $angleUnder180 = $constrainedAngle % 180; $xBase = $delta; $yBase = 1; $x1; $y1; if ( $angleUnder180 < 45 ) { $x1 = $xBase; $y1 = $yBase; } else if ( $angleUnder180 < 90 ) { $x1 = $yBase; $y1 = 1 - $xBase; } else if ( $angleUnder180 < 135 ) { $x1 = $yBase; $y1 = -$xBase; } else if ( $angleUnder180 < 180 ) { $x1 = 1 - $xBase; $y1 = -$yBase; } if ( $constrainedAngle < 180 ) { $x1 = -$x1; $y1 = -$y1; } $x2 = -$x1; $y2 = -$y1; $x1 = ($x1 + 1) / 2 * $sizeOfSquare; $y1 = (-$y1 + 1) / 2 * $sizeOfSquare; $x2 = ($x2 + 1) / 2 * $sizeOfSquare; $y2 = (-$y2 + 1) / 2 * $sizeOfSquare; return [ 'x1' => $x1, 'y1' => $y1, 'x2' => $x2, 'y2' => $y2 ]; } private function get_highlight_color_stops_markup( $item ) { $color_type = $item['highlight_fill_color_background']; $color_a = $item['highlight_fill_color_color']; $colors = [ 'color' => $color_a ]; $stops = []; $global_is_set = isset( $item['__globals__'] ); if ( $color_type === 'gradient' ) { $color_b = $item['highlight_fill_color_color_b']; $colors['color_b'] = $color_b; } foreach ( $colors as $color_index => $color_val ) { if ( $global_is_set && isset( $item['__globals__']['highlight_fill_color_' . $color_index] ) && !empty( $item['__globals__']['highlight_fill_color_' . $color_index] ) ) { $global_color_id = explode( '=', $item['__globals__']['highlight_fill_color_' . $color_index] )[1]; $color_val = 'var(--e-global-color-' . $global_color_id . ')'; } if ( !$color_val || empty( $color_val ) ) { $color_val = 'currentColor'; } $color_offset = isset($item["highlight_fill_color_{$color_index}_stop"]) ? $item["highlight_fill_color_{$color_index}_stop"]['size'] : '0'; $stops[] = sprintf('', "{$color_offset}%", $color_val); } return $stops; } private function get_highlight_fill_markup( $item, $id ) { $color_type = $item['highlight_fill_color_background']; $coordinates = [ 'x1' => 0, 'y1' => 0, 'x2' => 0, 'y2' => 0, ]; if ( $color_type === 'gradient' ) { $gradient_angle_size = $item['highlight_fill_color_gradient_angle']['size']; $angle = isset( $gradient_angle_size ) && !empty( $gradient_angle_size ) ? $gradient_angle_size : 90; $coordinates = $this->angleToCoordinates( $angle ); } $svg_markup = sprintf( ' %6$s ', $id, $coordinates['x1'], $coordinates['y1'], $coordinates['x2'], $coordinates['y2'], implode(' ', $this->get_highlight_color_stops_markup( $item )) ); return $svg_markup; } private function get_highlight_markup( $item ) { $id = 'item-' . $this->get_id() . '-' . $item['_id'] . '-fill'; $highlight_style = $item['highlight_style']; $fill_markup = $this->get_highlight_fill_markup( $item, $id ); $highlight_svg = sprintf( $this->get_highlight_svg( $highlight_style ), 'w-full h-full absolute -z-1', 'url(#' . $id . ')' ); $highlight_markup = sprintf( '%s%s', $fill_markup, $highlight_svg ); return $highlight_markup; } private function get_image_markup( $item ) { $settings = $this->get_settings_for_display(); $split_type = $settings['lqd_text_split_type']; $has_dark_image = $item['dark_insert_image'] === 'yes' && !empty( $item['dark_image']['url'] ); $img_attrs = [ 'class' => 'lqd-text-img' ]; if ( $item['image_placement'] === 'floating' ) { $img_attrs['class'] .= ' absolute'; } else { $img_attrs['class'] .= ' relative'; } if ( $item['look_mouse'] ) { $img_attrs['data-lqd-look-at-mouse'] = true; } if ( $has_dark_image ) { $dark_img_attrs = $img_attrs; $img_attrs['class'] .= ' inline-flex lqd-dark:hidden'; $dark_img_attrs['class'] .= ' hidden lqd-dark:inline-flex'; $image = wp_get_attachment_image( $item['image']['id'], 'full', false, $img_attrs ) . wp_get_attachment_image( $item['dark_image']['id'], 'full', false, $dark_img_attrs ); } else { $img_attrs['class'] .= ' inline-flex'; $image = wp_get_attachment_image( $item['image']['id'], 'full', false, $img_attrs ); } if ( $split_type === 'words' ) { $image = sprintf( '%1$s', $image ); } elseif ( $split_type === 'chars,words' ) { $image = sprintf( '%s', $image ); } $image_markup = sprintf( '%s', $image ); return $image_markup; } private function get_item_markup( $item ) { $markup = ''; $item_tag = 'span'; $settings = $this->get_settings_for_display(); $item_link_enabled = empty( $settings[ 'lqd_text_link' ]['url'] ) && !empty( $item['item_link']['url'] ); $item_id = $item['_id']; $attrs_id = 'item-' . $item_id . '-attrs'; $item_classnames = [ 'lqd-text-item', // removed because it makes spaces not working // 'inline-block', // to make padding and margin work 'relative', 'elementor-repeater-item-' . $item_id ]; $text = ld_helper()->do_the_content( $item['text'], false ); if ( !empty( $settings[ 'lqd_text_split_type' ] ) ) { $text = $this->get_split_content( $item, $text ); } if ( $settings['block_level_spans'] === 'yes' ) { $item_classnames[] = 'block'; } if ( $item['enable_highlight'] === 'yes' ) { $item_tag = 'mark'; array_push( $item_classnames, 'relative', 'lqd-highlight', 'lqd-text-highlight', 'z-1', 'bg-inherit', 'text-inherit' ); if ( empty( $settings[ 'lqd_text_split_type' ] ) ) { $text = $text . $this->get_highlight_markup( $item ); } } else if ( $item['insert_image'] === 'yes' && !empty( $item['image']['url'] ) ){ $image_markup = $this->get_image_markup( $item ); $text = $item['image_placement'] === 'start' ? $image_markup . $text : $text . $image_markup; } $this->add_render_attribute( $attrs_id, 'class', $item_classnames ); if ( $item_link_enabled ) { $this->add_link_attributes( 'url_' . $item_id, $item['item_link'] ); $this->add_render_attribute( $attrs_id, 'class', 'text-inherit' ); $item_markup = sprintf( '%3$s', $this->get_render_attribute_string( 'url_' . $item_id ), $this->get_render_attribute_string( $attrs_id ), $text ); return $item_markup; } $item_markup = sprintf( '<%1$s %2$s>%3$s', $item_tag, $this->get_render_attribute_string( $attrs_id ), $text ); return $item_markup; } protected function get_split_content( $item, $content ){ if ( empty( $content ) ) return; $split_type = $this->get_settings_for_display('lqd_text_split_type'); // words - chars,words $highlight_enabled = $item['enable_highlight'] === 'yes'; $splitted_text = ''; if ( $split_type === 'words' ) { $words = explode(' ', $content); foreach ( $words as $key => $word ) { $space = $key > 0 ? ' ' : ''; $splitted_text .= sprintf( '%2$s%1$s', $highlight_enabled ? $word . $this->get_highlight_markup( $item ) : $word, $space ); } } elseif ( $split_type === 'chars,words' ) { $words = explode(' ', $content); foreach ( $words as $key => $word ) { $space = $key > 0 ? ' ' : ''; $split_char = preg_split('//u', $word, -1, PREG_SPLIT_NO_EMPTY); $splitted_text .= $space . ''; foreach ( $split_char as $char ){ $splitted_text .= sprintf( '%s', $char ); } if ( $highlight_enabled ) { $splitted_text .= $this->get_highlight_markup( $item ); } $splitted_text .= ''; } } if ( empty( $splitted_text ) ){ return $content; } return $splitted_text; } protected function render() { $settings = $this->get_settings_for_display(); $content_items = $settings['lqd_text_content']; $content = ''; $text_element_classname = [ 'lqd-text-el', 'm-0', 'p-0' ]; $split_type = $settings['lqd_text_split_type']; $text_element_attrs = [ 'class' => $text_element_classname ]; if ( !empty( $split_type ) ) { $text_element_attrs[ 'data-lqd-split-text-el' ] = true; $text_element_attrs[ 'data-lqd-split-type' ] = explode( ',', $split_type )[0]; } $this->add_render_attribute( 'text_element', $text_element_attrs ); if ( $content_items ) { foreach( $content_items as $item ){ $content .= $this->get_item_markup( $item ); } } if ( ! empty( $settings['lqd_text_link']['url'] ) ) { $this->add_link_attributes( 'url', $settings['lqd_text_link'] ); $content = sprintf( '%2$s', $this->get_render_attribute_string( 'url' ), $content ); } $content_html = sprintf( '<%1$s %2$s>%3$s', Utils::validate_html_tag( $settings['lqd_text_tag'] ), $this->get_render_attribute_string( 'text_element' ), $content ); echo $content_html; } } \Elementor\Plugin::instance()->widgets_manager->register( new LQD_Text() );