PluginProbe
Property Hive / 2.2.5
Property Hive v2.2.5
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / includes / elementor-widgets / property-enquiry-form-link.php

property-enquiry-form-link.php in Property Hive 2.2.5, at includes/elementor-widgets/property-enquiry-form-link.php

201 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor Property Enquiry Form Link Widget.
4 *
5 * @since 1.0.0
6 */
7 class Elementor_Property_Enquiry_Form_Link_Widget extends \Elementor\Widget_Base {
8
9 public function get_name() {
10 return 'property-enquiry-form-link';
11 }
12
13 public function get_title() {
14 return __( 'Enquiry Form Link', 'propertyhive' );
15 }
16
17 public function get_icon() {
18 return 'eicon-link';
19 }
20
21 public function get_categories() {
22 return [ 'property-hive' ];
23 }
24
25 public function get_keywords() {
26 return [ 'property hive', 'propertyhive', 'property', 'enquiry', 'form' ];
27 }
28
29 protected function register_controls() {
30
31 $this->start_controls_section(
32 'style_section',
33 [
34 'label' => __( 'Enquiry Form Link', 'propertyhive' ),
35 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
36 ]
37 );
38
39 $this->add_group_control(
40 \Elementor\Group_Control_Typography::get_type(),
41 [
42 'name' => 'typography',
43 'label' => __( 'Typography', 'propertyhive' ),
44 'global' => [
45 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_PRIMARY,
46 ],
47 'selector' => '{{WRAPPER}} a',
48 ]
49 );
50
51 $this->add_control(
52 'text_align',
53 [
54 'label' => __( 'Alignment', 'propertyhive' ),
55 'type' => \Elementor\Controls_Manager::CHOOSE,
56 'options' => [
57 'left' => [
58 'title' => __( 'Left', 'propertyhive' ),
59 'icon' => 'eicon-text-align-left',
60 ],
61 'center' => [
62 'title' => __( 'Center', 'propertyhive' ),
63 'icon' => 'eicon-text-align-center',
64 ],
65 'right' => [
66 'title' => __( 'Right', 'propertyhive' ),
67 'icon' => 'eicon-text-align-right',
68 ],
69 ],
70 'default' => 'center',
71 'toggle' => true,
72 'selectors' => [
73 '{{WRAPPER}}' => 'text-align: {{VALUE}}',
74 ],
75 ]
76 );
77
78 $this->start_controls_tabs( 'button_style_tabs' );
79
80 // Normal tab
81 $this->start_controls_tab(
82 'button_style_normal',
83 [
84 'label' => __( 'Normal', 'propertyhive' ),
85 ]
86 );
87
88 $this->add_control(
89 'color',
90 [
91 'label' => __( 'Colour', 'propertyhive' ),
92 'type' => \Elementor\Controls_Manager::COLOR,
93 'global' => [
94 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_PRIMARY,
95 ],
96 'selectors' => [
97 '{{WRAPPER}} a' => 'color: {{VALUE}}',
98 ],
99 ]
100 );
101
102 $this->add_control(
103 'background_color',
104 [
105 'label' => __( 'Background Colour', 'propertyhive' ),
106 'type' => \Elementor\Controls_Manager::COLOR,
107 'global' => [
108 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_SECONDARY,
109 ],
110 'selectors' => [
111 '{{WRAPPER}} a' => 'background: {{VALUE}}',
112 ],
113 ]
114 );
115
116 $this->end_controls_tab();
117
118 // Hover tab
119 $this->start_controls_tab(
120 'button_style_hover',
121 [
122 'label' => __( 'Hover', 'propertyhive' ),
123 ]
124 );
125
126 $this->add_control(
127 'hover_color',
128 [
129 'label' => __( 'Colour', 'propertyhive' ),
130 'type' => \Elementor\Controls_Manager::COLOR,
131 'selectors' => [
132 '{{WRAPPER}} a:hover' => 'color: {{VALUE}};',
133 ],
134 ]
135 );
136
137 $this->add_control(
138 'background_hover_color',
139 [
140 'label' => __( 'Background Colour', 'propertyhive' ),
141 'type' => \Elementor\Controls_Manager::COLOR,
142 'selectors' => [
143 '{{WRAPPER}} a:hover' => 'background-color: {{VALUE}};',
144 ],
145 ]
146 );
147
148 $this->end_controls_tab();
149
150 $this->add_control(
151 'padding',
152 [
153 'label' => __( 'Link Padding', 'propertyhive' ),
154 'type' => \Elementor\Controls_Manager::DIMENSIONS,
155 'size_units' => [ 'px' ],
156 'selectors' => [
157 '{{WRAPPER}} a' => 'display:inline-block; padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
158 ],
159 'default' => [
160 'top' => 5,
161 'right' => 5,
162 'bottom' => 5,
163 'left' => 5,
164 'isLinked' => true,
165 ],
166 ]
167 );
168
169 $this->end_controls_section();
170
171 }
172
173 protected function render() {
174
175 global $property;
176
177 $settings = $this->get_settings_for_display();
178
179 if ( !isset($property->id) ) {
180 return;
181 }
182
183 ?>
184 <a data-fancybox data-src="#makeEnquiry<?php echo (int)$property->id; ?>" href="javascript:;"><?php echo esc_html(__( 'Make Enquiry', 'propertyhive' )); ?></a>
185
186 <!-- LIGHTBOX FORM -->
187 <div id="makeEnquiry<?php echo (int)$property->id; ?>" style="display:none;">
188
189 <h2><?php echo esc_html(__( 'Make Enquiry', 'propertyhive' )); ?></h2>
190
191 <p><?php echo esc_html(__( 'Please complete the form below and a member of staff will be in touch shortly.', 'propertyhive' )); ?></p>
192
193 <?php propertyhive_enquiry_form(); ?>
194
195 </div>
196 <!-- END LIGHTBOX FORM -->
197 <?php
198
199 }
200
201 }