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

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

93 lines 1.7 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 Donate Button.
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_Donate_Button class.
19 *
20 * @since 1.2.0
21 */
22 class Campaign_Donate_Button extends Base_Element {
23 /**
24 * Element name.
25 *
26 * @since 1.2.0
27 * @var string
28 */
29 public $name = 'suredonation-campaign-donate-button';
30
31 /**
32 * Element icon.
33 *
34 * @since 1.2.0
35 * @var string
36 */
37 public $icon = 'ti-money';
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 Donate Button', 'suredonation' );
47 }
48
49 /**
50 * {@inheritDoc}
51 */
52 public function get_keywords() {
53 return array_merge( parent::get_keywords(), [ 'button', 'donate' ] );
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 $this->controls['buttonText'] = [
66 'tab' => 'content',
67 'label' => esc_html__( 'Button text', 'suredonation' ),
68 'type' => 'text',
69 'default' => esc_html__( 'Donate', 'suredonation' ),
70 ];
71 }
72
73 /**
74 * {@inheritDoc}
75 */
76 protected function block_name() {
77 return 'suredonation/campaign-donate-button';
78 }
79
80 /**
81 * Map the element settings to the block attributes.
82 *
83 * @since 1.2.0
84 * @param array<string, mixed> $settings Element settings.
85 * @return array<string, mixed>
86 */
87 protected function get_block_attrs( $settings ) {
88 return [
89 'buttonText' => $this->setting_string( $settings, 'buttonText', __( 'Donate', 'suredonation' ) ),
90 ];
91 }
92 }
93