r::DIMENSIONS, 'size_units' => array( 'px', '%' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_desc_back'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 100 ); $this->_add_responsive_control( 'back_description_margin', array( 'label' => __( 'Margin', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_desc_back'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 50 ); $this->_end_controls_tab(); $this->_end_controls_tabs(); $this->_end_controls_section(); /** * Action Button Style Section */ $this->_start_controls_section( 'section_action_button_style', array( 'label' => esc_html__( 'Action Button', 'jet-elements' ), 'tab' => Controls_Manager::TAB_STYLE, 'show_label' => false, ) ); $this->_add_responsive_control( 'back_button_alignment', array( 'label' => esc_html__( 'Alignment', 'jet-elements' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => array( 'flex-start' => array( 'title' => esc_html__( 'Start', 'jet-elements' ), 'icon' => ! is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right', ), 'center' => array( 'title' => esc_html__( 'Center', 'jet-elements' ), 'icon' => 'eicon-h-align-center', ), 'flex-end' => array( 'title' => esc_html__( 'End', 'jet-elements' ), 'icon' => ! is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left', ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] => 'align-self: {{VALUE}};', ), ), 50 ); $this->_add_control( 'add_button_icon', array( 'label' => esc_html__( 'Add Icon', 'jet-elements' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'jet-elements' ), 'label_off' => esc_html__( 'No', 'jet-elements' ), 'return_value' => 'yes', 'default' => 'false', ), 25 ); $this->_add_icon_control( 'button_icon', array( 'label' => esc_html__( 'Icon', 'jet-elements' ), 'type' => Controls_Manager::ICON, 'label_block' => true, 'file' => '', 'condition' => array( 'add_button_icon' => 'yes', ), ), 25 ); $this->_add_control( 'button_icon_position', array( 'label' => esc_html__( 'Icon Position', 'jet-elements' ), 'type' => Controls_Manager::SELECT, 'options' => array( 'before' => esc_html__( 'Before Text', 'jet-elements' ), 'after' => esc_html__( 'After Text', 'jet-elements' ), ), 'default' => 'after', 'render_type' => 'template', 'condition' => array( 'add_button_icon' => 'yes', ), ), 25 ); $this->_add_control( 'button_icon_size', array( 'label' => esc_html__( 'Icon Size', 'jet-elements' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 7, 'max' => 90, ), ), 'condition' => array( 'add_button_icon' => 'yes', ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button_icon'] => 'font-size: {{SIZE}}{{UNIT}};', ), ), 25 ); $this->_add_control( 'button_icon_color', array( 'label' => esc_html__( 'Icon Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'condition' => array( 'add_button_icon' => 'yes', ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button_icon'] => 'color: {{VALUE}}', ), ), 25 ); $this->_add_responsive_control( 'button_icon_margin', array( 'label' => esc_html__( 'Icon Margin', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'em' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button_icon'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), 'condition' => array( 'add_button_icon' => 'yes', ), ), 50 ); $this->_add_responsive_control( 'button_padding', array( 'label' => esc_html__( 'Padding', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'em' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 25 ); $this->_add_responsive_control( 'button_margin', array( 'label' => __( 'Margin', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 50 ); $this->_start_controls_tabs( 'tabs_button_style' ); $this->_start_controls_tab( 'tab_button_normal', array( 'label' => esc_html__( 'Normal', 'jet-elements' ), ) ); $this->_add_control( 'button_color', array( 'label' => esc_html__( 'Text Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] => 'color: {{VALUE}}', ), ), 25 ); $this->_add_control( 'button_bg_color', array( 'label' => esc_html__( 'Background Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'scheme' => array( 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] => 'background-color: {{VALUE}}', ), ), 25 ); $this->_add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'button_typography', 'scheme' => Scheme_Typography::TYPOGRAPHY_4, 'selector' => '{{WRAPPER}} ' . $css_scheme['animated_box_button'], ), 50 ); $this->_add_group_control( Group_Control_Border::get_type(), array( 'name' => 'button_border', 'label' => esc_html__( 'Border', 'jet-elements' ), 'placeholder' => '1px', 'default' => '1px', 'selector' => '{{WRAPPER}} ' . $css_scheme['animated_box_button'], ), 50 ); $this->_add_responsive_control( 'button_border_radius', array( 'label' => esc_html__( 'Border Radius', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 75 ); $this->_add_group_control( Group_Control_Box_Shadow::get_type(), array( 'name' => 'button_box_shadow', 'selector' => '{{WRAPPER}} ' . $css_scheme['animated_box_button'], ), 100 ); $this->_end_controls_tab(); $this->_start_controls_tab( 'tab_button_hover', array( 'label' => esc_html__( 'Hover', 'jet-elements' ), ) ); $this->_add_control( 'button_hover_color', array( 'label' => esc_html__( 'Text Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] . ':hover' => 'color: {{VALUE}}', ), ), 25 ); $this->_add_control( 'button_hover_bg_color', array( 'label' => esc_html__( 'Background Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] . ':hover' => 'background-color: {{VALUE}}', ), ), 25 ); $this->_add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'button_hover_typography', 'selector' => '{{WRAPPER}} ' . $css_scheme['animated_box_button'] . ':hover', ), 50 ); $this->_add_group_control( Group_Control_Border::get_type(), array( 'name' => 'button_hover_border', 'label' => esc_html__( 'Border', 'jet-elements' ), 'placeholder' => '1px', 'default' => '1px', 'selector' => '{{WRAPPER}} ' . $css_scheme['animated_box_button'] . ':hover', ), 50 ); $this->_add_responsive_control( 'button_hover_border_radius', array( 'label' => esc_html__( 'Border Radius', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['animated_box_button'] . ':hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 75 ); $this->_add_group_control( Group_Control_Box_Shadow::get_type(), array( 'name' => 'button_hover_box_shadow', 'selector' => '{{WRAPPER}} ' . $css_scheme['animated_box_button'] . ':hover', ), 100 ); $this->_end_controls_tab(); $this->_end_controls_tabs(); $this->_end_controls_section(); } protected function render() { $this->_context = 'render'; $this->_open_wrap(); include $this->_get_global_template( 'index' ); $this->_close_wrap(); } /** * Generate setting json * * @return string */ public function generate_setting_json() { $settings = $this->get_settings(); $instance_settings = array( 'widgetId' => $this->get_id(), 'switchEventType' => $settings['switch_event_type'], 'paperFoldDirection' => isset( $settings['paper_fold_direction'] ) ? $settings['paper_fold_direction'] : 'left', 'slideOutDirection' => isset( $settings['slide_out_direction'] ) ? $settings['slide_out_direction'] : 'left', 'peelCornerPosition' => isset( $settings['peel_corner_position'] ) ? $settings['peel_corner_position'] : 'right', ); if ( 'scratch' === $settings['switch_event_type'] ) { $instance_settings['scratchFillPercent'] = ! empty( $settings['scratch_fill_percent']['size'] ) ? $settings['scratch_fill_percent']['size'] : 75; } $instance_settings = json_encode( $instance_settings ); return sprintf( 'data-settings=\'%1$s\'', $instance_settings ); } /** * Get item template content. * * @return string|void */ protected function get_template_content( $template_id ) { if ( empty( $template_id ) ) { return; } // for multi-language plugins $template_id = apply_filters( 'jet-elements/widgets/template_id', $template_id, $this ); $content = jet_elements()->elementor()->frontend->get_builder_content_for_display( $template_id ); if ( jet_elements()->elementor()->editor->is_edit_mode() ) { $edit_url = add_query_arg( array( 'elementor' => '', ), get_permalink( $template_id ) ); $edit_link = sprintf( '', esc_url( $edit_url ), esc_html__( 'Edit Template', 'jet-elements' ) ); $content .= $edit_link; } return $content; } }