PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / 1.6.1
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management v1.6.1
1.6.1 1.6.0 1.5.1 1.5.0 1.4.0 1.3.0 trunk 0.0.1 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0
suredonation / inc / page-builders / elementor / widgets / campaign-stats-widget.php

campaign-stats-widget.php in SureDonation – Donation Forms, Fundraising Campaigns & Donor Management 1.6.1, at inc/page-builders/elementor/widgets/campaign-stats-widget.php

98 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor widget: Campaign Statistic.
4 *
5 * @package SureDonation
6 * @since 1.2.0
7 */
8
9 namespace SureDonation\Inc\Page_Builders\Elementor\Widgets;
10
11 use Elementor\Controls_Manager;
12 use SureDonation\Inc\Page_Builders\Elementor\Base_Widget;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 /**
19 * Campaign_Stats_Widget class.
20 *
21 * @since 1.2.0
22 */
23 class Campaign_Stats_Widget extends Base_Widget {
24 /**
25 * {@inheritDoc}
26 */
27 public function get_name() {
28 return 'suredonation-campaign-stats';
29 }
30
31 /**
32 * {@inheritDoc}
33 */
34 public function get_title() {
35 return esc_html__( 'Campaign Statistic', 'suredonation' );
36 }
37
38 /**
39 * {@inheritDoc}
40 */
41 public function get_icon() {
42 return 'eicon-counter';
43 }
44
45 /**
46 * {@inheritDoc}
47 */
48 protected function block_name() {
49 return 'suredonation/campaign-stats';
50 }
51
52 /**
53 * Register the widget controls.
54 *
55 * @since 1.2.0
56 * @return void
57 */
58 protected function register_controls() {
59 $this->start_controls_section(
60 'content',
61 [ 'label' => esc_html__( 'Campaign Statistic', 'suredonation' ) ]
62 );
63
64 $this->add_campaign_control();
65
66 $this->add_control(
67 'statistic',
68 [
69 'label' => esc_html__( 'Statistic to display', 'suredonation' ),
70 'type' => Controls_Manager::SELECT,
71 'default' => 'average-donation',
72 'options' => [
73 'average-donation' => esc_html__( 'Average Donation', 'suredonation' ),
74 'top-donation' => esc_html__( 'Top Donation', 'suredonation' ),
75 'total-raised' => esc_html__( 'Total Raised', 'suredonation' ),
76 'donor-count' => esc_html__( 'Donors', 'suredonation' ),
77 'donation-count' => esc_html__( 'Donations', 'suredonation' ),
78 ],
79 ]
80 );
81
82 $this->end_controls_section();
83 }
84
85 /**
86 * Map the widget settings to the block attributes.
87 *
88 * @since 1.2.0
89 * @param array<string, mixed> $settings Widget settings.
90 * @return array<string, mixed>
91 */
92 protected function get_block_attrs( $settings ) {
93 return [
94 'statistic' => $this->setting_string( $settings, 'statistic', 'average-donation' ),
95 ];
96 }
97 }
98