start_controls_section( 'donation_history_settings', [ 'label' => __('Donation History Widget', 'give'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'form_id', [ 'label' => __('ID', 'give'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'description' => __('Show or hide the "ID" column.', 'give'), 'label_on' => __('Show', 'give'), 'label_off' => __('Hide', 'give'), 'default' => 'yes' ] ); $this->add_control( 'date', [ 'label' => __('Date', 'give'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'description' => __('Show or hide a column with the date of the donation.', 'give'), 'label_on' => __('Show', 'give'), 'label_off' => __('Hide', 'give'), 'default' => 'yes' ] ); $this->add_control( 'donor', [ 'label' => __('Donor', 'give'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'description' => __('Show or hide a column with the donors full name.', 'give'), 'label_on' => __('Show', 'give'), 'label_off' => __('Hide', 'give'), 'default' => 'no' ] ); $this->add_control( 'amount', [ 'label' => __('Amount', 'give'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'description' => __('Show or hide a column with the amount of the donation.', 'give'), 'label_on' => __('Show', 'give'), 'label_off' => __('Hide', 'give'), 'default' => 'yes' ] ); $this->add_control( 'status', [ 'label' => __('Status', 'give'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'description' => __('Show or hide a column with the status of the payment.', 'give'), 'label_on' => __('Show', 'give'), 'label_off' => __('Hide', 'give'), 'default' => 'no' ] ); $this->add_control( 'method', [ 'label' => __('Payment Method', 'give'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'description' => __('Show or hide a column with the name of the payment method.', 'give'), 'label_on' => __('Show', 'give'), 'label_off' => __('Hide', 'give'), 'default' => 'no' ] ); $this->add_control( 'give_history_info', [ 'label' => '', 'type' => \Elementor\Controls_Manager::RAW_HTML, 'content_classes' => 'give-info', 'raw' => '

' . __('GIVEWP DONATION HISTORY WIDGET', 'give') . '

' . __('This is the GiveWP Donation History widget. Choose which columns you want to have appear for your donors history.', 'give') . '

' ] ); $this->end_controls_section(); } /** * Render the [donation_history] 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 = ('yes' === $settings['form_id'] ? '' : 'id="false"'); $donor = ('yes' === $settings['donor'] ? 'donor="true"' : ''); $date = ('yes' === $settings['date'] ? '' : 'date="false"'); $amount = ('yes' === $settings['amount'] ? '' : 'amount="false"'); $status = ('yes' === $settings['status'] ? 'status="true"' : ''); $method = ('yes' === $settings['method'] ? 'payment_method="true"' : ''); if (!\Elementor\Plugin::$instance->editor->is_edit_mode()) { $html = do_shortcode( ' [donation_history ' . $id . ' ' . $donor . ' ' . $date . ' ' . $amount . ' ' . $status . ' ' . $method . ']' ); } else { ob_start(); ?>
ID Date Donor Amount Status Payment Method Details
ID57 DateApril 28, 2020 DonorTest Donor Amount $500.00 StatusComplete Payment MethodTest Donation DetailsView Receipt »
ID41 DateJanuary 2, 2020 DonorTest Donor Amount $25.00 StatusComplete Payment MethodTest Donation DetailsView Receipt »
ID38 DateDecember 15, 2019 DonorTest Donor Amount $50.00 StatusComplete Payment MethodTest Donation DetailsView Receipt »
ID25 DateOctober 23, 2019 DonorTest Donor Amount $28.00 StatusComplete Payment MethodTest Donation DetailsView Receipt »
'; echo $html; echo ''; } }