start_controls_section( 'section_content', [ 'label' => esc_html__( 'Content', 'elementor-addon' ), ] ); $this->add_control( 'button_text', [ 'label' => esc_html__( 'Button Text', 'elementor-addon' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Czytaj wiecej', 'elementor-addon' ), 'placeholder' => esc_html__( 'Czytaj wiecej', 'elementor-addon' ), 'label_block' => true, ] ); $this->add_control( 'popup_content', [ 'label' => esc_html__( 'Popup Content', 'elementor-addon' ), 'type' => Controls_Manager::WYSIWYG, 'default' => '

' . esc_html__( 'Write your popup content here.', 'elementor-addon' ) . '

', 'show_label' => true, ] ); $this->add_control( 'close_label', [ 'label' => esc_html__( 'Close Button Label', 'elementor-addon' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Close popup', 'elementor-addon' ), 'label_block' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_button_style', [ 'label' => esc_html__( 'Button', 'elementor-addon' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'button_align', [ 'label' => esc_html__( 'Alignment', 'elementor-addon' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'elementor-addon' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'elementor-addon' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'elementor-addon' ), 'icon' => 'eicon-text-align-right', ], ], 'default' => 'left', 'selectors' => [ '{{WRAPPER}} .ea-popup-widget' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'button_full_width', [ 'label' => esc_html__( 'Full Width', 'elementor-addon' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'elementor-addon' ), 'label_off' => esc_html__( 'No', 'elementor-addon' ), 'return_value' => 'yes', 'selectors' => [ '{{WRAPPER}} .ea-popup-button' => 'width: 100%;', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'selector' => '{{WRAPPER}} .ea-popup-button', ] ); $this->add_responsive_control( 'button_padding', [ 'label' => esc_html__( 'Padding', 'elementor-addon' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ea-popup-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'selector' => '{{WRAPPER}} .ea-popup-button', ] ); $this->add_responsive_control( 'button_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor-addon' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ea-popup-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}} .ea-popup-button', ] ); $this->start_controls_tabs( 'button_style_tabs' ); $this->start_controls_tab( 'button_style_normal', [ 'label' => esc_html__( 'Normal', 'elementor-addon' ), ] ); $this->add_control( 'button_text_color', [ 'label' => esc_html__( 'Text Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ea-popup-button' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background_color', [ 'label' => esc_html__( 'Background Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ea-popup-button' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'button_style_hover', [ 'label' => esc_html__( 'Hover', 'elementor-addon' ), ] ); $this->add_control( 'button_hover_text_color', [ 'label' => esc_html__( 'Text Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ea-popup-button:hover, {{WRAPPER}} .ea-popup-button:focus' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_background_color', [ 'label' => esc_html__( 'Background Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ea-popup-button:hover, {{WRAPPER}} .ea-popup-button:focus' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_border_color', [ 'label' => esc_html__( 'Border Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ea-popup-button:hover, {{WRAPPER}} .ea-popup-button:focus' => 'border-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_overlay_style', [ 'label' => esc_html__( 'Overlay', 'elementor-addon' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'overlay_background_color', [ 'label' => esc_html__( 'Background Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'default' => 'rgba(0, 0, 0, 0.55)', 'selectors' => [ '{{WRAPPER}} .ea-popup-modal' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_popup_style', [ 'label' => esc_html__( 'Popup Box', 'elementor-addon' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'popup_width', [ 'label' => esc_html__( 'Width', 'elementor-addon' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'vw' ], 'range' => [ 'px' => [ 'min' => 260, 'max' => 1200, ], '%' => [ 'min' => 20, 'max' => 100, ], 'vw' => [ 'min' => 20, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 720, ], 'selectors' => [ '{{WRAPPER}} .ea-popup-dialog' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'popup_padding', [ 'label' => esc_html__( 'Padding', 'elementor-addon' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ea-popup-dialog' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'popup_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ea-popup-dialog', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'popup_border', 'selector' => '{{WRAPPER}} .ea-popup-dialog', ] ); $this->add_responsive_control( 'popup_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor-addon' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ea-popup-dialog' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'popup_box_shadow', 'selector' => '{{WRAPPER}} .ea-popup-dialog', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_popup_content_style', [ 'label' => esc_html__( 'Popup Content', 'elementor-addon' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'content_text_color', [ 'label' => esc_html__( 'Text Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ea-popup-content' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'selector' => '{{WRAPPER}} .ea-popup-content', ] ); $this->add_responsive_control( 'content_align', [ 'label' => esc_html__( 'Alignment', 'elementor-addon' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'elementor-addon' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'elementor-addon' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'elementor-addon' ), 'icon' => 'eicon-text-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ea-popup-content' => 'text-align: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_close_style', [ 'label' => esc_html__( 'Close Button', 'elementor-addon' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'close_color', [ 'label' => esc_html__( 'Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ea-popup-close' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'close_background_color', [ 'label' => esc_html__( 'Background Color', 'elementor-addon' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ea-popup-close' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'close_size', [ 'label' => esc_html__( 'Size', 'elementor-addon' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 24, 'max' => 80, ], ], 'selectors' => [ '{{WRAPPER}} .ea-popup-close' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'close_icon_size', [ 'label' => esc_html__( 'Icon Size', 'elementor-addon' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 12, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ea-popup-close' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $widget_id = 'ea-popup-' . $this->get_id(); $button_id = $widget_id . '-button'; $dialog_id = $widget_id . '-dialog'; $button_text = ! empty( $settings['button_text'] ) ? $settings['button_text'] : esc_html__( 'Czytaj wiecej', 'elementor-addon' ); $close_label = ! empty( $settings['close_label'] ) ? $settings['close_label'] : esc_html__( 'Close popup', 'elementor-addon' ); $this->add_render_attribute( 'wrapper', [ 'class' => 'ea-popup-widget', ] ); $this->add_render_attribute( 'button', [ 'id' => $button_id, 'class' => 'ea-popup-button', 'type' => 'button', 'aria-haspopup' => 'dialog', 'aria-controls' => $dialog_id, 'aria-expanded' => 'false', ] ); ?>
print_render_attribute_string( 'wrapper' ); ?>>