start_controls_section( 'give_login_settings', [ 'label' => __('GiveWP Goal Widget', 'give'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'form_id', [ 'label' => __('Form ID', 'give'), 'type' => \Elementor\Controls_Manager::TEXT, 'input_type' => 'number' ] ); $this->add_control( 'show_text', [ 'label' => __('Show Text', 'give'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'description' => __('Show or hide the goal text.', 'give'), 'label_on' => __('Show', 'give'), 'label_off' => __('Hide', 'give'), 'default' => 'yes' ] ); $this->add_control( 'show_bar', [ 'label' => __('Show Progress Bar', 'give'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'description' => __('Show or hide progress bar.', 'give'), 'label_on' => __('Show', 'give'), 'label_off' => __('Hide', 'give'), 'default' => 'yes' ] ); $this->add_control( 'give_goal_info', [ 'label' => '', 'type' => \Elementor\Controls_Manager::RAW_HTML, 'content_classes' => 'give-info', 'raw' => '

' . __('GIVEWP GOAL WIDGET', 'give') . '

' . __('This is the GiveWP Goal widget. Choose how you want your form goal to be displayed. Note that this widget only supports forms that have a goal enabled. If you want to show progress of any form or multiple forms, use the "GiveWP Totals" widget instead.', 'give') . '

' ] ); $this->end_controls_section(); } /** * Render the [give_goal] output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 4.7.0 migrated from givewp-elementor-widgets * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $id = esc_html($settings['form_id']); $showText = esc_html($settings['show_text']); $showBar = esc_html($settings['show_bar']); $html = do_shortcode( '[give_goal id="' . $id . '" show_text="' . $showText . '" show_bar="' . $showBar . '" ]' ); echo '
' . $html . '
'; } }