PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / 1.4.0
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management v1.4.0
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 / bricks / elements / campaign-goal.php

campaign-goal.php in SureDonation – Donation Forms, Fundraising Campaigns & Donor Management 1.4.0, at inc/page-builders/bricks/elements/campaign-goal.php

95 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Bricks element: Campaign Goal.
4 *
5 * @package SureDonation
6 * @since 1.2.0
7 */
8
9 namespace SureDonation\Inc\Page_Builders\Bricks\Elements;
10
11 use SureDonation\Inc\Page_Builders\Bricks\Base_Element;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly.
15 }
16
17 /**
18 * Campaign_Goal class.
19 *
20 * @since 1.2.0
21 */
22 class Campaign_Goal extends Base_Element {
23 /**
24 * Element name.
25 *
26 * @since 1.2.0
27 * @var string
28 */
29 public $name = 'suredonation-campaign-goal';
30
31 /**
32 * Element icon.
33 *
34 * @since 1.2.0
35 * @var string
36 */
37 public $icon = 'ti-target';
38
39 /**
40 * Element label shown in the builder panel.
41 *
42 * @since 1.2.0
43 * @return string
44 */
45 public function get_label() {
46 return esc_html__( 'Campaign Goal', 'suredonation' );
47 }
48
49 /**
50 * {@inheritDoc}
51 */
52 public function get_keywords() {
53 return array_merge( parent::get_keywords(), [ 'goal', 'progress' ] );
54 }
55
56 /**
57 * Register the element controls.
58 *
59 * @since 1.2.0
60 * @return void
61 */
62 public function set_controls() {
63 $this->add_campaign_control();
64
65 // Inverted (default-off) control: Bricks never writes a control 'default'
66 // into settings, so an untouched default-true checkbox would read as
67 // false and flip the block's Gutenberg default. Absent = show the bar.
68 $this->controls['hideProgressBar'] = [
69 'tab' => 'content',
70 'label' => esc_html__( 'Hide progress bar', 'suredonation' ),
71 'type' => 'checkbox',
72 ];
73 }
74
75 /**
76 * {@inheritDoc}
77 */
78 protected function block_name() {
79 return 'suredonation/campaign-goal';
80 }
81
82 /**
83 * Map the element settings to the block attributes.
84 *
85 * @since 1.2.0
86 * @param array<string, mixed> $settings Element settings.
87 * @return array<string, mixed>
88 */
89 protected function get_block_attrs( $settings ) {
90 return [
91 'showProgressBar' => ! $this->setting_bool( $settings, 'hideProgressBar' ),
92 ];
93 }
94 }
95