| 1 |
<?php |
| 2 |
namespace HelloPlus\Modules\Content\Widgets; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly. |
| 6 |
} |
| 7 |
|
| 8 |
use HelloPlus\Modules\Content\Classes\Choose_Img_Control; |
| 9 |
use HelloPlus\Modules\Content\Classes\Render\Widget_Contact_Render; |
| 10 |
use HelloPlus\Modules\Content\Traits\Widget_Repeater_Editable; |
| 11 |
use HelloPlus\Modules\Theme\Module as Theme_Module; |
| 12 |
use HelloPlus\Includes\Utils; |
| 13 |
use HelloPlus\Classes\{ |
| 14 |
Ehp_Column_Structure, |
| 15 |
Ehp_Full_Height, |
| 16 |
Ehp_Padding, |
| 17 |
Ehp_Shapes, |
| 18 |
Ehp_Social_Platforms, |
| 19 |
}; |
| 20 |
|
| 21 |
use Elementor\{ |
| 22 |
Controls_Manager, |
| 23 |
Group_Control_Typography, |
| 24 |
Group_Control_Background, |
| 25 |
Group_Control_Box_Shadow, |
| 26 |
Repeater, |
| 27 |
Settings, |
| 28 |
Widget_Base, |
| 29 |
Group_Control_Css_Filter, |
| 30 |
}; |
| 31 |
|
| 32 |
use Elementor\Core\Kits\Documents\Tabs\{ |
| 33 |
Global_Typography, |
| 34 |
Global_Colors, |
| 35 |
}; |
| 36 |
|
| 37 |
use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 38 |
|
| 39 |
class Contact extends Widget_Base { |
| 40 |
|
| 41 |
use Widget_Repeater_Editable; |
| 42 |
|
| 43 |
public function get_name(): string { |
| 44 |
return 'contact'; |
| 45 |
} |
| 46 |
|
| 47 |
public function get_title(): string { |
| 48 |
return esc_html__( 'Contact', 'hello-plus' ); |
| 49 |
} |
| 50 |
|
| 51 |
public function get_categories(): array { |
| 52 |
return [ Theme_Module::HELLOPLUS_EDITOR_CATEGORY_SLUG ]; |
| 53 |
} |
| 54 |
|
| 55 |
public function get_keywords(): array { |
| 56 |
return [ 'contact' ]; |
| 57 |
} |
| 58 |
|
| 59 |
public function get_icon(): string { |
| 60 |
return 'eicon-email-field'; |
| 61 |
} |
| 62 |
|
| 63 |
public function get_style_depends(): array { |
| 64 |
return array_merge( [ 'helloplus-contact' ], Utils::get_widgets_depends() ); |
| 65 |
} |
| 66 |
|
| 67 |
public function get_custom_help_url(): string { |
| 68 |
return 'https://go.elementor.com/contact-widget-help'; |
| 69 |
} |
| 70 |
|
| 71 |
protected function render(): void { |
| 72 |
$render_strategy = new Widget_Contact_Render( $this ); |
| 73 |
|
| 74 |
$this->add_inline_editing_attributes( 'heading_text', 'none' ); |
| 75 |
$this->add_inline_editing_attributes( 'description_text', 'none' ); |
| 76 |
$this->add_inline_editing_attributes( 'group_1_links_subheading', 'none' ); |
| 77 |
$this->add_inline_editing_attributes( 'group_1_text_subheading', 'none' ); |
| 78 |
$this->add_inline_editing_attributes( 'group_1_social_subheading', 'none' ); |
| 79 |
$this->add_inline_editing_attributes( 'group_2_text_subheading', 'none' ); |
| 80 |
$this->add_inline_editing_attributes( 'group_2_links_subheading', 'none' ); |
| 81 |
$this->add_inline_editing_attributes( 'group_2_social_subheading', 'none' ); |
| 82 |
$this->add_inline_editing_attributes( 'group_3_links_subheading', 'none' ); |
| 83 |
$this->add_inline_editing_attributes( 'group_3_text_subheading', 'none' ); |
| 84 |
$this->add_inline_editing_attributes( 'group_3_social_subheading', 'none' ); |
| 85 |
$this->add_inline_editing_attributes( 'group_4_links_subheading', 'none' ); |
| 86 |
$this->add_inline_editing_attributes( 'group_4_text_subheading', 'none' ); |
| 87 |
$this->add_inline_editing_attributes( 'group_4_social_subheading', 'none' ); |
| 88 |
$this->add_inline_editing_attributes( 'group_1_text_textarea', 'none' ); |
| 89 |
$this->add_inline_editing_attributes( 'group_2_text_textarea', 'none' ); |
| 90 |
$this->add_inline_editing_attributes( 'group_3_text_textarea', 'none' ); |
| 91 |
$this->add_inline_editing_attributes( 'group_4_text_textarea', 'none' ); |
| 92 |
|
| 93 |
$render_strategy->render(); |
| 94 |
} |
| 95 |
|
| 96 |
protected function register_controls() { |
| 97 |
$this->add_content_section(); |
| 98 |
$this->add_style_section(); |
| 99 |
} |
| 100 |
|
| 101 |
protected function add_content_section() { |
| 102 |
$this->add_layout_content_section(); |
| 103 |
$this->add_text_content_section(); |
| 104 |
$this->add_contact_details_content_section(); |
| 105 |
$this->add_map_content_section(); |
| 106 |
} |
| 107 |
|
| 108 |
protected function add_style_section() { |
| 109 |
$this->add_layout_style_section(); |
| 110 |
$this->add_text_style_section(); |
| 111 |
$this->add_contact_details_style_section(); |
| 112 |
$this->add_map_style_section(); |
| 113 |
$this->add_box_style_section(); |
| 114 |
} |
| 115 |
|
| 116 |
protected function add_layout_content_section() { |
| 117 |
$this->start_controls_section( |
| 118 |
'layout_section', |
| 119 |
[ |
| 120 |
'label' => esc_html__( 'Layout', 'hello-plus' ), |
| 121 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 122 |
] |
| 123 |
); |
| 124 |
|
| 125 |
$this->add_control( |
| 126 |
'layout_preset', |
| 127 |
[ |
| 128 |
'label' => esc_html__( 'Preset', 'hello-plus' ), |
| 129 |
'type' => Choose_Img_Control::CONTROL_NAME, |
| 130 |
'default' => 'locate', |
| 131 |
'label_block' => true, |
| 132 |
'columns' => 2, |
| 133 |
'toggle' => false, |
| 134 |
'options' => [ |
| 135 |
'locate' => [ |
| 136 |
'title' => wp_kses_post( "Locate: Highlight your\nlocation to help your\nclients find you." ), |
| 137 |
'image' => HELLOPLUS_IMAGES_URL . 'contact-locate.svg', |
| 138 |
'hover_image' => true, |
| 139 |
], |
| 140 |
'touchpoint' => [ |
| 141 |
'title' => wp_kses_post( "Touchpoint:\nEncourage direct\ncontact to help clients\nconnect with you." ), |
| 142 |
'image' => HELLOPLUS_IMAGES_URL . 'contact-touchpoint.svg', |
| 143 |
'hover_image' => true, |
| 144 |
], |
| 145 |
'quick-info' => [ |
| 146 |
'title' => wp_kses_post( "Quick info: Share\nessential business\ndetails at a glance for\nfast access." ), |
| 147 |
'image' => HELLOPLUS_IMAGES_URL . 'contact-quick-info.svg', |
| 148 |
'hover_image' => true, |
| 149 |
], |
| 150 |
], |
| 151 |
] |
| 152 |
); |
| 153 |
|
| 154 |
$this->end_controls_section(); |
| 155 |
} |
| 156 |
|
| 157 |
protected function add_text_content_section() { |
| 158 |
$this->start_controls_section( |
| 159 |
'text_section', |
| 160 |
[ |
| 161 |
'label' => esc_html__( 'Text', 'hello-plus' ), |
| 162 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 163 |
] |
| 164 |
); |
| 165 |
|
| 166 |
$this->add_control( |
| 167 |
'heading_text', |
| 168 |
[ |
| 169 |
'label' => esc_html__( 'Heading', 'hello-plus' ), |
| 170 |
'type' => Controls_Manager::TEXTAREA, |
| 171 |
'rows' => 6, |
| 172 |
'default' => esc_html__( 'Get in touch', 'hello-plus' ), |
| 173 |
'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ), |
| 174 |
'dynamic' => [ |
| 175 |
'active' => true, |
| 176 |
], |
| 177 |
] |
| 178 |
); |
| 179 |
|
| 180 |
$this->add_control( |
| 181 |
'heading_tag', |
| 182 |
[ |
| 183 |
'label' => esc_html__( 'HTML Tag', 'hello-plus' ), |
| 184 |
'type' => Controls_Manager::SELECT, |
| 185 |
'options' => [ |
| 186 |
'h1' => 'H1', |
| 187 |
'h2' => 'H2', |
| 188 |
'h3' => 'H3', |
| 189 |
'h4' => 'H4', |
| 190 |
'h5' => 'H5', |
| 191 |
'h6' => 'H6', |
| 192 |
'div' => 'div', |
| 193 |
'span' => 'span', |
| 194 |
'p' => 'p', |
| 195 |
], |
| 196 |
'default' => 'h2', |
| 197 |
] |
| 198 |
); |
| 199 |
|
| 200 |
$this->add_control( |
| 201 |
'description_text', |
| 202 |
[ |
| 203 |
'label' => esc_html__( 'Description', 'hello-plus' ), |
| 204 |
'type' => Controls_Manager::TEXTAREA, |
| 205 |
'rows' => 6, |
| 206 |
'default' => htmlspecialchars_decode( __( 'Have questions or ready to take the next step? Reach out to us—we\'re here to help with your fitness journey. Whether you\'re looking for guidance, scheduling a session, or just want more information, we\'ve got you covered.', 'hello-plus' ) ), |
| 207 |
'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ), |
| 208 |
'dynamic' => [ |
| 209 |
'active' => true, |
| 210 |
], |
| 211 |
] |
| 212 |
); |
| 213 |
|
| 214 |
$this->add_control( |
| 215 |
'description_tag', |
| 216 |
[ |
| 217 |
'label' => esc_html__( 'HTML Tag', 'hello-plus' ), |
| 218 |
'type' => Controls_Manager::SELECT, |
| 219 |
'options' => [ |
| 220 |
'h1' => 'H1', |
| 221 |
'h2' => 'H2', |
| 222 |
'h3' => 'H3', |
| 223 |
'h4' => 'H4', |
| 224 |
'h5' => 'H5', |
| 225 |
'h6' => 'H6', |
| 226 |
'div' => 'div', |
| 227 |
'span' => 'span', |
| 228 |
'p' => 'p', |
| 229 |
], |
| 230 |
'default' => 'p', |
| 231 |
] |
| 232 |
); |
| 233 |
|
| 234 |
$this->end_controls_section(); |
| 235 |
} |
| 236 |
|
| 237 |
protected function add_contact_details_content_section() { |
| 238 |
$this->start_controls_section( |
| 239 |
'contact_details_section', |
| 240 |
[ |
| 241 |
'label' => esc_html__( 'Contact Details', 'hello-plus' ), |
| 242 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 243 |
] |
| 244 |
); |
| 245 |
|
| 246 |
$this->add_group_controls( '1' ); |
| 247 |
|
| 248 |
$this->add_group_controls( '2' ); |
| 249 |
|
| 250 |
$this->add_group_controls( '3' ); |
| 251 |
|
| 252 |
$this->add_group_controls( '4' ); |
| 253 |
|
| 254 |
$this->add_control( |
| 255 |
'subheading_tag', |
| 256 |
[ |
| 257 |
'label' => esc_html__( 'Subheading HTML Tag', 'hello-plus' ), |
| 258 |
'type' => Controls_Manager::SELECT, |
| 259 |
'options' => [ |
| 260 |
'h1' => 'H1', |
| 261 |
'h2' => 'H2', |
| 262 |
'h3' => 'H3', |
| 263 |
'h4' => 'H4', |
| 264 |
'h5' => 'H5', |
| 265 |
'h6' => 'H6', |
| 266 |
'div' => 'div', |
| 267 |
'span' => 'span', |
| 268 |
'p' => 'p', |
| 269 |
], |
| 270 |
'default' => 'h3', |
| 271 |
'separator' => 'before', |
| 272 |
] |
| 273 |
); |
| 274 |
|
| 275 |
$this->end_controls_section(); |
| 276 |
} |
| 277 |
|
| 278 |
protected function add_map_content_section() { |
| 279 |
$this->start_controls_section( |
| 280 |
'map_section', |
| 281 |
[ |
| 282 |
'label' => esc_html__( 'Map', 'hello-plus' ), |
| 283 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 284 |
'condition' => [ |
| 285 |
'layout_preset!' => 'quick-info', |
| 286 |
], |
| 287 |
] |
| 288 |
); |
| 289 |
|
| 290 |
if ( Utils::elementor()->editor->is_edit_mode() ) { |
| 291 |
$api_key = get_option( 'elementor_google_maps_api_key' ); |
| 292 |
|
| 293 |
if ( ! $api_key ) { |
| 294 |
$this->add_control( |
| 295 |
'api_key_notification', |
| 296 |
[ |
| 297 |
'type' => Controls_Manager::ALERT, |
| 298 |
'alert_type' => 'info', |
| 299 |
'content' => sprintf( |
| 300 |
/* translators: 1: Integration settings link open tag, 2: Create API key link open tag, 3: Link close tag. */ |
| 301 |
esc_html__( 'Set your Google Maps API Key in Elementor\'s %1$sIntegrations Settings%3$s page. Create your key %2$shere.%3$s', 'hello-plus' ), |
| 302 |
'<a href="' . Settings::get_settings_tab_url( 'integrations' ) . '" target="_blank">', |
| 303 |
'<a href="https://developers.google.com/maps/documentation/embed/get-api-key" target="_blank">', |
| 304 |
'</a>' |
| 305 |
), |
| 306 |
] |
| 307 |
); |
| 308 |
} |
| 309 |
} |
| 310 |
|
| 311 |
$default_address = esc_html__( 'London Eye, London, United Kingdom', 'hello-plus' ); |
| 312 |
$this->add_control( |
| 313 |
'map_address', |
| 314 |
[ |
| 315 |
'label' => esc_html__( 'Location', 'hello-plus' ), |
| 316 |
'type' => Controls_Manager::TEXT, |
| 317 |
'dynamic' => [ |
| 318 |
'active' => true, |
| 319 |
'categories' => [ |
| 320 |
TagsModule::POST_META_CATEGORY, |
| 321 |
], |
| 322 |
], |
| 323 |
'ai' => [ |
| 324 |
'active' => false, |
| 325 |
], |
| 326 |
'placeholder' => $default_address, |
| 327 |
'default' => $default_address, |
| 328 |
'label_block' => true, |
| 329 |
] |
| 330 |
); |
| 331 |
|
| 332 |
$this->end_controls_section(); |
| 333 |
} |
| 334 |
|
| 335 |
protected function add_group_controls( $group_number ) { |
| 336 |
$group_condition = '1' === $group_number ? [] : [ |
| 337 |
'group_' . $group_number . '_switcher' => 'yes', |
| 338 |
]; |
| 339 |
|
| 340 |
if ( '1' === $group_number ) { |
| 341 |
$this->add_control( |
| 342 |
'group_' . $group_number . '_heading', |
| 343 |
[ |
| 344 |
'label' => sprintf( esc_html__( 'Group %d', 'hello-plus' ), $group_number ), |
| 345 |
'type' => Controls_Manager::HEADING, |
| 346 |
] |
| 347 |
); |
| 348 |
} else { |
| 349 |
$this->add_control( |
| 350 |
'group_' . $group_number . '_switcher', |
| 351 |
[ |
| 352 |
'label' => sprintf( esc_html__( 'Group %d', 'hello-plus' ), $group_number ), |
| 353 |
'type' => Controls_Manager::SWITCHER, |
| 354 |
'label_on' => esc_html__( 'Show', 'hello-plus' ), |
| 355 |
'label_off' => esc_html__( 'Hide', 'hello-plus' ), |
| 356 |
'return_value' => 'yes', |
| 357 |
'default' => 'yes', |
| 358 |
'separator' => 'before', |
| 359 |
] |
| 360 |
); |
| 361 |
} |
| 362 |
|
| 363 |
$group_types = [ |
| 364 |
'1' => 'contact-links', |
| 365 |
'3' => 'contact-links', |
| 366 |
'2' => 'text', |
| 367 |
'4' => 'social-icons', |
| 368 |
]; |
| 369 |
|
| 370 |
$this->add_control( |
| 371 |
'group_' . $group_number . '_type', |
| 372 |
[ |
| 373 |
'label' => esc_html__( 'Type', 'hello-plus' ), |
| 374 |
'type' => Controls_Manager::SELECT, |
| 375 |
'options' => [ |
| 376 |
'contact-links' => esc_html__( 'Contact Links', 'hello-plus' ), |
| 377 |
'text' => esc_html__( 'Text', 'hello-plus' ), |
| 378 |
'social-icons' => esc_html__( 'Social Icons', 'hello-plus' ), |
| 379 |
], |
| 380 |
'default' => $group_types[ $group_number ] ?? '', |
| 381 |
'condition' => $group_condition, |
| 382 |
] |
| 383 |
); |
| 384 |
|
| 385 |
$this->add_contact_links_controls( $group_number, $group_condition ); |
| 386 |
|
| 387 |
$this->add_text_controls( $group_number, $group_condition ); |
| 388 |
|
| 389 |
$this->add_social_controls( $group_number, $group_condition ); |
| 390 |
} |
| 391 |
|
| 392 |
protected function add_contact_links_controls( $group_number, $group_condition ) { |
| 393 |
$group_subheadings = [ |
| 394 |
'1' => htmlspecialchars_decode( __( 'Let\'s talk', 'hello-plus' ) ), |
| 395 |
'2' => esc_html__( 'Hours', 'hello-plus' ), |
| 396 |
'3' => esc_html__( 'Visit', 'hello-plus' ), |
| 397 |
'4' => esc_html__( 'Follow', 'hello-plus' ), |
| 398 |
]; |
| 399 |
|
| 400 |
$this->add_control( |
| 401 |
'group_' . $group_number . '_links_subheading', |
| 402 |
[ |
| 403 |
'label' => esc_html__( 'Subheading', 'hello-plus' ), |
| 404 |
'type' => Controls_Manager::TEXT, |
| 405 |
'default' => $group_subheadings[ $group_number ] ?? '', |
| 406 |
'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ), |
| 407 |
'dynamic' => [ |
| 408 |
'active' => true, |
| 409 |
], |
| 410 |
'condition' => array_merge( $group_condition, [ |
| 411 |
'group_' . $group_number . '_type' => 'contact-links', |
| 412 |
] ), |
| 413 |
] |
| 414 |
); |
| 415 |
|
| 416 |
$defaults = [ |
| 417 |
'icon_default' => [ |
| 418 |
'value' => 'fas fa-phone-alt', |
| 419 |
'library' => 'fa-solid', |
| 420 |
], |
| 421 |
'label_default' => esc_html__( 'Call', 'hello-plus' ), |
| 422 |
'platform_default' => 'telephone', |
| 423 |
]; |
| 424 |
|
| 425 |
$repeater = new Repeater(); |
| 426 |
|
| 427 |
$social_platforms = new Ehp_Social_Platforms( $this, [ |
| 428 |
'prefix_attr' => 'group_' . $group_number, |
| 429 |
'repeater' => $repeater, |
| 430 |
], $defaults ); |
| 431 |
|
| 432 |
$social_platforms->add_repeater_controls(); |
| 433 |
|
| 434 |
$shared_defaults = [ |
| 435 |
[ |
| 436 |
'group_' . $group_number . '_icon' => [ |
| 437 |
'value' => 'fas fa-phone-alt', |
| 438 |
'library' => 'fa-solid', |
| 439 |
], |
| 440 |
'group_' . $group_number . '_label' => esc_html__( 'Call', 'hello-plus' ), |
| 441 |
'group_' . $group_number . '_platform' => 'telephone', |
| 442 |
], |
| 443 |
[ |
| 444 |
'group_' . $group_number . '_icon' => [ |
| 445 |
'value' => 'fas fa-envelope', |
| 446 |
'library' => 'fa-solid', |
| 447 |
], |
| 448 |
'group_' . $group_number . '_label' => esc_html__( 'Email', 'hello-plus' ), |
| 449 |
'group_' . $group_number . '_platform' => 'email', |
| 450 |
], |
| 451 |
]; |
| 452 |
|
| 453 |
$repeater_defaults = [ |
| 454 |
'1' => $shared_defaults, |
| 455 |
'2' => $shared_defaults, |
| 456 |
'3' => [ |
| 457 |
'group_' . $group_number . '_icon' => [ |
| 458 |
'value' => 'fas fa-map-marker-alt', |
| 459 |
'library' => 'fa-solid', |
| 460 |
], |
| 461 |
'group_' . $group_number . '_label' => esc_html__( 'Visit', 'hello-plus' ), |
| 462 |
'group_' . $group_number . '_platform' => 'telephone', |
| 463 |
], |
| 464 |
'4' => $shared_defaults, |
| 465 |
]; |
| 466 |
|
| 467 |
$this->add_control( |
| 468 |
'group_' . $group_number . '_repeater', |
| 469 |
[ |
| 470 |
'label' => esc_html__( 'Links', 'hello-plus' ), |
| 471 |
'type' => Controls_Manager::REPEATER, |
| 472 |
'fields' => $repeater->get_controls(), |
| 473 |
'prevent_empty' => true, |
| 474 |
'button_text' => esc_html__( 'Add Item', 'hello-plus' ), |
| 475 |
'title_field' => '{{{ group_' . $group_number . '_label }}}', |
| 476 |
'condition' => array_merge( $group_condition, [ |
| 477 |
'group_' . $group_number . '_type' => 'contact-links', |
| 478 |
] ), |
| 479 |
'default' => $repeater_defaults[ $group_number ] ?? [], |
| 480 |
] |
| 481 |
); |
| 482 |
} |
| 483 |
|
| 484 |
protected function add_text_controls( $group_number, $group_condition ) { |
| 485 |
$this->add_control( |
| 486 |
'group_' . $group_number . '_text_subheading', |
| 487 |
[ |
| 488 |
'label' => esc_html__( 'Subheading', 'hello-plus' ), |
| 489 |
'type' => Controls_Manager::TEXT, |
| 490 |
'default' => esc_html__( 'Hours', 'hello-plus' ), |
| 491 |
'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ), |
| 492 |
'dynamic' => [ |
| 493 |
'active' => true, |
| 494 |
], |
| 495 |
'condition' => array_merge( $group_condition, [ |
| 496 |
'group_' . $group_number . '_type' => 'text', |
| 497 |
] ), |
| 498 |
] |
| 499 |
); |
| 500 |
|
| 501 |
$this->add_control( |
| 502 |
'group_' . $group_number . '_text_textarea', |
| 503 |
[ |
| 504 |
'label' => esc_html__( 'Text', 'hello-plus' ), |
| 505 |
'type' => Controls_Manager::TEXTAREA, |
| 506 |
'default' => esc_html__( 'M-F 9am-6pm', 'hello-plus' ), |
| 507 |
'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ), |
| 508 |
'dynamic' => [ |
| 509 |
'active' => true, |
| 510 |
], |
| 511 |
'condition' => array_merge( $group_condition, [ |
| 512 |
'group_' . $group_number . '_type' => 'text', |
| 513 |
] ), |
| 514 |
] |
| 515 |
); |
| 516 |
} |
| 517 |
|
| 518 |
protected function add_social_controls( $group_number, $group_condition ) { |
| 519 |
$this->add_control( |
| 520 |
'group_' . $group_number . '_social_subheading', |
| 521 |
[ |
| 522 |
'label' => esc_html__( 'Subheading', 'hello-plus' ), |
| 523 |
'type' => Controls_Manager::TEXT, |
| 524 |
'default' => esc_html__( 'Follow', 'hello-plus' ), |
| 525 |
'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ), |
| 526 |
'dynamic' => [ |
| 527 |
'active' => true, |
| 528 |
], |
| 529 |
'condition' => array_merge( $group_condition, [ |
| 530 |
'group_' . $group_number . '_type' => 'social-icons', |
| 531 |
] ), |
| 532 |
] |
| 533 |
); |
| 534 |
|
| 535 |
$repeater = new Repeater(); |
| 536 |
|
| 537 |
$repeater->add_control( |
| 538 |
'group_' . $group_number . '_social_label', |
| 539 |
[ |
| 540 |
'label' => esc_html__( 'Accessible Name', 'hello-plus' ), |
| 541 |
'type' => Controls_Manager::TEXT, |
| 542 |
'default' => esc_html__( 'Instagram', 'hello-plus' ), |
| 543 |
'placeholder' => esc_html__( 'Type your text here', 'hello-plus' ), |
| 544 |
'dynamic' => [ |
| 545 |
'active' => true, |
| 546 |
], |
| 547 |
] |
| 548 |
); |
| 549 |
|
| 550 |
$repeater->add_control( |
| 551 |
'group_' . $group_number . '_social_icon', |
| 552 |
[ |
| 553 |
'label' => esc_html__( 'Icon', 'hello-plus' ), |
| 554 |
'type' => Controls_Manager::ICONS, |
| 555 |
'default' => [ |
| 556 |
'value' => 'fab fa-instagram', |
| 557 |
'library' => 'fa-brands', |
| 558 |
], |
| 559 |
] |
| 560 |
); |
| 561 |
|
| 562 |
$repeater->add_control( |
| 563 |
'group_' . $group_number . '_social_link', |
| 564 |
[ |
| 565 |
'label' => esc_html__( 'Link', 'hello-plus' ), |
| 566 |
'type' => Controls_Manager::URL, |
| 567 |
'dynamic' => [ |
| 568 |
'active' => true, |
| 569 |
], |
| 570 |
'autocomplete' => true, |
| 571 |
'label_block' => true, |
| 572 |
'placeholder' => esc_html__( 'Enter your URL', 'hello-plus' ), |
| 573 |
] |
| 574 |
); |
| 575 |
|
| 576 |
$this->add_control( |
| 577 |
'group_' . $group_number . '_social_repeater', |
| 578 |
[ |
| 579 |
'type' => Controls_Manager::REPEATER, |
| 580 |
'fields' => $repeater->get_controls(), |
| 581 |
'prevent_empty' => true, |
| 582 |
'button_text' => esc_html__( 'Add Item', 'hello-plus' ), |
| 583 |
'title_field' => '{{{ group_' . $group_number . '_social_label }}}', |
| 584 |
'condition' => array_merge( $group_condition, [ |
| 585 |
'group_' . $group_number . '_type' => 'social-icons', |
| 586 |
] ), |
| 587 |
'default' => [ |
| 588 |
[ |
| 589 |
'group_' . $group_number . '_social_label' => esc_html__( 'Instagram', 'hello-plus' ), |
| 590 |
'group_' . $group_number . '_social_icon' => [ |
| 591 |
'value' => 'fab fa-instagram', |
| 592 |
'library' => 'fa-brands', |
| 593 |
], |
| 594 |
'group_' . $group_number . '_social_link' => [ |
| 595 |
'url' => 'https://www.instagram.com/', |
| 596 |
], |
| 597 |
], |
| 598 |
[ |
| 599 |
'group_' . $group_number . '_social_label' => esc_html__( 'Tiktok', 'hello-plus' ), |
| 600 |
'group_' . $group_number . '_social_icon' => [ |
| 601 |
'value' => 'fab fa-tiktok', |
| 602 |
'library' => 'fa-brands', |
| 603 |
], |
| 604 |
'group_' . $group_number . '_social_link' => [ |
| 605 |
'url' => 'https://www.tiktok.com/', |
| 606 |
], |
| 607 |
], |
| 608 |
[ |
| 609 |
'group_' . $group_number . '_social_label' => esc_html__( 'X (Twitter)', 'hello-plus' ), |
| 610 |
'group_' . $group_number . '_social_icon' => [ |
| 611 |
'value' => 'fab fa-x-twitter', |
| 612 |
'library' => 'fa-brands', |
| 613 |
], |
| 614 |
'group_' . $group_number . '_social_link' => [ |
| 615 |
'url' => 'https://www.twitter.com/', |
| 616 |
], |
| 617 |
], |
| 618 |
], |
| 619 |
] |
| 620 |
); |
| 621 |
} |
| 622 |
|
| 623 |
protected function add_layout_style_section() { |
| 624 |
$this->start_controls_section( |
| 625 |
'layout_style_section', |
| 626 |
[ |
| 627 |
'label' => esc_html__( 'Layout', 'hello-plus' ), |
| 628 |
'tab' => Controls_Manager::TAB_STYLE, |
| 629 |
] |
| 630 |
); |
| 631 |
|
| 632 |
$ehp_column_structure = new Ehp_Column_Structure( $this, [ |
| 633 |
'condition' => [ |
| 634 |
'layout_preset' => [ |
| 635 |
'locate', |
| 636 |
], |
| 637 |
], |
| 638 |
] ); |
| 639 |
|
| 640 |
$ehp_column_structure->add_style_controls(); |
| 641 |
|
| 642 |
$this->add_responsive_control( |
| 643 |
'map_position_horizontal', |
| 644 |
[ |
| 645 |
'label' => esc_html__( 'Map Position', 'hello-plus' ), |
| 646 |
'type' => Controls_Manager::CHOOSE, |
| 647 |
'options' => [ |
| 648 |
'start' => [ |
| 649 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 650 |
'icon' => 'eicon-h-align-' . ( is_rtl() ? 'right' : 'left' ), |
| 651 |
], |
| 652 |
'end' => [ |
| 653 |
'title' => esc_html__( 'End', 'hello-plus' ), |
| 654 |
'icon' => 'eicon-h-align-' . ( is_rtl() ? 'left' : 'right' ), |
| 655 |
], |
| 656 |
], |
| 657 |
'toggle' => false, |
| 658 |
'frontend_available' => true, |
| 659 |
'default' => 'end', |
| 660 |
'tablet_default' => 'end', |
| 661 |
'mobile_default' => 'end', |
| 662 |
'separator' => 'before', |
| 663 |
'condition' => [ |
| 664 |
'layout_preset' => 'locate', |
| 665 |
], |
| 666 |
] |
| 667 |
); |
| 668 |
|
| 669 |
$this->add_responsive_control( |
| 670 |
'content_alignment_locate', |
| 671 |
[ |
| 672 |
'label' => esc_html__( 'Content Alignment', 'hello-plus' ), |
| 673 |
'type' => Controls_Manager::CHOOSE, |
| 674 |
'options' => [ |
| 675 |
'start' => [ |
| 676 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 677 |
'icon' => 'eicon-align-start-v', |
| 678 |
], |
| 679 |
'center' => [ |
| 680 |
'title' => esc_html__( 'Center', 'hello-plus' ), |
| 681 |
'icon' => 'eicon-align-center-v', |
| 682 |
], |
| 683 |
'end' => [ |
| 684 |
'title' => esc_html__( 'End', 'hello-plus' ), |
| 685 |
'icon' => 'eicon-align-end-v', |
| 686 |
], |
| 687 |
], |
| 688 |
'toggle' => false, |
| 689 |
'default' => 'start', |
| 690 |
'tablet_default' => 'start', |
| 691 |
'mobile_default' => 'start', |
| 692 |
'selectors' => [ |
| 693 |
'{{WRAPPER}} .ehp-contact' => '--contact-content-position: {{VALUE}};', |
| 694 |
], |
| 695 |
'condition' => [ |
| 696 |
'layout_preset' => 'locate', |
| 697 |
], |
| 698 |
] |
| 699 |
); |
| 700 |
|
| 701 |
$this->add_responsive_control( |
| 702 |
'content_position', |
| 703 |
[ |
| 704 |
'label' => esc_html__( 'Content Position', 'hello-plus' ), |
| 705 |
'type' => Controls_Manager::CHOOSE, |
| 706 |
'options' => [ |
| 707 |
'start' => [ |
| 708 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 709 |
'icon' => 'eicon-align-' . ( is_rtl() ? 'end' : 'start' ) . '-h', |
| 710 |
], |
| 711 |
'center' => [ |
| 712 |
'title' => esc_html__( 'Center', 'hello-plus' ), |
| 713 |
'icon' => 'eicon-align-center-h', |
| 714 |
], |
| 715 |
], |
| 716 |
'toggle' => false, |
| 717 |
'default' => 'center', |
| 718 |
'tablet_default' => 'center', |
| 719 |
'mobile_default' => 'center', |
| 720 |
'selectors' => [ |
| 721 |
'{{WRAPPER}} .ehp-contact' => '--contact-content-position: {{VALUE}};', |
| 722 |
], |
| 723 |
'condition' => [ |
| 724 |
'layout_preset' => [ |
| 725 |
'touchpoint', |
| 726 |
'quick-info', |
| 727 |
], |
| 728 |
], |
| 729 |
] |
| 730 |
); |
| 731 |
|
| 732 |
$this->add_responsive_control( |
| 733 |
'content_alignment_reduced', |
| 734 |
[ |
| 735 |
'label' => esc_html__( 'Content Alignment', 'hello-plus' ), |
| 736 |
'type' => Controls_Manager::CHOOSE, |
| 737 |
'options' => [ |
| 738 |
'start' => [ |
| 739 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 740 |
'icon' => 'eicon-align-' . ( is_rtl() ? 'end' : 'start' ) . '-h', |
| 741 |
], |
| 742 |
'center' => [ |
| 743 |
'title' => esc_html__( 'Center', 'hello-plus' ), |
| 744 |
'icon' => 'eicon-align-center-h', |
| 745 |
], |
| 746 |
], |
| 747 |
'toggle' => false, |
| 748 |
'default' => 'start', |
| 749 |
'tablet_default' => 'start', |
| 750 |
'mobile_default' => 'start', |
| 751 |
'selectors' => [ |
| 752 |
'{{WRAPPER}} .ehp-contact' => '--contact-content-alignment: {{VALUE}}; --contact-content-alignment-width: var(--contact-alignment-width-{{VALUE}}); --contact-content-alignment-margin: var(--contact-alignment-margin-{{VALUE}});', |
| 753 |
], |
| 754 |
'conditions' => [ |
| 755 |
'relation' => 'or', |
| 756 |
'terms' => [ |
| 757 |
[ |
| 758 |
'name' => 'layout_preset', |
| 759 |
'operator' => '===', |
| 760 |
'value' => 'quick-info', |
| 761 |
], |
| 762 |
[ |
| 763 |
'relation' => 'and', |
| 764 |
'terms' => [ |
| 765 |
[ |
| 766 |
'name' => 'layout_preset', |
| 767 |
'operator' => '===', |
| 768 |
'value' => 'touchpoint', |
| 769 |
], |
| 770 |
[ |
| 771 |
'name' => 'content_position', |
| 772 |
'operator' => '===', |
| 773 |
'value' => 'center', |
| 774 |
], |
| 775 |
], |
| 776 |
], |
| 777 |
], |
| 778 |
], |
| 779 |
] |
| 780 |
); |
| 781 |
|
| 782 |
$this->add_responsive_control( |
| 783 |
'content_width', |
| 784 |
[ |
| 785 |
'label' => esc_html__( 'Content Width', 'hello-plus' ), |
| 786 |
'type' => Controls_Manager::SLIDER, |
| 787 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 788 |
'range' => [ |
| 789 |
'px' => [ |
| 790 |
'max' => 1200, |
| 791 |
], |
| 792 |
'%' => [ |
| 793 |
'max' => 100, |
| 794 |
], |
| 795 |
], |
| 796 |
'default' => [ |
| 797 |
'size' => 800, |
| 798 |
'unit' => 'px', |
| 799 |
], |
| 800 |
'selectors' => [ |
| 801 |
'{{WRAPPER}} .ehp-contact' => '--contact-content-width: {{SIZE}}{{UNIT}};', |
| 802 |
], |
| 803 |
'condition' => [ |
| 804 |
'layout_preset' => [ |
| 805 |
'quick-info', |
| 806 |
'touchpoint', |
| 807 |
], |
| 808 |
], |
| 809 |
] |
| 810 |
); |
| 811 |
|
| 812 |
$this->add_control( |
| 813 |
'contact_details_heading', |
| 814 |
[ |
| 815 |
'label' => esc_html__( 'Contact Details', 'hello-plus' ), |
| 816 |
'type' => Controls_Manager::HEADING, |
| 817 |
'separator' => 'before', |
| 818 |
'condition' => [ |
| 819 |
'layout_preset' => [ 'locate', 'touchpoint' ], |
| 820 |
], |
| 821 |
] |
| 822 |
); |
| 823 |
|
| 824 |
$this->add_responsive_control( |
| 825 |
'contact_details_columns_locate', |
| 826 |
[ |
| 827 |
'label' => esc_html__( 'Columns', 'hello-plus' ), |
| 828 |
'type' => Controls_Manager::SELECT, |
| 829 |
'options' => [ |
| 830 |
'1' => esc_html__( '1', 'hello-plus' ), |
| 831 |
'2' => esc_html__( '2', 'hello-plus' ), |
| 832 |
'3' => esc_html__( '3', 'hello-plus' ), |
| 833 |
'4' => esc_html__( '4', 'hello-plus' ), |
| 834 |
], |
| 835 |
'default' => '1', |
| 836 |
'tablet_default' => '1', |
| 837 |
'mobile_default' => '1', |
| 838 |
'selectors' => [ |
| 839 |
'{{WRAPPER}} .ehp-contact' => '--contact-layout-columns: {{VALUE}};', |
| 840 |
], |
| 841 |
'condition' => [ |
| 842 |
'layout_preset' => 'locate', |
| 843 |
], |
| 844 |
] |
| 845 |
); |
| 846 |
|
| 847 |
$this->add_responsive_control( |
| 848 |
'contact_details_columns_alt', |
| 849 |
[ |
| 850 |
'label' => esc_html__( 'Columns', 'hello-plus' ), |
| 851 |
'type' => Controls_Manager::SELECT, |
| 852 |
'options' => [ |
| 853 |
'1' => esc_html__( '1', 'hello-plus' ), |
| 854 |
'2' => esc_html__( '2', 'hello-plus' ), |
| 855 |
'3' => esc_html__( '3', 'hello-plus' ), |
| 856 |
'4' => esc_html__( '4', 'hello-plus' ), |
| 857 |
], |
| 858 |
'default' => '2', |
| 859 |
'tablet_default' => '2', |
| 860 |
'mobile_default' => '1', |
| 861 |
'selectors' => [ |
| 862 |
'{{WRAPPER}} .ehp-contact' => '--contact-layout-columns: {{VALUE}};', |
| 863 |
], |
| 864 |
'condition' => [ |
| 865 |
'layout_preset' => [ 'touchpoint', 'quick-info' ], |
| 866 |
], |
| 867 |
] |
| 868 |
); |
| 869 |
|
| 870 |
$this->add_responsive_control( |
| 871 |
'space_between_widgets', |
| 872 |
[ |
| 873 |
'label' => esc_html__( 'Gaps', 'hello-plus' ), |
| 874 |
'type' => Controls_Manager::GAPS, |
| 875 |
'default' => [ |
| 876 |
'row' => '20', |
| 877 |
'column' => '20', |
| 878 |
'unit' => 'px', |
| 879 |
], |
| 880 |
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], |
| 881 |
'selectors' => [ |
| 882 |
'{{WRAPPER}} .ehp-contact' => '--contact-layout-columns-row-gap: {{ROW}}{{UNIT}};--contact-layout-columns-column-gap: {{COLUMN}}{{UNIT}};', |
| 883 |
], |
| 884 |
'validators' => [ |
| 885 |
'Number' => [ |
| 886 |
'min' => 0, |
| 887 |
], |
| 888 |
], |
| 889 |
] |
| 890 |
); |
| 891 |
|
| 892 |
$this->add_responsive_control( |
| 893 |
'map_position_vertical', |
| 894 |
[ |
| 895 |
'label' => esc_html__( 'Map Position', 'hello-plus' ), |
| 896 |
'type' => Controls_Manager::CHOOSE, |
| 897 |
'options' => [ |
| 898 |
'start' => [ |
| 899 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 900 |
'icon' => 'eicon-align-start-v', |
| 901 |
], |
| 902 |
'end' => [ |
| 903 |
'title' => esc_html__( 'End', 'hello-plus' ), |
| 904 |
'icon' => 'eicon-align-end-v', |
| 905 |
], |
| 906 |
], |
| 907 |
'toggle' => false, |
| 908 |
'frontend_available' => true, |
| 909 |
'default' => 'end', |
| 910 |
'tablet_default' => 'end', |
| 911 |
'mobile_default' => 'end', |
| 912 |
'condition' => [ |
| 913 |
'layout_preset' => 'touchpoint', |
| 914 |
], |
| 915 |
] |
| 916 |
); |
| 917 |
|
| 918 |
$this->end_controls_section(); |
| 919 |
} |
| 920 |
|
| 921 |
protected function add_text_style_section() { |
| 922 |
$this->start_controls_section( |
| 923 |
'text_style_section', |
| 924 |
[ |
| 925 |
'label' => esc_html__( 'Text', 'hello-plus' ), |
| 926 |
'tab' => Controls_Manager::TAB_STYLE, |
| 927 |
] |
| 928 |
); |
| 929 |
|
| 930 |
$this->add_control( |
| 931 |
'heading_label', |
| 932 |
[ |
| 933 |
'label' => esc_html__( 'Heading', 'hello-plus' ), |
| 934 |
'type' => Controls_Manager::HEADING, |
| 935 |
'separator' => 'before', |
| 936 |
] |
| 937 |
); |
| 938 |
|
| 939 |
$this->add_control( |
| 940 |
'heading_color', |
| 941 |
[ |
| 942 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 943 |
'type' => Controls_Manager::COLOR, |
| 944 |
'global' => [ |
| 945 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 946 |
], |
| 947 |
'selectors' => [ |
| 948 |
'{{WRAPPER}} .ehp-contact .ehp-contact__heading' => 'color: {{VALUE}};', |
| 949 |
], |
| 950 |
] |
| 951 |
); |
| 952 |
|
| 953 |
$this->add_group_control( |
| 954 |
Group_Control_Typography::get_type(), |
| 955 |
[ |
| 956 |
'name' => 'heading_typography', |
| 957 |
'selector' => '{{WRAPPER}} .ehp-contact__heading', |
| 958 |
'global' => [ |
| 959 |
'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 960 |
], |
| 961 |
] |
| 962 |
); |
| 963 |
|
| 964 |
$this->add_control( |
| 965 |
'description_label', |
| 966 |
[ |
| 967 |
'label' => esc_html__( 'Description', 'hello-plus' ), |
| 968 |
'type' => Controls_Manager::HEADING, |
| 969 |
'separator' => 'before', |
| 970 |
] |
| 971 |
); |
| 972 |
|
| 973 |
$this->add_control( |
| 974 |
'description_color', |
| 975 |
[ |
| 976 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 977 |
'type' => Controls_Manager::COLOR, |
| 978 |
'global' => [ |
| 979 |
'default' => Global_Colors::COLOR_TEXT, |
| 980 |
], |
| 981 |
'selectors' => [ |
| 982 |
'{{WRAPPER}} .ehp-contact' => '--contact-text-description-color: {{VALUE}}', |
| 983 |
], |
| 984 |
] |
| 985 |
); |
| 986 |
|
| 987 |
$this->add_group_control( |
| 988 |
Group_Control_Typography::get_type(), |
| 989 |
[ |
| 990 |
'name' => 'description_typography', |
| 991 |
'selector' => '{{WRAPPER}} .ehp-contact__description', |
| 992 |
'global' => [ |
| 993 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 994 |
], |
| 995 |
] |
| 996 |
); |
| 997 |
|
| 998 |
$this->add_responsive_control( |
| 999 |
'text_spacing', |
| 1000 |
[ |
| 1001 |
'label' => esc_html__( 'Spacing', 'hello-plus' ), |
| 1002 |
'type' => Controls_Manager::SLIDER, |
| 1003 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1004 |
'range' => [ |
| 1005 |
'px' => [ |
| 1006 |
'max' => 100, |
| 1007 |
], |
| 1008 |
'%' => [ |
| 1009 |
'max' => 100, |
| 1010 |
], |
| 1011 |
], |
| 1012 |
'default' => [ |
| 1013 |
'size' => 32, |
| 1014 |
'unit' => 'px', |
| 1015 |
], |
| 1016 |
'selectors' => [ |
| 1017 |
'{{WRAPPER}} .ehp-contact' => '--contact-text-spacing: {{SIZE}}{{UNIT}};', |
| 1018 |
], |
| 1019 |
'separator' => 'before', |
| 1020 |
] |
| 1021 |
); |
| 1022 |
|
| 1023 |
$this->end_controls_section(); |
| 1024 |
} |
| 1025 |
|
| 1026 |
protected function add_contact_details_style_section() { |
| 1027 |
$this->start_controls_section( |
| 1028 |
'contact_details_style_section', |
| 1029 |
[ |
| 1030 |
'label' => esc_html__( 'Contact Details', 'hello-plus' ), |
| 1031 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1032 |
] |
| 1033 |
); |
| 1034 |
|
| 1035 |
$this->add_control( |
| 1036 |
'contact_details_subheading_label', |
| 1037 |
[ |
| 1038 |
'label' => esc_html__( 'Subheading', 'hello-plus' ), |
| 1039 |
'type' => Controls_Manager::HEADING, |
| 1040 |
'separator' => 'before', |
| 1041 |
] |
| 1042 |
); |
| 1043 |
|
| 1044 |
$this->add_control( |
| 1045 |
'contact_details_subheading_color', |
| 1046 |
[ |
| 1047 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1048 |
'type' => Controls_Manager::COLOR, |
| 1049 |
'global' => [ |
| 1050 |
'default' => Global_Colors::COLOR_SECONDARY, |
| 1051 |
], |
| 1052 |
'selectors' => [ |
| 1053 |
'{{WRAPPER}} .ehp-contact .ehp-contact__groups .ehp-contact__subheading' => 'color: {{VALUE}};', |
| 1054 |
], |
| 1055 |
] |
| 1056 |
); |
| 1057 |
|
| 1058 |
$this->add_group_control( |
| 1059 |
Group_Control_Typography::get_type(), |
| 1060 |
[ |
| 1061 |
'name' => 'contact_details_subheading_typography', |
| 1062 |
'selector' => '{{WRAPPER}} .ehp-contact__subheading', |
| 1063 |
'global' => [ |
| 1064 |
'default' => Global_Typography::TYPOGRAPHY_SECONDARY, |
| 1065 |
], |
| 1066 |
] |
| 1067 |
); |
| 1068 |
|
| 1069 |
$this->add_responsive_control( |
| 1070 |
'contact_details_text_spacing', |
| 1071 |
[ |
| 1072 |
'label' => esc_html__( 'Spacing', 'hello-plus' ), |
| 1073 |
'type' => Controls_Manager::SLIDER, |
| 1074 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1075 |
'range' => [ |
| 1076 |
'px' => [ |
| 1077 |
'max' => 100, |
| 1078 |
], |
| 1079 |
'%' => [ |
| 1080 |
'max' => 100, |
| 1081 |
], |
| 1082 |
], |
| 1083 |
'default' => [ |
| 1084 |
'size' => 8, |
| 1085 |
'unit' => 'px', |
| 1086 |
], |
| 1087 |
'selectors' => [ |
| 1088 |
'{{WRAPPER}} .ehp-contact' => '--contact-group-spacing: {{SIZE}}{{UNIT}};', |
| 1089 |
], |
| 1090 |
] |
| 1091 |
); |
| 1092 |
|
| 1093 |
$this->add_control( |
| 1094 |
'style_contact_details_heading', |
| 1095 |
[ |
| 1096 |
'label' => esc_html__( 'Contact Links', 'hello-plus' ), |
| 1097 |
'type' => Controls_Manager::HEADING, |
| 1098 |
'separator' => 'before', |
| 1099 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1100 |
] |
| 1101 |
); |
| 1102 |
|
| 1103 |
$this->add_responsive_control( |
| 1104 |
'contact_details_spacing', |
| 1105 |
[ |
| 1106 |
'label' => esc_html__( 'Spacing', 'hello-plus' ), |
| 1107 |
'type' => Controls_Manager::SLIDER, |
| 1108 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1109 |
'range' => [ |
| 1110 |
'px' => [ |
| 1111 |
'max' => 100, |
| 1112 |
], |
| 1113 |
'%' => [ |
| 1114 |
'max' => 100, |
| 1115 |
], |
| 1116 |
], |
| 1117 |
'default' => [ |
| 1118 |
'size' => 4, |
| 1119 |
'unit' => 'px', |
| 1120 |
], |
| 1121 |
'selectors' => [ |
| 1122 |
'{{WRAPPER}} .ehp-contact' => '--contact-links-spacing: {{SIZE}}{{UNIT}};', |
| 1123 |
], |
| 1124 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1125 |
] |
| 1126 |
); |
| 1127 |
|
| 1128 |
$this->add_group_control( |
| 1129 |
Group_Control_Typography::get_type(), |
| 1130 |
[ |
| 1131 |
'name' => 'contact_details_typography', |
| 1132 |
'selector' => '{{WRAPPER}} .ehp-contact__contact-link', |
| 1133 |
'global' => [ |
| 1134 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 1135 |
], |
| 1136 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1137 |
] |
| 1138 |
); |
| 1139 |
|
| 1140 |
$this->start_controls_tabs( 'contact_details_tabs' ); |
| 1141 |
|
| 1142 |
$this->start_controls_tab( |
| 1143 |
'contact_details_normal_tab', |
| 1144 |
[ |
| 1145 |
'label' => esc_html__( 'Normal', 'hello-plus' ), |
| 1146 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1147 |
] |
| 1148 |
); |
| 1149 |
|
| 1150 |
$this->add_control( |
| 1151 |
'contact_details_icon_color', |
| 1152 |
[ |
| 1153 |
'label' => esc_html__( 'Icon Color', 'hello-plus' ), |
| 1154 |
'type' => Controls_Manager::COLOR, |
| 1155 |
'global' => [ |
| 1156 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 1157 |
], |
| 1158 |
'selectors' => [ |
| 1159 |
'{{WRAPPER}} .ehp-contact' => '--contact-link-icon-color: {{VALUE}}', |
| 1160 |
], |
| 1161 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1162 |
] |
| 1163 |
); |
| 1164 |
|
| 1165 |
$this->add_control( |
| 1166 |
'contact_details_text_text_color', |
| 1167 |
[ |
| 1168 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1169 |
'type' => Controls_Manager::COLOR, |
| 1170 |
'global' => [ |
| 1171 |
'default' => Global_Colors::COLOR_TEXT, |
| 1172 |
], |
| 1173 |
'selectors' => [ |
| 1174 |
'{{WRAPPER}} .ehp-contact' => '--contact-link-label-color: {{VALUE}}', |
| 1175 |
], |
| 1176 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1177 |
] |
| 1178 |
); |
| 1179 |
|
| 1180 |
$this->end_controls_tab(); |
| 1181 |
|
| 1182 |
$this->start_controls_tab( |
| 1183 |
'contact_details_hover_tab', |
| 1184 |
[ |
| 1185 |
'label' => esc_html__( 'Hover', 'hello-plus' ), |
| 1186 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1187 |
] |
| 1188 |
); |
| 1189 |
|
| 1190 |
$this->add_control( |
| 1191 |
'contact_details_icon_hover_color', |
| 1192 |
[ |
| 1193 |
'label' => esc_html__( 'Icon Color', 'hello-plus' ), |
| 1194 |
'type' => Controls_Manager::COLOR, |
| 1195 |
'global' => [ |
| 1196 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 1197 |
], |
| 1198 |
'selectors' => [ |
| 1199 |
'{{WRAPPER}} .ehp-contact' => '--contact-link-icon-hover-color: {{VALUE}}', |
| 1200 |
], |
| 1201 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1202 |
] |
| 1203 |
); |
| 1204 |
|
| 1205 |
$this->add_control( |
| 1206 |
'contact_details_text_hover_color', |
| 1207 |
[ |
| 1208 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1209 |
'type' => Controls_Manager::COLOR, |
| 1210 |
'global' => [ |
| 1211 |
'default' => Global_Colors::COLOR_TEXT, |
| 1212 |
], |
| 1213 |
'selectors' => [ |
| 1214 |
'{{WRAPPER}} .ehp-contact' => '--contact-link-label-hover-color: {{VALUE}}', |
| 1215 |
], |
| 1216 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1217 |
] |
| 1218 |
); |
| 1219 |
|
| 1220 |
$this->add_control( |
| 1221 |
'contact_details_text_hover_animation', |
| 1222 |
[ |
| 1223 |
'label' => esc_html__( 'Hover Animation', 'hello-plus' ), |
| 1224 |
'type' => Controls_Manager::HOVER_ANIMATION, |
| 1225 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1226 |
] |
| 1227 |
); |
| 1228 |
|
| 1229 |
$this->end_controls_tab(); |
| 1230 |
|
| 1231 |
$this->end_controls_tabs(); |
| 1232 |
|
| 1233 |
$this->add_responsive_control( |
| 1234 |
'contact_details_icon_size', |
| 1235 |
[ |
| 1236 |
'label' => esc_html__( 'Icon Size', 'hello-plus' ), |
| 1237 |
'type' => Controls_Manager::SLIDER, |
| 1238 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1239 |
'range' => [ |
| 1240 |
'px' => [ |
| 1241 |
'min' => 0, |
| 1242 |
'max' => 100, |
| 1243 |
], |
| 1244 |
], |
| 1245 |
'default' => [ |
| 1246 |
'size' => 16, |
| 1247 |
'unit' => 'px', |
| 1248 |
], |
| 1249 |
'selectors' => [ |
| 1250 |
'{{WRAPPER}} .ehp-contact' => '--contact-link-icon-size: {{SIZE}}{{UNIT}}', |
| 1251 |
], |
| 1252 |
'separator' => 'before', |
| 1253 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1254 |
] |
| 1255 |
); |
| 1256 |
|
| 1257 |
$this->add_responsive_control( |
| 1258 |
'contact_details_icon_gap', |
| 1259 |
[ |
| 1260 |
'label' => esc_html__( 'Icon Gap', 'hello-plus' ), |
| 1261 |
'type' => Controls_Manager::SLIDER, |
| 1262 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1263 |
'range' => [ |
| 1264 |
'px' => [ |
| 1265 |
'min' => 0, |
| 1266 |
'max' => 50, |
| 1267 |
], |
| 1268 |
], |
| 1269 |
'default' => [ |
| 1270 |
'size' => 8, |
| 1271 |
'unit' => 'px', |
| 1272 |
], |
| 1273 |
'selectors' => [ |
| 1274 |
'{{WRAPPER}} .ehp-contact' => '--contact-link-icon-gap: {{SIZE}}{{UNIT}}', |
| 1275 |
], |
| 1276 |
'conditions' => $this->get_conditions_by_type_value( 'contact-links' ), |
| 1277 |
] |
| 1278 |
); |
| 1279 |
|
| 1280 |
$this->add_control( |
| 1281 |
'contact_details_text_heading', |
| 1282 |
[ |
| 1283 |
'label' => esc_html__( 'Text', 'hello-plus' ), |
| 1284 |
'type' => Controls_Manager::HEADING, |
| 1285 |
'separator' => 'before', |
| 1286 |
'conditions' => $this->get_conditions_by_type_value( 'text' ), |
| 1287 |
] |
| 1288 |
); |
| 1289 |
|
| 1290 |
$this->add_group_control( |
| 1291 |
Group_Control_Typography::get_type(), |
| 1292 |
[ |
| 1293 |
'name' => 'contact_details_text_typography', |
| 1294 |
'selector' => '{{WRAPPER}} .ehp-contact__contact-text', |
| 1295 |
'global' => [ |
| 1296 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 1297 |
], |
| 1298 |
'conditions' => $this->get_conditions_by_type_value( 'text' ), |
| 1299 |
] |
| 1300 |
); |
| 1301 |
|
| 1302 |
$this->add_control( |
| 1303 |
'contact_details_text_color', |
| 1304 |
[ |
| 1305 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1306 |
'type' => Controls_Manager::COLOR, |
| 1307 |
'global' => [ |
| 1308 |
'default' => Global_Colors::COLOR_TEXT, |
| 1309 |
], |
| 1310 |
'selectors' => [ |
| 1311 |
'{{WRAPPER}} .ehp-contact' => '--contact-contact-text-color: {{VALUE}}', |
| 1312 |
], |
| 1313 |
'conditions' => $this->get_conditions_by_type_value( 'text' ), |
| 1314 |
] |
| 1315 |
); |
| 1316 |
|
| 1317 |
$this->add_control( |
| 1318 |
'contact_details_social_heading', |
| 1319 |
[ |
| 1320 |
'label' => esc_html__( 'Social Icons', 'hello-plus' ), |
| 1321 |
'type' => Controls_Manager::HEADING, |
| 1322 |
'separator' => 'before', |
| 1323 |
'conditions' => $this->get_conditions_by_type_value( 'social-icons' ), |
| 1324 |
] |
| 1325 |
); |
| 1326 |
|
| 1327 |
$this->start_controls_tabs( 'contact_details_social_tabs' ); |
| 1328 |
|
| 1329 |
$this->start_controls_tab( |
| 1330 |
'contact_details_social_normal_tab', |
| 1331 |
[ |
| 1332 |
'label' => esc_html__( 'Normal', 'hello-plus' ), |
| 1333 |
'conditions' => $this->get_conditions_by_type_value( 'social-icons' ), |
| 1334 |
] |
| 1335 |
); |
| 1336 |
|
| 1337 |
$this->add_control( |
| 1338 |
'contact_details_social_icon_color', |
| 1339 |
[ |
| 1340 |
'label' => esc_html__( 'Icon Color', 'hello-plus' ), |
| 1341 |
'type' => Controls_Manager::COLOR, |
| 1342 |
'global' => [ |
| 1343 |
'default' => Global_Colors::COLOR_SECONDARY, |
| 1344 |
], |
| 1345 |
'selectors' => [ |
| 1346 |
'{{WRAPPER}} .ehp-contact' => '--contact-social-icon-color: {{VALUE}}', |
| 1347 |
], |
| 1348 |
'conditions' => $this->get_conditions_by_type_value( 'social-icons' ), |
| 1349 |
] |
| 1350 |
); |
| 1351 |
|
| 1352 |
$this->end_controls_tab(); |
| 1353 |
|
| 1354 |
$this->start_controls_tab( |
| 1355 |
'contact_details_social_hover_tab', |
| 1356 |
[ |
| 1357 |
'label' => esc_html__( 'Hover', 'hello-plus' ), |
| 1358 |
'conditions' => $this->get_conditions_by_type_value( 'social-icons' ), |
| 1359 |
] |
| 1360 |
); |
| 1361 |
|
| 1362 |
$this->add_control( |
| 1363 |
'contact_details_social_icon_hover_color', |
| 1364 |
[ |
| 1365 |
'label' => esc_html__( 'Icon Color', 'hello-plus' ), |
| 1366 |
'type' => Controls_Manager::COLOR, |
| 1367 |
'global' => [ |
| 1368 |
'default' => Global_Colors::COLOR_SECONDARY, |
| 1369 |
], |
| 1370 |
'selectors' => [ |
| 1371 |
'{{WRAPPER}} .ehp-contact' => '--contact-social-icon-hover-color: {{VALUE}}', |
| 1372 |
], |
| 1373 |
'conditions' => $this->get_conditions_by_type_value( 'social-icons' ), |
| 1374 |
] |
| 1375 |
); |
| 1376 |
|
| 1377 |
$this->add_control( |
| 1378 |
'contact_details_social_icon_hover_animation', |
| 1379 |
[ |
| 1380 |
'label' => esc_html__( 'Hover Animation', 'hello-plus' ), |
| 1381 |
'type' => Controls_Manager::HOVER_ANIMATION, |
| 1382 |
'conditions' => $this->get_conditions_by_type_value( 'social-icons' ), |
| 1383 |
] |
| 1384 |
); |
| 1385 |
|
| 1386 |
$this->end_controls_tab(); |
| 1387 |
|
| 1388 |
$this->end_controls_tabs(); |
| 1389 |
|
| 1390 |
$this->add_responsive_control( |
| 1391 |
'contact_details_social_icon_size', |
| 1392 |
[ |
| 1393 |
'label' => esc_html__( 'Icon Size', 'hello-plus' ), |
| 1394 |
'type' => Controls_Manager::SLIDER, |
| 1395 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1396 |
'range' => [ |
| 1397 |
'px' => [ |
| 1398 |
'min' => 0, |
| 1399 |
'max' => 100, |
| 1400 |
], |
| 1401 |
], |
| 1402 |
'default' => [ |
| 1403 |
'size' => 16, |
| 1404 |
'unit' => 'px', |
| 1405 |
], |
| 1406 |
'selectors' => [ |
| 1407 |
'{{WRAPPER}} .ehp-contact' => '--contact-social-icon-size: {{SIZE}}{{UNIT}}', |
| 1408 |
], |
| 1409 |
'conditions' => $this->get_conditions_by_type_value( 'social-icons' ), |
| 1410 |
'separator' => 'before', |
| 1411 |
] |
| 1412 |
); |
| 1413 |
|
| 1414 |
$this->add_responsive_control( |
| 1415 |
'contact_details_social_icon_gap', |
| 1416 |
[ |
| 1417 |
'label' => esc_html__( 'Icon Gap', 'hello-plus' ), |
| 1418 |
'type' => Controls_Manager::SLIDER, |
| 1419 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1420 |
'range' => [ |
| 1421 |
'px' => [ |
| 1422 |
'min' => 0, |
| 1423 |
'max' => 100, |
| 1424 |
], |
| 1425 |
], |
| 1426 |
'default' => [ |
| 1427 |
'size' => 8, |
| 1428 |
'unit' => 'px', |
| 1429 |
], |
| 1430 |
'selectors' => [ |
| 1431 |
'{{WRAPPER}} .ehp-contact' => '--contact-social-icon-gap: {{SIZE}}{{UNIT}}', |
| 1432 |
], |
| 1433 |
'conditions' => $this->get_conditions_by_type_value( 'social-icons' ), |
| 1434 |
] |
| 1435 |
); |
| 1436 |
|
| 1437 |
$this->end_controls_section(); |
| 1438 |
} |
| 1439 |
|
| 1440 |
protected function get_conditions_by_type_value( $type_value ): array { |
| 1441 |
return [ |
| 1442 |
'relation' => 'or', |
| 1443 |
'terms' => [ |
| 1444 |
[ |
| 1445 |
'name' => 'group_1_type', |
| 1446 |
'operator' => '===', |
| 1447 |
'value' => $type_value, |
| 1448 |
], |
| 1449 |
[ |
| 1450 |
'relation' => 'and', |
| 1451 |
'terms' => [ |
| 1452 |
[ |
| 1453 |
'name' => 'group_2_type', |
| 1454 |
'operator' => '===', |
| 1455 |
'value' => $type_value, |
| 1456 |
], |
| 1457 |
[ |
| 1458 |
'name' => 'group_2_switcher', |
| 1459 |
'operator' => '===', |
| 1460 |
'value' => 'yes', |
| 1461 |
], |
| 1462 |
], |
| 1463 |
], |
| 1464 |
[ |
| 1465 |
'relation' => 'and', |
| 1466 |
'terms' => [ |
| 1467 |
[ |
| 1468 |
'name' => 'group_3_type', |
| 1469 |
'operator' => '===', |
| 1470 |
'value' => $type_value, |
| 1471 |
], |
| 1472 |
[ |
| 1473 |
'name' => 'group_3_switcher', |
| 1474 |
'operator' => '===', |
| 1475 |
'value' => 'yes', |
| 1476 |
], |
| 1477 |
], |
| 1478 |
], |
| 1479 |
[ |
| 1480 |
'relation' => 'and', |
| 1481 |
'terms' => [ |
| 1482 |
[ |
| 1483 |
'name' => 'group_4_type', |
| 1484 |
'operator' => '===', |
| 1485 |
'value' => $type_value, |
| 1486 |
], |
| 1487 |
[ |
| 1488 |
'name' => 'group_4_switcher', |
| 1489 |
'operator' => '===', |
| 1490 |
'value' => 'yes', |
| 1491 |
], |
| 1492 |
], |
| 1493 |
], |
| 1494 |
], |
| 1495 |
]; |
| 1496 |
} |
| 1497 |
|
| 1498 |
protected function add_map_style_section() { |
| 1499 |
$this->start_controls_section( |
| 1500 |
'map_style_section', |
| 1501 |
[ |
| 1502 |
'label' => esc_html__( 'Map', 'hello-plus' ), |
| 1503 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1504 |
'condition' => [ |
| 1505 |
'layout_preset!' => 'quick-info', |
| 1506 |
], |
| 1507 |
] |
| 1508 |
); |
| 1509 |
|
| 1510 |
$this->add_control( |
| 1511 |
'map_zoom', |
| 1512 |
[ |
| 1513 |
'label' => esc_html__( 'Zoom', 'hello-plus' ), |
| 1514 |
'type' => Controls_Manager::SLIDER, |
| 1515 |
'default' => [ |
| 1516 |
'size' => 10, |
| 1517 |
], |
| 1518 |
'range' => [ |
| 1519 |
'px' => [ |
| 1520 |
'min' => 1, |
| 1521 |
'max' => 20, |
| 1522 |
], |
| 1523 |
], |
| 1524 |
'separator' => 'before', |
| 1525 |
] |
| 1526 |
); |
| 1527 |
|
| 1528 |
$this->add_control( |
| 1529 |
'map_stretch', |
| 1530 |
[ |
| 1531 |
'label' => esc_html__( 'Stretch', 'hello-plus' ), |
| 1532 |
'type' => Controls_Manager::SWITCHER, |
| 1533 |
'label_on' => esc_html__( 'Yes', 'hello-plus' ), |
| 1534 |
'label_off' => esc_html__( 'No', 'hello-plus' ), |
| 1535 |
'return_value' => 'yes', |
| 1536 |
'default' => 'no', |
| 1537 |
] |
| 1538 |
); |
| 1539 |
|
| 1540 |
$this->add_responsive_control( |
| 1541 |
'map_width', |
| 1542 |
[ |
| 1543 |
'label' => esc_html__( 'Width', 'hello-plus' ), |
| 1544 |
'type' => Controls_Manager::SLIDER, |
| 1545 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 1546 |
'default' => [ |
| 1547 |
'size' => 100, |
| 1548 |
'unit' => '%', |
| 1549 |
], |
| 1550 |
'range' => [ |
| 1551 |
'%' => [ |
| 1552 |
'max' => 100, |
| 1553 |
], |
| 1554 |
], |
| 1555 |
'selectors' => [ |
| 1556 |
'{{WRAPPER}} .ehp-contact' => '--contact-map-width: {{SIZE}}{{UNIT}};', |
| 1557 |
], |
| 1558 |
] |
| 1559 |
); |
| 1560 |
|
| 1561 |
$this->add_responsive_control( |
| 1562 |
'map_height', |
| 1563 |
[ |
| 1564 |
'label' => esc_html__( 'Height', 'hello-plus' ), |
| 1565 |
'type' => Controls_Manager::SLIDER, |
| 1566 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 1567 |
'default' => [ |
| 1568 |
'size' => 540, |
| 1569 |
'unit' => 'px', |
| 1570 |
], |
| 1571 |
'range' => [ |
| 1572 |
'px' => [ |
| 1573 |
'min' => 40, |
| 1574 |
'max' => 1440, |
| 1575 |
], |
| 1576 |
], |
| 1577 |
'selectors' => [ |
| 1578 |
'{{WRAPPER}} .ehp-contact' => '--contact-map-height: {{SIZE}}{{UNIT}};', |
| 1579 |
], |
| 1580 |
] |
| 1581 |
); |
| 1582 |
|
| 1583 |
$this->start_controls_tabs( 'map_filters_tabs' ); |
| 1584 |
|
| 1585 |
$this->start_controls_tab( |
| 1586 |
'map_filters_normal_tab', |
| 1587 |
[ |
| 1588 |
'label' => esc_html__( 'Normal', 'hello-plus' ), |
| 1589 |
] |
| 1590 |
); |
| 1591 |
|
| 1592 |
$this->add_group_control( |
| 1593 |
Group_Control_Css_Filter::get_type(), |
| 1594 |
[ |
| 1595 |
'name' => 'map_css_filters', |
| 1596 |
'selector' => '{{WRAPPER}} .ehp-contact__map', |
| 1597 |
] |
| 1598 |
); |
| 1599 |
|
| 1600 |
$this->end_controls_tab(); |
| 1601 |
|
| 1602 |
$this->start_controls_tab( |
| 1603 |
'map_filters_hover_tab', |
| 1604 |
[ |
| 1605 |
'label' => esc_html__( 'Hover', 'hello-plus' ), |
| 1606 |
] |
| 1607 |
); |
| 1608 |
|
| 1609 |
$this->add_group_control( |
| 1610 |
Group_Control_Css_Filter::get_type(), |
| 1611 |
[ |
| 1612 |
'name' => 'map_css_filters_hover', |
| 1613 |
'selector' => '{{WRAPPER}} .ehp-contact__map:hover', |
| 1614 |
] |
| 1615 |
); |
| 1616 |
|
| 1617 |
$this->add_control( |
| 1618 |
'map_css_filters_hover_transition_duration', |
| 1619 |
[ |
| 1620 |
'label' => esc_html__( 'Transition Duration (s)', 'hello-plus' ), |
| 1621 |
'type' => Controls_Manager::SLIDER, |
| 1622 |
'range' => [ |
| 1623 |
'px' => [ |
| 1624 |
'min' => 0, |
| 1625 |
'max' => 3, |
| 1626 |
'step' => 0.1, |
| 1627 |
], |
| 1628 |
], |
| 1629 |
'selectors' => [ |
| 1630 |
'{{WRAPPER}} .ehp-contact__map' => 'transition-duration: {{SIZE}}s', |
| 1631 |
], |
| 1632 |
] |
| 1633 |
); |
| 1634 |
|
| 1635 |
$this->end_controls_tab(); |
| 1636 |
|
| 1637 |
$this->end_controls_tabs(); |
| 1638 |
|
| 1639 |
$this->add_control( |
| 1640 |
'show_map_border', |
| 1641 |
[ |
| 1642 |
'label' => esc_html__( 'Border', 'hello-plus' ), |
| 1643 |
'type' => Controls_Manager::SWITCHER, |
| 1644 |
'label_on' => esc_html__( 'Yes', 'hello-plus' ), |
| 1645 |
'label_off' => esc_html__( 'No', 'hello-plus' ), |
| 1646 |
'return_value' => 'yes', |
| 1647 |
'default' => 'no', |
| 1648 |
'separator' => 'before', |
| 1649 |
] |
| 1650 |
); |
| 1651 |
|
| 1652 |
$this->add_control( |
| 1653 |
'map_border_width', |
| 1654 |
[ |
| 1655 |
'label' => __( 'Border Width', 'hello-plus' ), |
| 1656 |
'type' => Controls_Manager::SLIDER, |
| 1657 |
'size_units' => [ 'px' ], |
| 1658 |
'range' => [ |
| 1659 |
'px' => [ |
| 1660 |
'min' => 0, |
| 1661 |
'max' => 10, |
| 1662 |
'step' => 1, |
| 1663 |
], |
| 1664 |
], |
| 1665 |
'default' => [ |
| 1666 |
'size' => 1, |
| 1667 |
'unit' => 'px', |
| 1668 |
], |
| 1669 |
'selectors' => [ |
| 1670 |
'{{WRAPPER}} .ehp-contact' => '--contact-map-border-width: {{SIZE}}{{UNIT}};', |
| 1671 |
], |
| 1672 |
'condition' => [ |
| 1673 |
'show_map_border' => 'yes', |
| 1674 |
], |
| 1675 |
] |
| 1676 |
); |
| 1677 |
|
| 1678 |
$this->add_control( |
| 1679 |
'map_border_color', |
| 1680 |
[ |
| 1681 |
'label' => esc_html__( 'Color', 'hello-plus' ), |
| 1682 |
'type' => Controls_Manager::COLOR, |
| 1683 |
'global' => [ |
| 1684 |
'default' => Global_Colors::COLOR_TEXT, |
| 1685 |
], |
| 1686 |
'selectors' => [ |
| 1687 |
'{{WRAPPER}} .ehp-contact' => '--contact-map-border-color: {{VALUE}}', |
| 1688 |
], |
| 1689 |
'condition' => [ |
| 1690 |
'show_map_border' => 'yes', |
| 1691 |
], |
| 1692 |
] |
| 1693 |
); |
| 1694 |
|
| 1695 |
$shapes = new Ehp_Shapes( $this, [ |
| 1696 |
'widget_name' => $this->get_name(), |
| 1697 |
'container_prefix' => 'map', |
| 1698 |
] ); |
| 1699 |
$shapes->add_style_controls(); |
| 1700 |
|
| 1701 |
$this->add_group_control( |
| 1702 |
Group_Control_Box_Shadow::get_type(), |
| 1703 |
[ |
| 1704 |
'name' => 'map_box_shadow', |
| 1705 |
'selector' => '{{WRAPPER}} .ehp-contact__map', |
| 1706 |
] |
| 1707 |
); |
| 1708 |
|
| 1709 |
$this->end_controls_section(); |
| 1710 |
} |
| 1711 |
|
| 1712 |
protected function add_box_style_section() { |
| 1713 |
$this->start_controls_section( |
| 1714 |
'box_style_section', |
| 1715 |
[ |
| 1716 |
'label' => esc_html__( 'Box', 'hello-plus' ), |
| 1717 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1718 |
] |
| 1719 |
); |
| 1720 |
|
| 1721 |
$this->add_control( |
| 1722 |
'box_background_label', |
| 1723 |
[ |
| 1724 |
'label' => esc_html__( 'Background', 'hello-plus' ), |
| 1725 |
'type' => Controls_Manager::HEADING, |
| 1726 |
] |
| 1727 |
); |
| 1728 |
|
| 1729 |
$this->add_group_control( |
| 1730 |
Group_Control_Background::get_type(), |
| 1731 |
[ |
| 1732 |
'name' => 'background', |
| 1733 |
'types' => [ 'classic', 'gradient' ], |
| 1734 |
'selector' => '{{WRAPPER}} .ehp-contact', |
| 1735 |
] |
| 1736 |
); |
| 1737 |
|
| 1738 |
$this->add_control( |
| 1739 |
'box_background_overlay_label', |
| 1740 |
[ |
| 1741 |
'label' => esc_html__( 'Background Overlay', 'hello-plus' ), |
| 1742 |
'type' => Controls_Manager::HEADING, |
| 1743 |
'separator' => 'before', |
| 1744 |
] |
| 1745 |
); |
| 1746 |
|
| 1747 |
$this->add_group_control( |
| 1748 |
Group_Control_Background::get_type(), |
| 1749 |
[ |
| 1750 |
'name' => 'background_overlay', |
| 1751 |
'types' => [ 'classic', 'gradient' ], |
| 1752 |
'selector' => '{{WRAPPER}} .ehp-contact__overlay', |
| 1753 |
] |
| 1754 |
); |
| 1755 |
|
| 1756 |
$this->add_responsive_control( |
| 1757 |
'background_overlay_opacity', |
| 1758 |
[ |
| 1759 |
'label' => esc_html__( 'Opacity', 'hello-plus' ), |
| 1760 |
'type' => Controls_Manager::SLIDER, |
| 1761 |
'range' => [ |
| 1762 |
'%' => [ |
| 1763 |
'max' => 1, |
| 1764 |
'min' => 0.10, |
| 1765 |
'step' => 0.01, |
| 1766 |
], |
| 1767 |
], |
| 1768 |
'default' => [ |
| 1769 |
'unit' => '%', |
| 1770 |
'size' => 0.5, |
| 1771 |
], |
| 1772 |
'selectors' => [ |
| 1773 |
'{{WRAPPER}} .ehp-contact' => '--contact-overlay-opacity: {{SIZE}};', |
| 1774 |
], |
| 1775 |
] |
| 1776 |
); |
| 1777 |
|
| 1778 |
$this->add_responsive_control( |
| 1779 |
'box_element_spacing', |
| 1780 |
[ |
| 1781 |
'label' => esc_html__( 'Element Spacing', 'hello-plus' ), |
| 1782 |
'type' => Controls_Manager::SLIDER, |
| 1783 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 1784 |
'range' => [ |
| 1785 |
'px' => [ |
| 1786 |
'max' => 150, |
| 1787 |
], |
| 1788 |
'%' => [ |
| 1789 |
'max' => 100, |
| 1790 |
], |
| 1791 |
], |
| 1792 |
'default' => [ |
| 1793 |
'size' => 32, |
| 1794 |
'unit' => 'px', |
| 1795 |
], |
| 1796 |
'selectors' => [ |
| 1797 |
'{{WRAPPER}} .ehp-contact' => '--contact-elements-spacing: {{SIZE}}{{UNIT}};', |
| 1798 |
], |
| 1799 |
'separator' => 'before', |
| 1800 |
] |
| 1801 |
); |
| 1802 |
|
| 1803 |
$this->add_responsive_control( |
| 1804 |
'box_gap', |
| 1805 |
[ |
| 1806 |
'label' => esc_html__( 'Gap', 'hello-plus' ), |
| 1807 |
'type' => Controls_Manager::SLIDER, |
| 1808 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 1809 |
'range' => [ |
| 1810 |
'px' => [ |
| 1811 |
'max' => 100, |
| 1812 |
], |
| 1813 |
'%' => [ |
| 1814 |
'max' => 100, |
| 1815 |
], |
| 1816 |
], |
| 1817 |
'default' => [ |
| 1818 |
'size' => 60, |
| 1819 |
'unit' => 'px', |
| 1820 |
], |
| 1821 |
'selectors' => [ |
| 1822 |
'{{WRAPPER}} .ehp-contact' => '--contact-box-gap: {{SIZE}}{{UNIT}};', |
| 1823 |
], |
| 1824 |
'separator' => 'before', |
| 1825 |
] |
| 1826 |
); |
| 1827 |
|
| 1828 |
$this->add_control( |
| 1829 |
'show_box_border', |
| 1830 |
[ |
| 1831 |
'label' => esc_html__( 'Border', 'hello-plus' ), |
| 1832 |
'type' => Controls_Manager::SWITCHER, |
| 1833 |
'label_on' => esc_html__( 'Yes', 'hello-plus' ), |
| 1834 |
'label_off' => esc_html__( 'No', 'hello-plus' ), |
| 1835 |
'return_value' => 'yes', |
| 1836 |
'default' => 'no', |
| 1837 |
'separator' => 'before', |
| 1838 |
] |
| 1839 |
); |
| 1840 |
|
| 1841 |
$this->add_control( |
| 1842 |
'box_border_width', |
| 1843 |
[ |
| 1844 |
'label' => __( 'Border Width', 'hello-plus' ), |
| 1845 |
'type' => Controls_Manager::SLIDER, |
| 1846 |
'size_units' => [ 'px' ], |
| 1847 |
'range' => [ |
| 1848 |
'px' => [ |
| 1849 |
'min' => 0, |
| 1850 |
'max' => 10, |
| 1851 |
'step' => 1, |
| 1852 |
], |
| 1853 |
], |
| 1854 |
'default' => [ |
| 1855 |
'size' => 1, |
| 1856 |
'unit' => 'px', |
| 1857 |
], |
| 1858 |
'selectors' => [ |
| 1859 |
'{{WRAPPER}} .ehp-contact' => '--contact-box-border-width: {{SIZE}}{{UNIT}};', |
| 1860 |
], |
| 1861 |
'condition' => [ |
| 1862 |
'show_box_border' => 'yes', |
| 1863 |
], |
| 1864 |
] |
| 1865 |
); |
| 1866 |
|
| 1867 |
$this->add_control( |
| 1868 |
'box_border_color', |
| 1869 |
[ |
| 1870 |
'label' => esc_html__( 'Color', 'hello-plus' ), |
| 1871 |
'type' => Controls_Manager::COLOR, |
| 1872 |
'global' => [ |
| 1873 |
'default' => Global_Colors::COLOR_TEXT, |
| 1874 |
], |
| 1875 |
'selectors' => [ |
| 1876 |
'{{WRAPPER}} .ehp-contact' => '--contact-box-border-color: {{VALUE}}', |
| 1877 |
], |
| 1878 |
'condition' => [ |
| 1879 |
'show_box_border' => 'yes', |
| 1880 |
], |
| 1881 |
] |
| 1882 |
); |
| 1883 |
|
| 1884 |
$ehp_shapes = new Ehp_Shapes( $this, [ |
| 1885 |
'widget_name' => $this->get_name(), |
| 1886 |
'container_prefix' => 'box', |
| 1887 |
] ); |
| 1888 |
$ehp_shapes->add_style_controls(); |
| 1889 |
|
| 1890 |
$this->add_group_control( |
| 1891 |
Group_Control_Box_Shadow::get_type(), |
| 1892 |
[ |
| 1893 |
'name' => 'box_box_shadow', |
| 1894 |
'selector' => '{{WRAPPER}} .ehp-contact', |
| 1895 |
] |
| 1896 |
); |
| 1897 |
|
| 1898 |
$ehp_padding = new Ehp_Padding( $this, [ |
| 1899 |
'widget_name' => $this->get_name(), |
| 1900 |
'container_prefix' => 'box', |
| 1901 |
'tablet_default_padding' => [ |
| 1902 |
'top' => '32', |
| 1903 |
'right' => '32', |
| 1904 |
'bottom' => '32', |
| 1905 |
'left' => '32', |
| 1906 |
], |
| 1907 |
'mobile_default_padding' => [ |
| 1908 |
'top' => '32', |
| 1909 |
'right' => '32', |
| 1910 |
'bottom' => '32', |
| 1911 |
'left' => '32', |
| 1912 |
], |
| 1913 |
] ); |
| 1914 |
$ehp_padding->add_style_controls(); |
| 1915 |
|
| 1916 |
$ehp_full_height = new Ehp_Full_Height( $this ); |
| 1917 |
$ehp_full_height->add_style_controls(); |
| 1918 |
|
| 1919 |
$this->end_controls_section(); |
| 1920 |
} |
| 1921 |
} |
| 1922 |
|