register_content_box_controls(); $this->register_style_box_controls(); } /** * Content section controls. * * @since 1.1.0 */ private function register_content_box_controls() { $this->start_controls_section( 'content', [ 'label' => __( 'Content', 'sellkit' ), 'tab' => 'content', ] ); $this->add_control( 'offer_type', [ 'label' => __( 'Offer Type', 'sellkit' ), 'type' => 'select', 'default' => 'accept', 'options' => [ 'accept' => __( 'Accept Offer', 'sellkit' ), 'reject' => __( 'Reject Offer', 'sellkit' ), ], ] ); $this->add_control( 'title', [ 'label' => __( 'Title', 'sellkit' ), 'default' => __( 'Offer Action', 'sellkit' ), 'type' => 'text', ] ); $this->add_control( 'sub_title', [ 'label' => __( 'Sub Title', 'sellkit' ), 'type' => 'text', ] ); $this->add_responsive_control( 'content_align', [ 'label' => __( 'Alignment', 'sellkit' ), 'type' => 'choose', 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'sellkit' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'sellkit' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'sellkit' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'button_size', [ 'label' => __( 'Size', 'sellkit' ), 'type' => 'select', 'default' => 'md', 'options' => Widget_Button::get_button_sizes(), ] ); $this->add_control( 'selected_icon', [ 'label' => __( 'Icon', 'sellkit' ), 'type' => 'icons', 'fa4compatibility' => 'icon', 'skin' => 'inline', 'label_block' => false, ] ); $this->add_control( 'icon_spacing', [ 'label' => __( 'Icon Spacing', 'sellkit' ), 'type' => 'slider', 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button svg' => 'margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .sellkit-accept-reject-button i' => 'margin-right: {{SIZE}}{{UNIT}};', 'body.rtl {{WRAPPER}} .sellkit-accept-reject-button svg' => 'margin-left: {{SIZE}}{{UNIT}};', 'body.rtl {{WRAPPER}} .sellkit-accept-reject-button i' => 'margin-left: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'selected_icon[value]!' => '', ], ] ); $this->add_responsive_control( 'icon_size', [ 'label' => esc_html__( 'Icon Size', 'sellkit' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 75, 'step' => 1, ], ], 'default' => [ 'unit' => 'px', 'size' => 16, ], 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button i' => 'font-size: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'selected_icon[value]!' => '', ], ] ); $this->add_control( 'title_spacing', [ 'label' => __( 'Title Spacing', 'sellkit' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'sub_title!' => '', ], ] ); $this->end_controls_section(); } /** * Style section controls. * * @since 1.1.0 */ private function register_style_box_controls() { $this->start_controls_section( 'style', [ 'label' => __( 'Button', 'sellkit' ), 'tab' => 'style', ] ); $this->add_group_control( 'typography', [ 'name' => 'input_typography', 'scheme' => '3', 'selector' => '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button-title', ] ); $this->add_group_control( 'typography', [ 'name' => 'sub_title_typography', 'label' => __( 'Subtitle Typography', 'sellkit' ), 'scheme' => '3', 'selector' => '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button .sellkit-accept-reject-button-sub-title', 'condition' => [ 'sub_title!' => '', ], ] ); $this->add_group_control( 'text-shadow', [ 'name' => 'play_icon_shadow', 'fields_options' => [ 'text_shadow_type' => [ 'label' => __( 'Text Shadow', 'sellkit' ), ], ], 'selector' => '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button', ] ); $this->start_controls_tabs( 'tabs_content' ); $this->start_controls_tab( 'tab_content_normal', [ 'label' => __( 'Normal', 'sellkit' ), ] ); $this->add_control( 'text_color', [ 'label' => __( 'Text Color', 'sellkit' ), 'type' => 'color', 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button svg' => 'fill: {{VALUE}} !important;', ], ] ); $this->add_group_control( 'background', [ 'name' => 'background', 'label' => __( 'Background Type', 'sellkit' ), 'type' => 'background', 'default' => '#635cff', 'selector' => '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_content_hover', [ 'label' => __( 'Hover', 'sellkit' ), ] ); $this->add_control( 'hover_text_color', [ 'label' => __( 'Text Color', 'sellkit' ), 'type' => 'color', 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button:hover' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button:hover > svg' => 'fill: {{VALUE}} !important;', ], ] ); $this->add_group_control( 'background', [ 'name' => 'hover_background', 'label' => __( 'Background Type', 'sellkit' ), 'type' => 'background', 'selector' => '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'border_separator', [ 'type' => 'divider', ] ); $this->add_control( 'border_type', [ 'label' => __( 'Border Type', 'sellkit' ), 'type' => 'select', 'options' => [ '' => __( 'None', 'sellkit' ), 'solid' => __( 'Solid', 'sellkit' ), 'double' => __( 'Double', 'sellkit' ), 'dotted' => __( 'Dotted', 'sellkit' ), 'dashed' => __( 'Dashed', 'sellkit' ), 'groove' => __( 'Groove', 'sellkit' ), ], 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button' => 'border-style: {{VALUE}} !important;', ], ] ); $this->add_control( 'border_color', [ 'label' => __( 'Border Color', 'sellkit' ), 'type' => 'color', 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button' => 'border-color: {{VALUE}} !important;', ], 'condition' => [ 'border_type!' => '', ], ] ); $this->add_responsive_control( 'border_width', [ 'label' => __( 'Border Width', 'sellkit' ), 'type' => 'slider', 'size_units' => [ 'px' ], 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button' => 'border-width: {{SIZE}}{{UNIT}} !important;', ], 'condition' => [ 'border_type!' => '', ], ] ); $this->add_responsive_control( 'border_radius', [ 'label' => __( 'Border Radius', 'sellkit' ), 'type' => 'dimensions', 'size_units' => [ 'px', '%', 'em' ], 'default' => [ 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( 'box-shadow', [ 'name' => 'box_shadow', 'selector' => '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button', ] ); $this->add_control( 'padding_separator', [ 'type' => 'divider', ] ); $this->add_responsive_control( 'personalised_coupons_padding', [ 'label' => __( 'Padding', 'sellkit' ), 'type' => 'dimensions', 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .sellkit-accept-reject-button-widget .sellkit-accept-reject-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } protected function render() { $order_key = sellkit_htmlspecialchars( INPUT_GET, 'order-key' ); $settings = $this->get_settings_for_display(); $button_type_class = ( 'accept' === $settings['offer_type'] ) ? 'sellkit-upsell-accept-button' : 'sellkit-upsell-reject-button'; ?>