PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.5.0
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.5.0
1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / src / Integrations / Elementor / SubscriptionFormElementorWidget.php
hostinger-reach / src / Integrations / Elementor Last commit date
ElementorIntegration.php 2 weeks ago SubscriptionFormElementorWidget.php 1 month ago
SubscriptionFormElementorWidget.php
139 lines
1 <?php
2
3 namespace Hostinger\Reach\Integrations\Elementor;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Widget_Base;
7 use Hostinger\Reach\Blocks\SubscriptionFormBlock;
8
9 class SubscriptionFormElementorWidget extends Widget_Base {
10
11 public const FORM_ID_PREFIX = 'elementor-hostinger-reach-form-';
12 public const WIDGET_NAME = 'hostinger-reach';
13
14 public function get_name(): string {
15 return self::WIDGET_NAME;
16 }
17
18
19 public function get_title(): ?string {
20 return __( 'Hostinger Reach', 'hostinger-reach' );
21 }
22
23 public function get_icon(): string {
24 return 'eicon-envelope';
25 }
26
27 public function get_keywords(): array {
28 return array(
29 'form',
30 'forms',
31 'reach',
32 'contact form',
33 'hostinger',
34 'email',
35 'newsletter',
36 );
37 }
38
39 public function get_categories(): array {
40 return array(
41 'basic',
42 );
43 }
44
45 protected function register_controls(): void {
46
47 $this->start_controls_section(
48 'form',
49 array(
50 'label' => esc_html__( 'Form', 'hostinger-reach' ),
51 'tab' => Controls_Manager::TAB_CONTENT,
52 )
53 );
54
55 $this->add_control(
56 'formId',
57 array(
58 'label' => esc_html__( 'Form ID', 'hostinger-reach' ),
59 'type' => Controls_Manager::HIDDEN,
60 'input_type' => 'hidden',
61 'default' => self::FORM_ID_PREFIX . random_int( 1, PHP_INT_MAX ),
62 )
63 );
64
65 $this->add_control(
66 'showName',
67 array(
68 'label' => esc_html__( 'Show Name', 'hostinger-reach' ),
69 'type' => Controls_Manager::SWITCHER,
70 'label_on' => esc_html__( 'Yes', 'hostinger-reach' ),
71 'label_off' => esc_html__( 'No', 'hostinger-reach' ),
72 'return_value' => 1,
73 'default' => 0,
74 )
75 );
76
77 $this->add_control(
78 'showSurname',
79 array(
80 'label' => esc_html__( 'Show Surname', 'hostinger-reach' ),
81 'type' => Controls_Manager::SWITCHER,
82 'label_on' => esc_html__( 'Yes', 'hostinger-reach' ),
83 'label_off' => esc_html__( 'No', 'hostinger-reach' ),
84 'return_value' => 1,
85 'default' => 0,
86 )
87 );
88
89 $this->end_controls_section();
90 }
91
92 protected function render(): void {
93 $settings = $this->get_settings_for_display();
94 SubscriptionFormBlock::render_block_html( $settings, ElementorIntegration::INTEGRATION_NAME );
95 }
96
97 protected function content_template(): void {
98 ?>
99 <div class="hostinger-reach-block-subscription-form-wrapper">
100 <form id="{{{ settings.formId }}}" class="hostinger-reach-block-subscription-form">
101 <input type="hidden" name="id" value="{{{ settings.formId }}}">
102 <input type="hidden" name="metadata.plugin" value="elementor">
103
104 <div class="hostinger-reach-block-form-field">
105 <label
106 for="{{{ settings.formId }}}-email"><?php esc_html_e( 'Email', 'hostinger-reach' ); ?>
107 <span class="required">*</span></label>
108 <input type="email" id="{{{ settings.formId }}}-email" name="email" required>
109 </div>
110
111 <# if ( settings.showName ) { #>
112 <div class="hostinger-reach-block-form-field">
113 <label
114 for="{{{ settings.formId }}}-name"><?php esc_html_e( 'Name', 'hostinger-reach' ); ?></label>
115 <input type="text" id="{{{ settings.formId }}}-name" name="name">
116 </div>
117 <# } #>
118
119 <# if ( settings.showSurname ) { #>
120 <div class="hostinger-reach-block-form-field">
121 <label
122 for="{{{ settings.formId }}}-surname"><?php esc_html_e( 'Surname', 'hostinger-reach' ); ?></label>
123 <input type="text" id="{{{ settings.formId }}}-surname" name="surname">
124 </div>
125 <# } #>
126
127 <button
128 type="submit"
129 class="hostinger-reach-block-submit wp-block-button__link has-light-color has-color-3-background-color has-text-color has-background has-link-color has-medium-font-size wp-element-button">
130 <?php esc_html_e( 'Subscribe', 'hostinger-reach' ); ?>
131 </button>
132
133 <div class="reach-subscription-message" style="display: none;"></div>
134 </form>
135 </div>
136 <?php
137 }
138 }
139