PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.3.4
Easy Elements for Elementor – Addons & Website Templates v1.3.4
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 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 All 47 releases
easy-elements / widgets / search / search.php

search.php in Easy Elements for Elementor – Addons & Website Templates 1.3.4, at widgets/search/search.php

332 lines 10.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\Widgets;
3 use Elementor\Controls_Manager;
4 use Elementor\Widget_Base;
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit;
8 }
9
10 class Easyel_Search_Widget extends \Elementor\Widget_Base {
11
12 public function get_name() {
13 return 'eel-search';
14 }
15
16 public function get_title() {
17 return __( 'Search', 'easy-elements' );
18 }
19
20 public function get_icon() {
21 return 'easyicon easyelIcon-search';
22 }
23
24 public function get_categories() {
25 return [ 'easyelements_header_footer_category' ];
26 }
27
28 public function get_keywords() {
29 return [ 'search', 'input', 'field', 'click', 'text' ];
30 }
31
32 public function get_style_depends() {
33 return [
34 'eel-search',
35 ];
36 }
37
38 public function get_script_depends() {
39 return [
40 'eel-search',
41 ];
42 }
43
44
45 protected function register_controls() {
46
47 $this->start_controls_section(
48 'content_section',
49 [
50 'label' => esc_html__('Search Settings', 'easy-elements'),
51 'tab' => Controls_Manager::TAB_CONTENT,
52 ]
53 );
54
55 $this->add_control(
56 'select_style',
57 [
58 'label' => esc_html__( 'Search Skin', 'easy-elements' ),
59 'type' => \Elementor\Controls_Manager::SELECT,
60 'default' => '1',
61 'options' => [
62 '1' => esc_html__( 'Search Popup', 'easy-elements' ),
63 '2' => esc_html__( 'Search Fields', 'easy-elements' ),
64 ],
65 ]
66 );
67
68 $this->add_control(
69 'search_top_title',
70 [
71 'label' => esc_html__('Search Title', 'easy-elements'),
72 'type' => Controls_Manager::TEXT,
73 ]
74 );
75
76 $this->add_control(
77 'search_placeholder',
78 [
79 'label' => esc_html__('Search Placeholder', 'easy-elements'),
80 'type' => Controls_Manager::TEXT,
81 'default' => esc_html__('Type keywords here...', 'easy-elements'),
82 ]
83 );
84
85 $this->add_control(
86 'open_icon',
87 [
88 'label' => esc_html__('Search Icon', 'easy-elements'),
89 'type' => \Elementor\Controls_Manager::ICONS,
90 'default' => [
91 'value' => 'fas fa-search',
92 'library' => 'fa-solid',
93 ],
94 ]
95 );
96
97 $this->add_responsive_control(
98 'search_icon_size',
99 [
100 'label' => esc_html__('Icon Size (px)', 'easy-elements'),
101 'type' => Controls_Manager::SLIDER,
102 'range' => [
103 'px' => [
104 'min' => 10,
105 'max' => 100,
106 ],
107 ],
108 'selectors' => [
109 '{{WRAPPER}} .eel-search-open-btn i, {{WRAPPER}} .eel-search-open-btn svg' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
110 '{{WRAPPER}} .eel-search-submit-btn i, {{WRAPPER}} .eel-search-submit-btn svg' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
111 ],
112 ]
113 );
114
115 $this->add_control(
116 'icon_colors',
117 [
118 'label' => esc_html__('Icon Color', 'easy-elements'),
119 'type' => Controls_Manager::COLOR,
120 'selectors' => [
121 '{{WRAPPER}} .eel-search-open-btn i' => 'color: {{VALUE}};',
122 '{{WRAPPER}} .eel-search-open-btn svg, {{WRAPPER}} .eel-search-open-btn svg path' => 'fill: {{VALUE}};',
123 ],
124 ]
125 );
126
127 $this->add_responsive_control(
128 'search_icon_vertical_position',
129 [
130 'label' => esc_html__('Icon Vertical Position (px)', 'easy-elements'),
131 'type' => Controls_Manager::SLIDER,
132 'range' => [
133 'px' => [
134 'min' => -50,
135 'max' => 50,
136 ],
137 ],
138 'default' => [
139 'unit' => 'px',
140 'size' => 0,
141 ],
142 'selectors' => [
143 '{{WRAPPER}} .eel-search-open-btn' => 'transform: translateY({{SIZE}}{{UNIT}});',
144 ],
145 'condition' => [
146 'select_style' => '1'
147 ]
148 ]
149 );
150
151 $this->add_responsive_control(
152 'search_icon_horizontal_position',
153 [
154 'label' => esc_html__('Icon Horizontal Position (px)', 'easy-elements'),
155 'type' => Controls_Manager::SLIDER,
156 'selectors' => [
157 '{{WRAPPER}} .eel-search-submit-btn' => 'right: {{SIZE}}{{UNIT}};',
158 ],
159 'condition' => [
160 'select_style' => '2'
161 ]
162 ]
163 );
164
165
166 $this->add_control(
167 'close_icon',
168 [
169 'label' => esc_html__('Close Icon', 'easy-elements'),
170 'type' => \Elementor\Controls_Manager::ICONS,
171 'default' => [
172 'value' => 'fas fa-arrow-up',
173 'library' => 'fa-solid',
174 ],
175 'condition' => [
176 'select_style' => '1'
177 ]
178 ]
179 );
180
181 $this->add_responsive_control(
182 'icon_size',
183 [
184 'label' => esc_html__('Close Icon Size (px)', 'easy-elements'),
185 'type' => Controls_Manager::SLIDER,
186 'range' => [
187 'px' => [
188 'min' => 10,
189 'max' => 100,
190 ],
191 ],
192 'selectors' => [
193 '{{WRAPPER}} .eel-search-close-btn i, {{WRAPPER}} .eel-search-close-btn svg' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
194 ],
195 'condition' => [
196 'select_style' => '1'
197 ]
198 ]
199 );
200
201
202 $this->add_control(
203 'overlay_background',
204 [
205 'label' => esc_html__('Overlay Background', 'easy-elements'),
206 'type' => Controls_Manager::COLOR,
207 'default' => '',
208 'selectors' => [
209 '{{WRAPPER}} .eel-search-lightbox, {{WRAPPER}} .eel-search-overlay' => 'background: {{VALUE}};',
210 ],
211 'condition' => [
212 'select_style' => '1'
213 ]
214 ]
215 );
216
217 $this->add_control(
218 'input_text_color',
219 [
220 'label' => esc_html__('Input Text Color', 'easy-elements'),
221 'type' => Controls_Manager::COLOR,
222 'selectors' => [
223 '{{WRAPPER}} .eel-search-content .eel-search-field' => 'color: {{VALUE}};',
224 '{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'color: {{VALUE}};',
225 ],
226 ]
227 );
228
229 $this->add_control(
230 'input_bg_color',
231 [
232 'label' => esc_html__('Input Background Color', 'easy-elements'),
233 'type' => Controls_Manager::COLOR,
234 'selectors' => [
235 '{{WRAPPER}} .eel-search-content .eel-search-field' => 'background-color: {{VALUE}};',
236 '{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'background: {{VALUE}};',
237 ],
238 ]
239 );
240
241 $this->add_control(
242 'input_border_color',
243 [
244 'label' => esc_html__('Input Border Color', 'easy-elements'),
245 'type' => Controls_Manager::COLOR,
246 'selectors' => [
247 '{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'border-color: {{VALUE}};',
248 ],
249 'condition' => [
250 'select_style' => '2'
251 ]
252 ]
253 );
254
255 $this->add_control(
256 'input_focus_border_color',
257 [
258 'label' => esc_html__('Border Color (Focus)', 'easy-elements'),
259 'type' => Controls_Manager::COLOR,
260 'selectors' => [
261 '{{WRAPPER}} .eel-search-style-2 .eel-search-field:focus' => 'border-color: {{VALUE}};',
262 ],
263 'condition' => [
264 'select_style' => '2'
265 ]
266 ]
267 );
268
269 $this->add_control(
270 'submit_button_color',
271 [
272 'label' => esc_html__('Submit Button Background', 'easy-elements'),
273 'type' => Controls_Manager::COLOR,
274 'selectors' => [
275 '{{WRAPPER}} .eel-search-content .eel-search-submit' => 'background-color: {{VALUE}};',
276 ],
277 'condition' => [
278 'select_style' => '1'
279 ]
280 ]
281 );
282 $this->end_controls_section();
283 }
284
285 protected function render() {
286 $settings = $this->get_settings_for_display();
287 $style = $settings['select_style'];
288
289 if ( $style == '2' ) : ?>
290 <div class="eel-search-style-<?php echo esc_attr( $style ); ?>">
291 <form role="search" method="get" class="eel-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
292 <input type="search" class="eel-search-field" placeholder="<?php echo esc_attr( $settings['search_placeholder'] ?? 'Search..' ); ?>" value="" name="s" />
293 <button type="submit" class="eel-search-submit-btn" aria-label="Submit Search">
294 <?php
295 if( $settings['open_icon']['value'] ) :
296 \Elementor\Icons_Manager::render_icon( $settings['open_icon'], [ 'aria-hidden' => 'true' ] );
297 else : ?>
298 <i class="eel-absl unicon-search"></i>
299 <?php
300 endif; ?>
301 </button>
302 </form>
303 </div>
304 <?php
305 else: ?>
306 <a href="#" role="button" class="eel-search-open-btn" aria-label="<?php esc_attr_e('Open Search', 'easy-elements'); ?>">
307 <?php \Elementor\Icons_Manager::render_icon( $settings['open_icon'], [ 'aria-hidden' => 'true' ] ); ?>
308 </a>
309
310 <div class="eel-search-lightbox">
311 <div class="eel-search-overlay">
312 <a href="#" role="button" class="eel-search-close-btn" aria-label="<?php esc_attr_e('Close Search', 'easy-elements'); ?>">
313 <?php \Elementor\Icons_Manager::render_icon( $settings['close_icon'], [ 'aria-hidden' => 'true' ] ); ?>
314 </a>
315 </div>
316 <div class="eel-search-content">
317 <div class="eel-search-title">
318 <?php echo esc_attr( $settings['search_top_title'] ?: __( 'What are you looking for?', 'easy-elements' ) ); ?>
319 </div>
320 <form role="search" method="get" class="eel-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
321 <input type="search" class="eel-search-field" placeholder="<?php echo esc_attr( $settings['search_placeholder'] ?? 'Type keywords here...' ); ?>" value="" name="s" />
322 <button type="submit" class="eel-search-submit" aria-label="Submit Search">
323 <i class="eel-absl unicon-search"></i>
324 </button>
325 </form>
326 </div>
327 </div>
328 <?php
329 endif;
330 }
331 }
332