PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.3.3
Easy Elements for Elementor – Addons & Website Templates v1.3.3
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.3, at widgets/search/search.php

320 lines 10.1 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_responsive_control(
116 'search_icon_vertical_position',
117 [
118 'label' => esc_html__('Icon Vertical Position (px)', 'easy-elements'),
119 'type' => Controls_Manager::SLIDER,
120 'range' => [
121 'px' => [
122 'min' => -50,
123 'max' => 50,
124 ],
125 ],
126 'default' => [
127 'unit' => 'px',
128 'size' => 0,
129 ],
130 'selectors' => [
131 '{{WRAPPER}} .eel-search-open-btn' => 'transform: translateY({{SIZE}}{{UNIT}});',
132 ],
133 'condition' => [
134 'select_style' => '1'
135 ]
136 ]
137 );
138
139 $this->add_responsive_control(
140 'search_icon_horizontal_position',
141 [
142 'label' => esc_html__('Icon Horizontal Position (px)', 'easy-elements'),
143 'type' => Controls_Manager::SLIDER,
144 'selectors' => [
145 '{{WRAPPER}} .eel-search-submit-btn' => 'right: {{SIZE}}{{UNIT}};',
146 ],
147 'condition' => [
148 'select_style' => '2'
149 ]
150 ]
151 );
152
153
154 $this->add_control(
155 'close_icon',
156 [
157 'label' => esc_html__('Close Icon', 'easy-elements'),
158 'type' => \Elementor\Controls_Manager::ICONS,
159 'default' => [
160 'value' => 'fas fa-arrow-up',
161 'library' => 'fa-solid',
162 ],
163 'condition' => [
164 'select_style' => '1'
165 ]
166 ]
167 );
168
169 $this->add_responsive_control(
170 'icon_size',
171 [
172 'label' => esc_html__('Close Icon Size (px)', 'easy-elements'),
173 'type' => Controls_Manager::SLIDER,
174 'range' => [
175 'px' => [
176 'min' => 10,
177 'max' => 100,
178 ],
179 ],
180 'selectors' => [
181 '{{WRAPPER}} .eel-search-close-btn i, {{WRAPPER}} .eel-search-close-btn svg' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
182 ],
183 'condition' => [
184 'select_style' => '1'
185 ]
186 ]
187 );
188
189
190 $this->add_control(
191 'overlay_background',
192 [
193 'label' => esc_html__('Overlay Background', 'easy-elements'),
194 'type' => Controls_Manager::COLOR,
195 'default' => '',
196 'selectors' => [
197 '{{WRAPPER}} .eel-search-lightbox, {{WRAPPER}} .eel-search-overlay' => 'background: {{VALUE}};',
198 ],
199 'condition' => [
200 'select_style' => '1'
201 ]
202 ]
203 );
204
205 $this->add_control(
206 'input_text_color',
207 [
208 'label' => esc_html__('Input Text Color', 'easy-elements'),
209 'type' => Controls_Manager::COLOR,
210 'selectors' => [
211 '{{WRAPPER}} .eel-search-content .eel-search-field' => 'color: {{VALUE}};',
212 '{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'color: {{VALUE}};',
213 ],
214 ]
215 );
216
217 $this->add_control(
218 'input_bg_color',
219 [
220 'label' => esc_html__('Input Background Color', 'easy-elements'),
221 'type' => Controls_Manager::COLOR,
222 'selectors' => [
223 '{{WRAPPER}} .eel-search-content .eel-search-field' => 'background-color: {{VALUE}};',
224 '{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'background: {{VALUE}};',
225 ],
226 ]
227 );
228
229 $this->add_control(
230 'input_border_color',
231 [
232 'label' => esc_html__('Input Border Color', 'easy-elements'),
233 'type' => Controls_Manager::COLOR,
234 'selectors' => [
235 '{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'border-color: {{VALUE}};',
236 ],
237 'condition' => [
238 'select_style' => '2'
239 ]
240 ]
241 );
242
243 $this->add_control(
244 'input_focus_border_color',
245 [
246 'label' => esc_html__('Border Color (Focus)', 'easy-elements'),
247 'type' => Controls_Manager::COLOR,
248 'selectors' => [
249 '{{WRAPPER}} .eel-search-style-2 .eel-search-field:focus' => 'border-color: {{VALUE}};',
250 ],
251 'condition' => [
252 'select_style' => '2'
253 ]
254 ]
255 );
256
257 $this->add_control(
258 'submit_button_color',
259 [
260 'label' => esc_html__('Submit Button Background', 'easy-elements'),
261 'type' => Controls_Manager::COLOR,
262 'selectors' => [
263 '{{WRAPPER}} .eel-search-content .eel-search-submit' => 'background-color: {{VALUE}};',
264 ],
265 'condition' => [
266 'select_style' => '1'
267 ]
268 ]
269 );
270 $this->end_controls_section();
271 }
272
273 protected function render() {
274 $settings = $this->get_settings_for_display();
275 $style = $settings['select_style'];
276
277 if ( $style == '2' ) : ?>
278 <div class="eel-search-style-<?php echo esc_attr( $style ); ?>">
279 <form role="search" method="get" class="eel-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
280 <input type="search" class="eel-search-field" placeholder="<?php echo esc_attr( $settings['search_placeholder'] ?? 'Search..' ); ?>" value="" name="s" />
281 <button type="submit" class="eel-search-submit-btn" aria-label="Submit Search">
282 <?php
283 if( $settings['open_icon']['value'] ) :
284 \Elementor\Icons_Manager::render_icon( $settings['open_icon'], [ 'aria-hidden' => 'true' ] );
285 else : ?>
286 <i class="eel-absl unicon-search"></i>
287 <?php
288 endif; ?>
289 </button>
290 </form>
291 </div>
292 <?php
293 else: ?>
294 <a href="#" role="button" class="eel-search-open-btn" aria-label="<?php esc_attr_e('Open Search', 'easy-elements'); ?>">
295 <?php \Elementor\Icons_Manager::render_icon( $settings['open_icon'], [ 'aria-hidden' => 'true' ] ); ?>
296 </a>
297
298 <div class="eel-search-lightbox">
299 <div class="eel-search-overlay">
300 <a href="#" role="button" class="eel-search-close-btn" aria-label="<?php esc_attr_e('Close Search', 'easy-elements'); ?>">
301 <?php \Elementor\Icons_Manager::render_icon( $settings['close_icon'], [ 'aria-hidden' => 'true' ] ); ?>
302 </a>
303 </div>
304 <div class="eel-search-content">
305 <div class="eel-search-title">
306 <?php echo esc_attr( $settings['search_top_title'] ?: __( 'What are you looking for?', 'easy-elements' ) ); ?>
307 </div>
308 <form role="search" method="get" class="eel-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
309 <input type="search" class="eel-search-field" placeholder="<?php echo esc_attr( $settings['search_placeholder'] ?? 'Type keywords here...' ); ?>" value="" name="s" />
310 <button type="submit" class="eel-search-submit" aria-label="Submit Search">
311 <i class="eel-absl unicon-search"></i>
312 </button>
313 </form>
314 </div>
315 </div>
316 <?php
317 endif;
318 }
319 }
320