theme-elements
6 months ago
accordion.php
6 months ago
audio.php
6 months ago
before-after.php
6 months ago
button.php
6 months ago
carousel-navigation.php
6 months ago
circle-chart.php
6 months ago
contact-box.php
6 months ago
contact-form.php
6 months ago
custom-list.php
6 months ago
divider.php
6 months ago
gallery.php
6 months ago
gmap.php
2 days ago
heading-modern.php
5 months ago
icon.php
6 months ago
image.php
6 months ago
mailchimp.php
6 months ago
modern-button.php
6 months ago
products-grid.php
6 months ago
quote.php
6 months ago
recent-comments.php
6 months ago
recent-posts-grid-carousel.php
1 month ago
recent-posts-land-style.php
6 months ago
recent-posts-masonry.php
6 months ago
recent-posts-tiles-carousel.php
6 months ago
recent-posts-tiles.php
6 months ago
recent-posts-timeline.php
6 months ago
recent-products.php
6 months ago
responsive-table.php
6 months ago
search.php
6 months ago
staff.php
6 months ago
svg.php
6 months ago
tabs.php
6 months ago
testimonial.php
6 months ago
text.php
6 months ago
touch-slider.php
6 months ago
video.php
6 months ago
contact-box.php
416 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; // Exit if accessed directly. |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Elementor 'ContactBox' widget. |
| 15 | * |
| 16 | * Elementor widget that displays an 'ContactBox' with lightbox. |
| 17 | * |
| 18 | * @since 1.0.0 |
| 19 | */ |
| 20 | class ContactBox extends Widget_Base { |
| 21 | |
| 22 | /** |
| 23 | * Get widget name. |
| 24 | * |
| 25 | * Retrieve 'ContactBox' widget name. |
| 26 | * |
| 27 | * @since 1.0.0 |
| 28 | * @access public |
| 29 | * |
| 30 | * @return string Widget name. |
| 31 | */ |
| 32 | public function get_name() { |
| 33 | return 'aux_contactbox'; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Get widget title. |
| 38 | * |
| 39 | * Retrieve 'ContactBox' widget title. |
| 40 | * |
| 41 | * @since 1.0.0 |
| 42 | * @access public |
| 43 | * |
| 44 | * @return string Widget title. |
| 45 | */ |
| 46 | public function get_title() { |
| 47 | return __('Contact Box', 'auxin-elements' ); |
| 48 | } |
| 49 | |
| 50 | public function has_widget_inner_wrapper(): bool { |
| 51 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 52 | } |
| 53 | |
| 54 | |
| 55 | /** |
| 56 | * Get widget icon. |
| 57 | * |
| 58 | * Retrieve 'ContactBox' widget icon. |
| 59 | * |
| 60 | * @since 1.0.0 |
| 61 | * @access public |
| 62 | * |
| 63 | * @return string Widget icon. |
| 64 | */ |
| 65 | public function get_icon() { |
| 66 | return 'eicon-image-hotspot auxin-badge'; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Get widget categories. |
| 71 | * |
| 72 | * Retrieve 'ContactBox' widget icon. |
| 73 | * |
| 74 | * @since 1.0.0 |
| 75 | * @access public |
| 76 | * |
| 77 | * @return string Widget icon. |
| 78 | */ |
| 79 | public function get_categories() { |
| 80 | return array( 'auxin-core' ); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Register 'ContactBox' widget controls. |
| 85 | * |
| 86 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 87 | * |
| 88 | * @since 1.0.0 |
| 89 | * @access protected |
| 90 | */ |
| 91 | protected function register_controls() { |
| 92 | |
| 93 | /*-----------------------------------------------------------------------------------*/ |
| 94 | /* Contact Info section |
| 95 | /*-----------------------------------------------------------------------------------*/ |
| 96 | |
| 97 | $this->start_controls_section( |
| 98 | 'contactinfo_section', |
| 99 | array( |
| 100 | 'label' => __('Contact Info', 'auxin-elements' ) |
| 101 | ) |
| 102 | ); |
| 103 | |
| 104 | $this->add_control( |
| 105 | 'email', |
| 106 | array( |
| 107 | 'label' => __('Email','auxin-elements'), |
| 108 | 'description' => __('Contact box email address.', 'auxin-elements'), |
| 109 | 'type' => Controls_Manager::TEXT, |
| 110 | 'input_type' => 'email' |
| 111 | ) |
| 112 | ); |
| 113 | |
| 114 | $this->add_control( |
| 115 | 'telephone', |
| 116 | array( |
| 117 | 'label' => __('Telephone','auxin-elements'), |
| 118 | 'description' => __('Contact box phone number.', 'auxin-elements'), |
| 119 | 'type' => Controls_Manager::TEXT |
| 120 | ) |
| 121 | ); |
| 122 | |
| 123 | $this->add_control( |
| 124 | 'show_socials', |
| 125 | array( |
| 126 | 'label' => __('Show site socials','auxin-elements'), |
| 127 | 'description' => __('Show socials below the info.','auxin-elements'), |
| 128 | 'type' => Controls_Manager::SWITCHER, |
| 129 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 130 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 131 | 'default' => 'yes' |
| 132 | ) |
| 133 | ); |
| 134 | |
| 135 | $this->add_control( |
| 136 | 'address', |
| 137 | array( |
| 138 | 'label' => __('Address','auxin-elements'), |
| 139 | 'type' => Controls_Manager::TEXTAREA, |
| 140 | 'placeholder' => __( 'Type your address here', 'auxin-elements') |
| 141 | ) |
| 142 | ); |
| 143 | |
| 144 | $this->end_controls_section(); |
| 145 | |
| 146 | |
| 147 | $this->start_controls_section( |
| 148 | 'map_section', |
| 149 | array( |
| 150 | 'label' => __('Map', 'auxin-elements' ) |
| 151 | ) |
| 152 | ); |
| 153 | |
| 154 | $this->add_control( |
| 155 | 'show_map', |
| 156 | array( |
| 157 | 'label' => __('Show map','auxin-elements'), |
| 158 | 'description' => __('Show map above the info.','auxin-elements'), |
| 159 | 'type' => Controls_Manager::SWITCHER, |
| 160 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 161 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 162 | 'default' => 'yes' |
| 163 | ) |
| 164 | ); |
| 165 | |
| 166 | $this->add_control( |
| 167 | 'map_position', |
| 168 | array( |
| 169 | 'label' => __('Map position','auxin-elements'), |
| 170 | 'description' => __('Whether to show map above the contact details or below them.', 'auxin-elements'), |
| 171 | 'label_block' => true, |
| 172 | 'type' => Controls_Manager::SELECT, |
| 173 | 'default' => 'down', |
| 174 | 'options' => array( |
| 175 | 'down' => __('Below the contact details.', 'auxin-elements' ), |
| 176 | 'up' => __('Above the contact details.', 'auxin-elements' ) |
| 177 | ), |
| 178 | 'return_value' => 'down', |
| 179 | 'condition' => array( |
| 180 | 'show_map' => 'yes' |
| 181 | ) |
| 182 | ) |
| 183 | ); |
| 184 | |
| 185 | $this->add_responsive_control( |
| 186 | 'height', |
| 187 | array( |
| 188 | 'label' => __( 'Map height', 'auxin-elements' ), |
| 189 | 'type' => Controls_Manager::SLIDER, |
| 190 | 'size_units' => array('px','em'), |
| 191 | 'desktop_default' => array( |
| 192 | 'size' => 160, |
| 193 | 'unit' => 'px' |
| 194 | ), |
| 195 | 'range' => array( |
| 196 | 'px' => array( |
| 197 | 'min' => 0, |
| 198 | 'max' => 1600, |
| 199 | 'step' => 1 |
| 200 | ), |
| 201 | 'em' => array( |
| 202 | 'min' => 1, |
| 203 | 'max' => 100, |
| 204 | 'step' => 0.1 |
| 205 | ) |
| 206 | ), |
| 207 | 'selectors' => array( |
| 208 | '{{WRAPPER}} .aux-map-wrapper' => 'height:{{SIZE}}{{UNIT}} !important;' |
| 209 | ), |
| 210 | 'return_value' => 160, |
| 211 | 'condition' => array( |
| 212 | 'show_map' => 'yes' |
| 213 | ) |
| 214 | ) |
| 215 | ); |
| 216 | |
| 217 | $this->add_control( |
| 218 | 'latitude', |
| 219 | array( |
| 220 | 'label' => __( 'Latitude', 'auxin-elements' ), |
| 221 | 'description' => __('Latitude location over the map.', 'auxin-elements'), |
| 222 | 'type' => Controls_Manager::SLIDER, |
| 223 | 'size_units' => array('px'), |
| 224 | 'default' => array( |
| 225 | 'size' => 40.7, |
| 226 | 'unit' => 'px' |
| 227 | ), |
| 228 | 'range' => array( |
| 229 | 'px' => array( |
| 230 | 'min' => -90, |
| 231 | 'max' => 90, |
| 232 | 'step' => 0.01 |
| 233 | ) |
| 234 | ), |
| 235 | 'return_value' => 40.7, |
| 236 | 'condition' => array( |
| 237 | 'show_map' => 'yes' |
| 238 | ) |
| 239 | ) |
| 240 | ); |
| 241 | |
| 242 | $this->add_control( |
| 243 | 'longitude', |
| 244 | array( |
| 245 | 'label' => __('Longitude','auxin-elements'), |
| 246 | 'description' => __('Longitude location over the map.', 'auxin-elements'), |
| 247 | 'type' => Controls_Manager::SLIDER, |
| 248 | 'size_units' => array('px'), |
| 249 | 'default' => array( |
| 250 | 'size' => -74, |
| 251 | 'unit' => 'px' |
| 252 | ), |
| 253 | 'range' => array( |
| 254 | 'px' => array( |
| 255 | 'min' => -180, |
| 256 | 'max' => 180, |
| 257 | 'step' => 0.01 |
| 258 | ) |
| 259 | ), |
| 260 | 'return_value' => -74, |
| 261 | 'condition' => array( |
| 262 | 'show_map' => 'yes' |
| 263 | ) |
| 264 | ) |
| 265 | ); |
| 266 | |
| 267 | $this->add_control( |
| 268 | 'type', |
| 269 | array( |
| 270 | 'label' => __('Map type','auxin-elements'), |
| 271 | 'label_block' => true, |
| 272 | 'type' => Controls_Manager::SELECT, |
| 273 | 'default' => 'ROADMAP', |
| 274 | 'options' => array( |
| 275 | 'ROADMAP' => __('ROADMAP', 'auxin-elements'), |
| 276 | 'SATELLITE' => __('SATELLITE', 'auxin-elements') |
| 277 | ), |
| 278 | 'return_value' => 'ROADMAP', |
| 279 | 'condition' => array( |
| 280 | 'show_map' => 'yes' |
| 281 | ) |
| 282 | ) |
| 283 | ); |
| 284 | |
| 285 | $this->add_control( |
| 286 | 'style', |
| 287 | array( |
| 288 | 'label' => __('Map style','auxin-elements'), |
| 289 | 'description' => __('This feild allows you to customize the presentation of the standard Google base maps. You can find many preset styles in ', 'auxin-elements') .'<a href="https://snazzymaps.com/" target="_blank">' . __('this website.', 'auxin-elements') . '</a>' , |
| 290 | 'type' => Controls_Manager::CODE, |
| 291 | 'condition' => array( |
| 292 | 'show_map' => 'yes' |
| 293 | ) |
| 294 | ) |
| 295 | ); |
| 296 | |
| 297 | $this->add_control( |
| 298 | 'marker_info', |
| 299 | array( |
| 300 | 'label' => __('Marker info','auxin-elements'), |
| 301 | 'description' => __('Marker popup text, leave it empty if you don\'t need it.', 'auxin-elements'), |
| 302 | 'type' => Controls_Manager::TEXT, |
| 303 | 'condition' => array( |
| 304 | 'show_map' => 'yes' |
| 305 | ) |
| 306 | ) |
| 307 | ); |
| 308 | |
| 309 | $this->add_control( |
| 310 | 'show_mapcontrols', |
| 311 | array( |
| 312 | 'label' => __('Navigation control','auxin-elements'), |
| 313 | 'description' => __('Show nacigation control on map.','auxin-elements'), |
| 314 | 'type' => Controls_Manager::SWITCHER, |
| 315 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 316 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 317 | 'default' => 'no', |
| 318 | 'condition' => array( |
| 319 | 'show_map' => 'yes' |
| 320 | ) |
| 321 | ) |
| 322 | ); |
| 323 | |
| 324 | $this->add_control( |
| 325 | 'zoom', |
| 326 | array( |
| 327 | 'label' => __('Zoom','auxin-elements'), |
| 328 | 'description' => __('The initial resolution at which to display the map, between 1 to 20.', 'auxin-elements'), |
| 329 | 'type' => Controls_Manager::SLIDER, |
| 330 | 'size_units' => array('px'), |
| 331 | 'default' => array( |
| 332 | 'size' => 10, |
| 333 | 'unit' => 'px' |
| 334 | ), |
| 335 | 'range' => array( |
| 336 | 'px' => array( |
| 337 | 'min' => 0, |
| 338 | 'max' => 20, |
| 339 | 'step' => 0.1 |
| 340 | ) |
| 341 | ), |
| 342 | 'return_value' => 10, |
| 343 | 'condition' => array( |
| 344 | 'show_map' => 'yes' |
| 345 | ) |
| 346 | ) |
| 347 | ); |
| 348 | |
| 349 | $this->add_control( |
| 350 | 'zoom_wheel', |
| 351 | array( |
| 352 | 'label' => __('Zoom with mouse wheel','auxin-elements'), |
| 353 | 'type' => Controls_Manager::SWITCHER, |
| 354 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 355 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 356 | 'default' => 'no', |
| 357 | 'condition' => array( |
| 358 | 'show_map' => 'yes' |
| 359 | ) |
| 360 | ) |
| 361 | ); |
| 362 | |
| 363 | $this->end_controls_section(); |
| 364 | |
| 365 | |
| 366 | /*-----------------------------------------------------------------------------------*/ |
| 367 | /* Style Tab |
| 368 | /*-----------------------------------------------------------------------------------*/ |
| 369 | |
| 370 | /* Color Section |
| 371 | /*-------------------------------------*/ |
| 372 | |
| 373 | $this->start_controls_section( |
| 374 | 'color_section', |
| 375 | array( |
| 376 | 'label' => __( 'Color', 'auxin-elements' ), |
| 377 | 'tab' => Controls_Manager::TAB_STYLE |
| 378 | ) |
| 379 | ); |
| 380 | |
| 381 | $this->end_controls_section(); |
| 382 | } |
| 383 | |
| 384 | /** |
| 385 | * Render 'ContactBox' widget output on the frontend. |
| 386 | * |
| 387 | * @access protected |
| 388 | */ |
| 389 | protected function render() { |
| 390 | |
| 391 | $settings = $this->get_settings_for_display(); |
| 392 | |
| 393 | $args = array( |
| 394 | 'style' => $settings['style'], |
| 395 | 'show_map' => $settings['show_map'], |
| 396 | 'map_position' => $settings['map_position'], |
| 397 | 'show_socials' => $settings['show_socials'], |
| 398 | 'email' => $settings['email'], |
| 399 | 'telephone' => $settings['telephone'], |
| 400 | 'address' => $settings['address'], |
| 401 | 'type' => $settings['type'], |
| 402 | 'zoom' => $settings['zoom']['size'], |
| 403 | 'zoom_wheel' => $settings['zoom_wheel'], |
| 404 | 'marker_info' => $settings['marker_info'], |
| 405 | 'show_mapcontrols' => $settings['show_mapcontrols'], |
| 406 | 'latitude' => $settings['latitude']['size'], |
| 407 | 'longitude' => $settings['longitude']['size'], |
| 408 | 'height' => $settings['height']['size'] |
| 409 | ); |
| 410 | |
| 411 | // pass the args through the corresponding shortcode callback |
| 412 | echo auxin_widget_contact_box( $args ); |
| 413 | } |
| 414 | |
| 415 | } |
| 416 |