| 1 |
<?php |
| 2 |
namespace HelloPlus\Modules\Forms\Widgets; |
| 3 |
|
| 4 |
use Elementor\Controls_Manager; |
| 5 |
use Elementor\Core\Kits\Documents\Tabs\{ |
| 6 |
Global_Colors, |
| 7 |
Global_Typography, |
| 8 |
}; |
| 9 |
|
| 10 |
use Elementor\{ |
| 11 |
Group_Control_Background, |
| 12 |
Group_Control_Box_Shadow, |
| 13 |
Group_Control_Typography, |
| 14 |
}; |
| 15 |
|
| 16 |
use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 17 |
use Elementor\Modules\Promotions\Controls\Promotion_Control; |
| 18 |
use Elementor\Repeater; |
| 19 |
use HelloPlus\Includes\Utils; |
| 20 |
|
| 21 |
use HelloPlus\Modules\Forms\{ |
| 22 |
Classes\Form_Base, |
| 23 |
Classes\Render\Widget_Form_Render, |
| 24 |
Components\Ajax_Handler, |
| 25 |
Controls\Fields_Repeater, |
| 26 |
Module, |
| 27 |
}; |
| 28 |
|
| 29 |
use HelloPlus\Modules\Content\Classes\{ |
| 30 |
Choose_Img_Control, |
| 31 |
}; |
| 32 |
|
| 33 |
use HelloPlus\Classes\{ |
| 34 |
Ehp_Full_Height, |
| 35 |
Ehp_Image, |
| 36 |
Ehp_Shapes, |
| 37 |
Ehp_Column_Structure, |
| 38 |
}; |
| 39 |
|
| 40 |
if ( ! defined( 'ABSPATH' ) ) { |
| 41 |
exit; // Exit if accessed directly |
| 42 |
} |
| 43 |
|
| 44 |
class Ehp_Form extends Form_Base { |
| 45 |
|
| 46 |
public function get_name() { |
| 47 |
return 'ehp-form'; |
| 48 |
} |
| 49 |
|
| 50 |
public function get_title() { |
| 51 |
return esc_html__( 'Form Lite', 'hello-plus' ); |
| 52 |
} |
| 53 |
|
| 54 |
public function get_icon() { |
| 55 |
return 'eicon-ehp-forms'; |
| 56 |
} |
| 57 |
|
| 58 |
public function get_keywords() { |
| 59 |
return [ 'form', 'forms', 'field', 'button' ]; |
| 60 |
} |
| 61 |
|
| 62 |
protected function is_dynamic_content(): bool { |
| 63 |
return false; |
| 64 |
} |
| 65 |
|
| 66 |
public function get_custom_help_url(): string { |
| 67 |
return 'https://go.elementor.com/form-lite-help'; |
| 68 |
} |
| 69 |
|
| 70 |
protected function get_upsale_data(): array { |
| 71 |
return [ |
| 72 |
'condition' => ! Utils::has_pro(), |
| 73 |
'image' => esc_url( HELLOPLUS_IMAGES_URL . 'go-pro.svg' ), |
| 74 |
'image_alt' => esc_attr__( 'Upgrade Now', 'hello-plus' ), |
| 75 |
'title' => esc_html__( 'Take your forms further', 'hello-plus' ), |
| 76 |
'description' => esc_html__( 'Unlock advanced form customization and field options with Elementor Pro.', 'hello-plus' ), |
| 77 |
'upgrade_url' => esc_url( 'https://go.elementor.com/form-lite-widget-elementor-plugin-pricing/' ), |
| 78 |
'upgrade_text' => esc_html__( 'Upgrade Now', 'hello-plus' ), |
| 79 |
]; |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* Get style dependencies. |
| 84 |
* |
| 85 |
* Retrieve the list of style dependencies the widget requires. |
| 86 |
* |
| 87 |
* @since 3.24.0 |
| 88 |
* @access public |
| 89 |
* |
| 90 |
* @return array Widget style dependencies. |
| 91 |
*/ |
| 92 |
public function get_style_depends(): array { |
| 93 |
return [ 'helloplus-forms' ]; |
| 94 |
} |
| 95 |
|
| 96 |
public function get_script_depends(): array { |
| 97 |
return [ 'helloplus-forms-fe' ]; |
| 98 |
} |
| 99 |
|
| 100 |
protected function render(): void { |
| 101 |
$render_strategy = new Widget_Form_Render( $this ); |
| 102 |
|
| 103 |
$this->add_inline_editing_attributes( 'text_heading', 'none' ); |
| 104 |
$this->add_inline_editing_attributes( 'text_description', 'none' ); |
| 105 |
|
| 106 |
$render_strategy->render(); |
| 107 |
} |
| 108 |
|
| 109 |
protected function register_controls() { |
| 110 |
$this->add_content_layout_section(); |
| 111 |
$this->add_content_text_section(); |
| 112 |
$this->add_content_image_section(); |
| 113 |
$this->add_content_form_fields_section(); |
| 114 |
$this->add_content_button_section(); |
| 115 |
$this->add_content_actions_after_submit_section(); |
| 116 |
$this->add_action_sections(); |
| 117 |
$this->add_content_additional_options_section(); |
| 118 |
|
| 119 |
$this->add_style_layout_section(); |
| 120 |
$this->add_style_text_section(); |
| 121 |
$this->add_style_image_section(); |
| 122 |
$this->add_style_form_section(); |
| 123 |
$this->add_style_fields_section(); |
| 124 |
$this->add_style_buttons_section(); |
| 125 |
$this->add_style_messages_section(); |
| 126 |
$this->add_style_box_section(); |
| 127 |
} |
| 128 |
|
| 129 |
protected function add_action_sections() { |
| 130 |
$actions = Module::instance()->actions_registrar->get(); |
| 131 |
|
| 132 |
foreach ( $actions as $action ) { |
| 133 |
$action->register_settings_section( $this ); |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
protected function add_content_layout_section(): void { |
| 138 |
$this->start_controls_section( |
| 139 |
'section_layout', |
| 140 |
[ |
| 141 |
'label' => esc_html__( 'Layout', 'hello-plus' ), |
| 142 |
] |
| 143 |
); |
| 144 |
|
| 145 |
$this->add_control( |
| 146 |
'layout_preset', |
| 147 |
[ |
| 148 |
'label' => esc_html__( 'Preset', 'hello-plus' ), |
| 149 |
'type' => Choose_Img_Control::CONTROL_NAME, |
| 150 |
'default' => 'quick-connect', |
| 151 |
'label_block' => true, |
| 152 |
'columns' => 2, |
| 153 |
'toggle' => false, |
| 154 |
'options' => [ |
| 155 |
'quick-connect' => [ |
| 156 |
'title' => wp_kses_post( "Quick Connect:\nEncourage fast, direct\ncontact." ), |
| 157 |
'image' => HELLOPLUS_IMAGES_URL . 'form-lite-quick-connect.svg', |
| 158 |
'hover_image' => true, |
| 159 |
], |
| 160 |
'interact' => [ |
| 161 |
'title' => wp_kses_post( "Interact: Focus on\nyour messaging to\nstart a conversation." ), |
| 162 |
'image' => HELLOPLUS_IMAGES_URL . 'form-lite-interact.svg', |
| 163 |
'hover_image' => true, |
| 164 |
], |
| 165 |
'engage' => [ |
| 166 |
'title' => wp_kses_post( "Engage: Capture\nattention to drive\ninteraction." ), |
| 167 |
'image' => HELLOPLUS_IMAGES_URL . 'form-lite-engage.svg', |
| 168 |
'hover_image' => true, |
| 169 |
], |
| 170 |
], |
| 171 |
'frontend_available' => true, |
| 172 |
] |
| 173 |
); |
| 174 |
|
| 175 |
$this->end_controls_section(); |
| 176 |
} |
| 177 |
|
| 178 |
protected function add_content_text_section(): void { |
| 179 |
$this->start_controls_section( |
| 180 |
'section_text', |
| 181 |
[ |
| 182 |
'label' => esc_html__( 'Text', 'hello-plus' ), |
| 183 |
] |
| 184 |
); |
| 185 |
|
| 186 |
$this->add_control( |
| 187 |
'text_heading', |
| 188 |
[ |
| 189 |
'label' => esc_html__( 'Heading', 'hello-plus' ), |
| 190 |
'type' => Controls_Manager::TEXTAREA, |
| 191 |
'default' => esc_html__( 'Contact Us', 'hello-plus' ), |
| 192 |
'placeholder' => esc_html__( 'Add your text here', 'hello-plus' ), |
| 193 |
'dynamic' => [ |
| 194 |
'active' => true, |
| 195 |
], |
| 196 |
] |
| 197 |
); |
| 198 |
|
| 199 |
$this->add_control( |
| 200 |
'text_heading_tag', |
| 201 |
[ |
| 202 |
'label' => esc_html__( 'Heading HTML Tag', 'hello-plus' ), |
| 203 |
'type' => Controls_Manager::SELECT, |
| 204 |
'options' => [ |
| 205 |
'h1' => 'H1', |
| 206 |
'h2' => 'H2', |
| 207 |
'h3' => 'H3', |
| 208 |
'h4' => 'H4', |
| 209 |
'h5' => 'H5', |
| 210 |
'h6' => 'H6', |
| 211 |
'div' => 'div', |
| 212 |
'span' => 'span', |
| 213 |
'p' => 'p', |
| 214 |
], |
| 215 |
'default' => 'h2', |
| 216 |
] |
| 217 |
); |
| 218 |
|
| 219 |
$this->add_control( |
| 220 |
'text_description', |
| 221 |
[ |
| 222 |
'label' => esc_html__( 'Description', 'hello-plus' ), |
| 223 |
'type' => Controls_Manager::TEXTAREA, |
| 224 |
'default' => esc_html__( 'Fill out the form below and we will contact you as soon as possible', 'hello-plus' ), |
| 225 |
'placeholder' => esc_html__( 'Add your text here', 'hello-plus' ), |
| 226 |
'dynamic' => [ |
| 227 |
'active' => true, |
| 228 |
], |
| 229 |
] |
| 230 |
); |
| 231 |
|
| 232 |
$this->end_controls_section(); |
| 233 |
} |
| 234 |
|
| 235 |
protected function add_content_image_section(): void { |
| 236 |
$this->start_controls_section( |
| 237 |
'section_image', |
| 238 |
[ |
| 239 |
'label' => esc_html__( 'Image', 'hello-plus' ), |
| 240 |
'condition' => [ |
| 241 |
'layout_preset' => 'engage', |
| 242 |
], |
| 243 |
] |
| 244 |
); |
| 245 |
|
| 246 |
$image = new Ehp_Image( $this, [ 'widget_name' => 'form' ] ); |
| 247 |
$image->add_content_section(); |
| 248 |
|
| 249 |
$this->end_controls_section(); |
| 250 |
} |
| 251 |
|
| 252 |
protected function add_content_form_fields_section(): void { |
| 253 |
$repeater = new Repeater(); |
| 254 |
|
| 255 |
$field_types = [ |
| 256 |
'text' => esc_html__( 'Text', 'hello-plus' ), |
| 257 |
'email' => esc_html__( 'Email', 'hello-plus' ), |
| 258 |
'textarea' => esc_html__( 'Textarea', 'hello-plus' ), |
| 259 |
'ehp-tel' => esc_html__( 'Tel', 'hello-plus' ), |
| 260 |
'select' => esc_html__( 'Select', 'hello-plus' ), |
| 261 |
'ehp-acceptance' => esc_html__( 'Acceptance', 'hello-plus' ), |
| 262 |
]; |
| 263 |
|
| 264 |
$repeater->start_controls_tabs( 'form_fields_tabs' ); |
| 265 |
|
| 266 |
$repeater->start_controls_tab( 'form_fields_content_tab', [ |
| 267 |
'label' => esc_html__( 'Content', 'hello-plus' ), |
| 268 |
] ); |
| 269 |
|
| 270 |
$repeater->add_control( |
| 271 |
'field_type', |
| 272 |
[ |
| 273 |
'label' => esc_html__( 'Type', 'hello-plus' ), |
| 274 |
'type' => Controls_Manager::SELECT, |
| 275 |
'options' => $field_types, |
| 276 |
'default' => 'text', |
| 277 |
] |
| 278 |
); |
| 279 |
|
| 280 |
$repeater->add_control( |
| 281 |
'field_label', |
| 282 |
[ |
| 283 |
'label' => esc_html__( 'Label', 'hello-plus' ), |
| 284 |
'type' => Controls_Manager::TEXT, |
| 285 |
'default' => '', |
| 286 |
'dynamic' => [ |
| 287 |
'active' => true, |
| 288 |
], |
| 289 |
] |
| 290 |
); |
| 291 |
|
| 292 |
$repeater->add_control( |
| 293 |
'placeholder', |
| 294 |
[ |
| 295 |
'label' => esc_html__( 'Placeholder', 'hello-plus' ), |
| 296 |
'type' => Controls_Manager::TEXT, |
| 297 |
'default' => '', |
| 298 |
'conditions' => [ |
| 299 |
'terms' => [ |
| 300 |
[ |
| 301 |
'name' => 'field_type', |
| 302 |
'operator' => 'in', |
| 303 |
'value' => [ |
| 304 |
'ehp-tel', |
| 305 |
'text', |
| 306 |
'email', |
| 307 |
'textarea', |
| 308 |
], |
| 309 |
], |
| 310 |
], |
| 311 |
], |
| 312 |
'dynamic' => [ |
| 313 |
'active' => true, |
| 314 |
], |
| 315 |
] |
| 316 |
); |
| 317 |
|
| 318 |
$repeater->add_control( |
| 319 |
'required', |
| 320 |
[ |
| 321 |
'label' => esc_html__( 'Required', 'hello-plus' ), |
| 322 |
'type' => Controls_Manager::SWITCHER, |
| 323 |
'return_value' => 'true', |
| 324 |
'default' => '', |
| 325 |
] |
| 326 |
); |
| 327 |
|
| 328 |
$repeater->add_control( |
| 329 |
'field_options', |
| 330 |
[ |
| 331 |
'label' => esc_html__( 'Options', 'hello-plus' ), |
| 332 |
'type' => Controls_Manager::TEXTAREA, |
| 333 |
'default' => '', |
| 334 |
'description' => esc_html__( 'Enter each option in a separate line. To differentiate between label and value, separate them with a pipe char ("|"). For example: First Name|f_name', 'hello-plus' ), |
| 335 |
'conditions' => [ |
| 336 |
'terms' => [ |
| 337 |
[ |
| 338 |
'name' => 'field_type', |
| 339 |
'operator' => 'in', |
| 340 |
'value' => [ |
| 341 |
'select', |
| 342 |
], |
| 343 |
], |
| 344 |
], |
| 345 |
], |
| 346 |
] |
| 347 |
); |
| 348 |
|
| 349 |
$repeater->add_control( |
| 350 |
'allow_multiple', |
| 351 |
[ |
| 352 |
'label' => esc_html__( 'Multiple Selection', 'hello-plus' ), |
| 353 |
'type' => Controls_Manager::SWITCHER, |
| 354 |
'return_value' => 'true', |
| 355 |
'conditions' => [ |
| 356 |
'terms' => [ |
| 357 |
[ |
| 358 |
'name' => 'field_type', |
| 359 |
'value' => 'select', |
| 360 |
], |
| 361 |
], |
| 362 |
], |
| 363 |
] |
| 364 |
); |
| 365 |
|
| 366 |
$repeater->add_control( |
| 367 |
'select_size', |
| 368 |
[ |
| 369 |
'label' => esc_html__( 'Rows', 'hello-plus' ), |
| 370 |
'type' => Controls_Manager::NUMBER, |
| 371 |
'min' => 2, |
| 372 |
'step' => 1, |
| 373 |
'conditions' => [ |
| 374 |
'terms' => [ |
| 375 |
[ |
| 376 |
'name' => 'field_type', |
| 377 |
'value' => 'select', |
| 378 |
], |
| 379 |
[ |
| 380 |
'name' => 'allow_multiple', |
| 381 |
'value' => 'true', |
| 382 |
], |
| 383 |
], |
| 384 |
], |
| 385 |
] |
| 386 |
); |
| 387 |
|
| 388 |
$repeater->add_responsive_control( |
| 389 |
'width', |
| 390 |
[ |
| 391 |
'label' => esc_html__( 'Column Width', 'hello-plus' ), |
| 392 |
'type' => Controls_Manager::SELECT, |
| 393 |
'options' => [ |
| 394 |
'100' => '100%', |
| 395 |
'50' => '50%', |
| 396 |
'33' => '33%', |
| 397 |
], |
| 398 |
'default' => '100', |
| 399 |
'tablet_default' => '100', |
| 400 |
'mobile_default' => '100', |
| 401 |
] |
| 402 |
); |
| 403 |
|
| 404 |
$repeater->add_control( |
| 405 |
'rows', |
| 406 |
[ |
| 407 |
'label' => esc_html__( 'Rows', 'hello-plus' ), |
| 408 |
'type' => Controls_Manager::NUMBER, |
| 409 |
'default' => 4, |
| 410 |
'conditions' => [ |
| 411 |
'terms' => [ |
| 412 |
[ |
| 413 |
'name' => 'field_type', |
| 414 |
'value' => 'textarea', |
| 415 |
], |
| 416 |
], |
| 417 |
], |
| 418 |
] |
| 419 |
); |
| 420 |
|
| 421 |
$repeater->add_control( |
| 422 |
'css_classes', |
| 423 |
[ |
| 424 |
'label' => esc_html__( 'CSS Classes', 'hello-plus' ), |
| 425 |
'type' => Controls_Manager::HIDDEN, |
| 426 |
'default' => '', |
| 427 |
'title' => esc_html__( 'Add your custom class WITHOUT the dot. e.g: my-class', 'hello-plus' ), |
| 428 |
] |
| 429 |
); |
| 430 |
|
| 431 |
$repeater->end_controls_tab(); |
| 432 |
|
| 433 |
$repeater->start_controls_tab( |
| 434 |
'form_fields_advanced_tab', |
| 435 |
[ |
| 436 |
'label' => esc_html__( 'Advanced', 'hello-plus' ), |
| 437 |
'condition' => [ |
| 438 |
'field_type!' => 'html', |
| 439 |
], |
| 440 |
] |
| 441 |
); |
| 442 |
|
| 443 |
$repeater->add_control( |
| 444 |
'field_value', |
| 445 |
[ |
| 446 |
'label' => esc_html__( 'Default Value', 'hello-plus' ), |
| 447 |
'type' => Controls_Manager::TEXT, |
| 448 |
'default' => '', |
| 449 |
'dynamic' => [ |
| 450 |
'active' => true, |
| 451 |
], |
| 452 |
'ai' => [ |
| 453 |
'active' => false, |
| 454 |
], |
| 455 |
'conditions' => [ |
| 456 |
'terms' => [ |
| 457 |
[ |
| 458 |
'name' => 'field_type', |
| 459 |
'operator' => 'in', |
| 460 |
'value' => [ |
| 461 |
'text', |
| 462 |
'email', |
| 463 |
'textarea', |
| 464 |
'tel', |
| 465 |
'select', |
| 466 |
], |
| 467 |
], |
| 468 |
], |
| 469 |
], |
| 470 |
] |
| 471 |
); |
| 472 |
|
| 473 |
$repeater->add_control( |
| 474 |
'custom_id', |
| 475 |
[ |
| 476 |
'label' => esc_html__( 'ID', 'hello-plus' ), |
| 477 |
'type' => Controls_Manager::TEXT, |
| 478 |
'description' => sprintf( |
| 479 |
/* translators: %1$s: Opening code tag, %2$s: Closing code tag. */ |
| 480 |
esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page. This field allows %1$sA-z 0-9%2$s & underscore chars without spaces.', 'hello-plus' ), |
| 481 |
'<code>', |
| 482 |
'</code>' |
| 483 |
), |
| 484 |
'render_type' => 'none', |
| 485 |
'required' => true, |
| 486 |
'dynamic' => [ |
| 487 |
'active' => true, |
| 488 |
], |
| 489 |
'ai' => [ |
| 490 |
'active' => false, |
| 491 |
], |
| 492 |
] |
| 493 |
); |
| 494 |
|
| 495 |
$shortcode_template = '{{ view.container.settings.get( \'custom_id\' ) }}'; |
| 496 |
|
| 497 |
$repeater->add_control( |
| 498 |
'shortcode', |
| 499 |
[ |
| 500 |
'label' => esc_html__( 'Shortcode', 'hello-plus' ), |
| 501 |
'type' => Controls_Manager::RAW_HTML, |
| 502 |
'classes' => 'forms-field-shortcode', |
| 503 |
'raw' => '<input class="elementor-form-field-shortcode" value=\'[field id="' . $shortcode_template . '"]\' readonly />', |
| 504 |
] |
| 505 |
); |
| 506 |
|
| 507 |
$repeater->end_controls_tab(); |
| 508 |
|
| 509 |
$repeater->end_controls_tabs(); |
| 510 |
|
| 511 |
$this->start_controls_section( |
| 512 |
'section_form_fields', |
| 513 |
[ |
| 514 |
'label' => esc_html__( 'Form Fields', 'hello-plus' ), |
| 515 |
] |
| 516 |
); |
| 517 |
|
| 518 |
$this->add_control( |
| 519 |
'form_name', |
| 520 |
[ |
| 521 |
'label' => esc_html__( 'Form Name', 'hello-plus' ), |
| 522 |
'type' => Controls_Manager::TEXT, |
| 523 |
'default' => esc_html__( 'New Form', 'hello-plus' ), |
| 524 |
'placeholder' => esc_html__( 'Form Name', 'hello-plus' ), |
| 525 |
] |
| 526 |
); |
| 527 |
|
| 528 |
$this->add_control( |
| 529 |
'form_fields', |
| 530 |
[ |
| 531 |
'type' => Fields_Repeater::CONTROL_TYPE, |
| 532 |
'fields' => $repeater->get_controls(), |
| 533 |
'default' => [ |
| 534 |
[ |
| 535 |
'custom_id' => 'name', |
| 536 |
'field_type' => 'text', |
| 537 |
'field_label' => esc_html__( 'Name', 'hello-plus' ), |
| 538 |
'placeholder' => esc_html__( 'Name', 'hello-plus' ), |
| 539 |
'width' => '100', |
| 540 |
'dynamic' => [ |
| 541 |
'active' => true, |
| 542 |
], |
| 543 |
], |
| 544 |
[ |
| 545 |
'custom_id' => 'email', |
| 546 |
'field_type' => 'email', |
| 547 |
'required' => 'true', |
| 548 |
'field_label' => esc_html__( 'Email', 'hello-plus' ), |
| 549 |
'placeholder' => esc_html__( 'Email', 'hello-plus' ), |
| 550 |
'width' => '100', |
| 551 |
], |
| 552 |
[ |
| 553 |
'custom_id' => 'message', |
| 554 |
'field_type' => 'textarea', |
| 555 |
'field_label' => esc_html__( 'Message', 'hello-plus' ), |
| 556 |
'placeholder' => esc_html__( 'Message', 'hello-plus' ), |
| 557 |
'width' => '100', |
| 558 |
], |
| 559 |
], |
| 560 |
'title_field' => '{{{ field_label }}}', |
| 561 |
] |
| 562 |
); |
| 563 |
|
| 564 |
$this->add_control( |
| 565 |
'show_labels', |
| 566 |
[ |
| 567 |
'label' => esc_html__( 'Label', 'hello-plus' ), |
| 568 |
'type' => Controls_Manager::SWITCHER, |
| 569 |
'label_on' => esc_html__( 'Show', 'hello-plus' ), |
| 570 |
'label_off' => esc_html__( 'Hide', 'hello-plus' ), |
| 571 |
'return_value' => 'true', |
| 572 |
'default' => 'true', |
| 573 |
'separator' => 'before', |
| 574 |
] |
| 575 |
); |
| 576 |
|
| 577 |
$this->add_control( |
| 578 |
'mark_required', |
| 579 |
[ |
| 580 |
'label' => esc_html__( 'Required Mark', 'hello-plus' ), |
| 581 |
'type' => Controls_Manager::SWITCHER, |
| 582 |
'label_on' => esc_html__( 'Show', 'hello-plus' ), |
| 583 |
'label_off' => esc_html__( 'Hide', 'hello-plus' ), |
| 584 |
'default' => '', |
| 585 |
'condition' => [ |
| 586 |
'show_labels!' => '', |
| 587 |
], |
| 588 |
] |
| 589 |
); |
| 590 |
|
| 591 |
$this->end_controls_section(); |
| 592 |
} |
| 593 |
|
| 594 |
protected function add_content_button_section(): void { |
| 595 |
$this->start_controls_section( |
| 596 |
'section_buttons', |
| 597 |
[ |
| 598 |
'label' => esc_html__( 'Button', 'hello-plus' ), |
| 599 |
] |
| 600 |
); |
| 601 |
|
| 602 |
$this->add_responsive_control( |
| 603 |
'button_width', |
| 604 |
[ |
| 605 |
'label' => esc_html__( 'Column Width', 'hello-plus' ), |
| 606 |
'type' => Controls_Manager::SELECT, |
| 607 |
'options' => [ |
| 608 |
'100' => '100%', |
| 609 |
'50' => '50%', |
| 610 |
'33' => '33%', |
| 611 |
], |
| 612 |
'default' => '100', |
| 613 |
'frontend_available' => true, |
| 614 |
] |
| 615 |
); |
| 616 |
|
| 617 |
$this->add_control( |
| 618 |
'button_text', |
| 619 |
[ |
| 620 |
'label' => esc_html__( 'Submit', 'hello-plus' ), |
| 621 |
'type' => Controls_Manager::TEXT, |
| 622 |
'default' => esc_html__( 'Send', 'hello-plus' ), |
| 623 |
'placeholder' => esc_html__( 'Send', 'hello-plus' ), |
| 624 |
'dynamic' => [ |
| 625 |
'active' => true, |
| 626 |
], |
| 627 |
'ai' => [ |
| 628 |
'active' => false, |
| 629 |
], |
| 630 |
] |
| 631 |
); |
| 632 |
|
| 633 |
$this->add_control( |
| 634 |
'selected_button_icon', |
| 635 |
[ |
| 636 |
'label' => esc_html__( 'Icon', 'hello-plus' ), |
| 637 |
'type' => Controls_Manager::ICONS, |
| 638 |
'skin' => 'inline', |
| 639 |
'label_block' => false, |
| 640 |
] |
| 641 |
); |
| 642 |
|
| 643 |
$this->add_control( |
| 644 |
'button_css_id', |
| 645 |
[ |
| 646 |
'label' => esc_html__( 'Button ID', 'hello-plus' ), |
| 647 |
'type' => Controls_Manager::TEXT, |
| 648 |
'default' => '', |
| 649 |
'ai' => [ |
| 650 |
'active' => false, |
| 651 |
], |
| 652 |
'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'hello-plus' ), |
| 653 |
'description' => sprintf( |
| 654 |
/* translators: %1$s: Opening code tag, %2$s: Closing code tag. */ |
| 655 |
esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page. This field allows %1$sA-z 0-9%2$s & underscore chars without spaces.', 'hello-plus' ), |
| 656 |
'<code>', |
| 657 |
'</code>' |
| 658 |
), |
| 659 |
'separator' => 'before', |
| 660 |
'dynamic' => [ |
| 661 |
'active' => true, |
| 662 |
], |
| 663 |
] |
| 664 |
); |
| 665 |
|
| 666 |
$this->end_controls_section(); |
| 667 |
} |
| 668 |
|
| 669 |
protected function add_content_actions_after_submit_section(): void { |
| 670 |
$this->start_controls_section( |
| 671 |
'section_integration', |
| 672 |
[ |
| 673 |
'label' => esc_html__( 'Actions After Submit', 'hello-plus' ), |
| 674 |
] |
| 675 |
); |
| 676 |
|
| 677 |
$this->add_control( |
| 678 |
'should_redirect', |
| 679 |
[ |
| 680 |
'label' => esc_html__( 'Redirect To Thank You Page', 'hello-plus' ), |
| 681 |
'type' => Controls_Manager::SWITCHER, |
| 682 |
'label_on' => esc_html__( 'Yes', 'hello-plus' ), |
| 683 |
'label_off' => esc_html__( 'No', 'hello-plus' ), |
| 684 |
'return_value' => 'true', |
| 685 |
'default' => '', |
| 686 |
] |
| 687 |
); |
| 688 |
|
| 689 |
$this->add_control( |
| 690 |
'redirect_to', |
| 691 |
[ |
| 692 |
'label' => esc_html__( 'Redirect To', 'hello-plus' ), |
| 693 |
'type' => Controls_Manager::TEXT, |
| 694 |
'placeholder' => esc_html__( 'https://your-link.com', 'hello-plus' ), |
| 695 |
'ai' => [ |
| 696 |
'active' => false, |
| 697 |
], |
| 698 |
'dynamic' => [ |
| 699 |
'active' => true, |
| 700 |
'categories' => [ |
| 701 |
TagsModule::POST_META_CATEGORY, |
| 702 |
TagsModule::TEXT_CATEGORY, |
| 703 |
TagsModule::URL_CATEGORY, |
| 704 |
], |
| 705 |
], |
| 706 |
'label_block' => true, |
| 707 |
'render_type' => 'none', |
| 708 |
'classes' => 'elementor-control-direction-ltr', |
| 709 |
'condition' => [ |
| 710 |
'should_redirect' => 'true', |
| 711 |
], |
| 712 |
] |
| 713 |
); |
| 714 |
|
| 715 |
$this->add_control( |
| 716 |
'email_heading', |
| 717 |
[ |
| 718 |
'label' => esc_html__( 'Email Submissions', 'hello-plus' ), |
| 719 |
'type' => Controls_Manager::HEADING, |
| 720 |
'separator' => 'before', |
| 721 |
] |
| 722 |
); |
| 723 |
|
| 724 |
$this->add_control( |
| 725 |
'email_to', |
| 726 |
[ |
| 727 |
'label' => esc_html__( 'To', 'hello-plus' ), |
| 728 |
'type' => Controls_Manager::TEXT, |
| 729 |
'default' => get_option( 'admin_email' ), |
| 730 |
'ai' => [ |
| 731 |
'active' => false, |
| 732 |
], |
| 733 |
'placeholder' => get_option( 'admin_email' ), |
| 734 |
'label_block' => true, |
| 735 |
'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ), |
| 736 |
'render_type' => 'none', |
| 737 |
'dynamic' => [ |
| 738 |
'active' => true, |
| 739 |
], |
| 740 |
] |
| 741 |
); |
| 742 |
|
| 743 |
/* translators: %s: Site title. */ |
| 744 |
$default_message = sprintf( esc_html__( 'New message from [%s]', 'hello-plus' ), get_bloginfo( 'name' ) ); |
| 745 |
|
| 746 |
$this->add_control( |
| 747 |
'email_subject', |
| 748 |
[ |
| 749 |
'label' => esc_html__( 'Subject', 'hello-plus' ), |
| 750 |
'type' => Controls_Manager::TEXT, |
| 751 |
'default' => $default_message, |
| 752 |
'ai' => [ |
| 753 |
'active' => false, |
| 754 |
], |
| 755 |
'placeholder' => $default_message, |
| 756 |
'label_block' => true, |
| 757 |
'render_type' => 'none', |
| 758 |
'dynamic' => [ |
| 759 |
'active' => true, |
| 760 |
], |
| 761 |
] |
| 762 |
); |
| 763 |
|
| 764 |
$this->add_control( |
| 765 |
'email_content', |
| 766 |
[ |
| 767 |
'label' => esc_html__( 'Message', 'hello-plus' ), |
| 768 |
'type' => Controls_Manager::TEXTAREA, |
| 769 |
'default' => '[all-fields]', |
| 770 |
'ai' => [ |
| 771 |
'active' => false, |
| 772 |
], |
| 773 |
'placeholder' => '[all-fields]', |
| 774 |
'description' => sprintf( |
| 775 |
/* translators: %s: The [all-fields] shortcode. */ |
| 776 |
esc_html__( 'By default, all form fields are sent via %s shortcode. To customize sent fields, copy the shortcode that appears inside each field and paste it above.', 'hello-plus' ), |
| 777 |
'<code>[all-fields]</code>' |
| 778 |
), |
| 779 |
'render_type' => 'none', |
| 780 |
'dynamic' => [ |
| 781 |
'active' => true, |
| 782 |
], |
| 783 |
] |
| 784 |
); |
| 785 |
|
| 786 |
$site_domain = Module::get_site_domain(); |
| 787 |
|
| 788 |
$this->add_control( |
| 789 |
'email_from', |
| 790 |
[ |
| 791 |
'label' => esc_html__( 'From Email', 'hello-plus' ), |
| 792 |
'type' => Controls_Manager::TEXT, |
| 793 |
'default' => 'email@' . $site_domain, |
| 794 |
'ai' => [ |
| 795 |
'active' => false, |
| 796 |
], |
| 797 |
'render_type' => 'none', |
| 798 |
'dynamic' => [ |
| 799 |
'active' => true, |
| 800 |
], |
| 801 |
] |
| 802 |
); |
| 803 |
|
| 804 |
$this->add_control( |
| 805 |
'email_from_name', |
| 806 |
[ |
| 807 |
'label' => esc_html__( 'From Name', 'hello-plus' ), |
| 808 |
'type' => Controls_Manager::TEXT, |
| 809 |
'default' => get_bloginfo( 'name' ), |
| 810 |
'ai' => [ |
| 811 |
'active' => false, |
| 812 |
], |
| 813 |
'render_type' => 'none', |
| 814 |
'dynamic' => [ |
| 815 |
'active' => true, |
| 816 |
], |
| 817 |
] |
| 818 |
); |
| 819 |
|
| 820 |
$this->add_control( |
| 821 |
'email_reply_to', |
| 822 |
[ |
| 823 |
'label' => esc_html__( 'Reply-To', 'hello-plus' ), |
| 824 |
'type' => Controls_Manager::SELECT, |
| 825 |
'options' => [ |
| 826 |
'' => '', |
| 827 |
], |
| 828 |
'render_type' => 'none', |
| 829 |
] |
| 830 |
); |
| 831 |
|
| 832 |
$this->add_control( |
| 833 |
'email_to_cc', |
| 834 |
[ |
| 835 |
'label' => esc_html__( 'Cc', 'hello-plus' ), |
| 836 |
'type' => Controls_Manager::TEXT, |
| 837 |
'default' => '', |
| 838 |
'ai' => [ |
| 839 |
'active' => false, |
| 840 |
], |
| 841 |
'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ), |
| 842 |
'render_type' => 'none', |
| 843 |
'dynamic' => [ |
| 844 |
'active' => true, |
| 845 |
], |
| 846 |
] |
| 847 |
); |
| 848 |
|
| 849 |
$this->add_control( |
| 850 |
'email_to_bcc', |
| 851 |
[ |
| 852 |
'label' => esc_html__( 'Bcc', 'hello-plus' ), |
| 853 |
'type' => Controls_Manager::TEXT, |
| 854 |
'default' => '', |
| 855 |
'ai' => [ |
| 856 |
'active' => false, |
| 857 |
], |
| 858 |
'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ), |
| 859 |
'render_type' => 'none', |
| 860 |
'dynamic' => [ |
| 861 |
'active' => true, |
| 862 |
], |
| 863 |
] |
| 864 |
); |
| 865 |
|
| 866 |
$this->add_control( |
| 867 |
'form_metadata', |
| 868 |
[ |
| 869 |
'label' => esc_html__( 'Meta Data', 'hello-plus' ), |
| 870 |
'type' => Controls_Manager::SELECT2, |
| 871 |
'multiple' => true, |
| 872 |
'label_block' => true, |
| 873 |
'separator' => 'before', |
| 874 |
'default' => [ |
| 875 |
'date', |
| 876 |
'time', |
| 877 |
'page_url', |
| 878 |
'user_agent', |
| 879 |
'remote_ip', |
| 880 |
'credit', |
| 881 |
], |
| 882 |
'options' => [ |
| 883 |
'date' => esc_html__( 'Date', 'hello-plus' ), |
| 884 |
'time' => esc_html__( 'Time', 'hello-plus' ), |
| 885 |
'page_url' => esc_html__( 'Page URL', 'hello-plus' ), |
| 886 |
'user_agent' => esc_html__( 'User Agent', 'hello-plus' ), |
| 887 |
'remote_ip' => esc_html__( 'Remote IP', 'hello-plus' ), |
| 888 |
'credit' => esc_html__( 'Credit', 'hello-plus' ), |
| 889 |
], |
| 890 |
'render_type' => 'none', |
| 891 |
] |
| 892 |
); |
| 893 |
|
| 894 |
$this->add_control( |
| 895 |
'email_content_type', |
| 896 |
[ |
| 897 |
'label' => esc_html__( 'Send As', 'hello-plus' ), |
| 898 |
'type' => Controls_Manager::SELECT, |
| 899 |
'default' => 'html', |
| 900 |
'render_type' => 'none', |
| 901 |
'options' => [ |
| 902 |
'html' => esc_html__( 'HTML', 'hello-plus' ), |
| 903 |
'plain' => esc_html__( 'Plain', 'hello-plus' ), |
| 904 |
], |
| 905 |
] |
| 906 |
); |
| 907 |
|
| 908 |
$this->add_control( |
| 909 |
'submission_divider', |
| 910 |
[ |
| 911 |
'type' => Controls_Manager::DIVIDER, |
| 912 |
] |
| 913 |
); |
| 914 |
|
| 915 |
if ( ! Utils::are_submissions_enabled() ) { |
| 916 |
$this->add_control( |
| 917 |
'collect_submit_promotion', |
| 918 |
[ |
| 919 |
'label' => esc_html__( 'Collect Submissions', 'hello-plus' ), |
| 920 |
'type' => Promotion_Control::TYPE, |
| 921 |
] |
| 922 |
); |
| 923 |
} else { |
| 924 |
$this->add_control( |
| 925 |
'submit_actions', |
| 926 |
[ |
| 927 |
'label' => esc_html__( 'Save Submissions', 'hello-plus' ), |
| 928 |
'type' => Controls_Manager::SWITCHER, |
| 929 |
'label_on' => esc_html__( 'Yes', 'hello-plus' ), |
| 930 |
'label_off' => esc_html__( 'No', 'hello-plus' ), |
| 931 |
'return_value' => 'save-to-database', |
| 932 |
'default' => 'save-to-database', |
| 933 |
] |
| 934 |
); |
| 935 |
} |
| 936 |
|
| 937 |
$this->end_controls_section(); |
| 938 |
} |
| 939 |
|
| 940 |
protected function add_style_layout_section(): void { |
| 941 |
$this->start_controls_section( |
| 942 |
'section_layout_style', |
| 943 |
[ |
| 944 |
'label' => esc_html__( 'Layout', 'hello-plus' ), |
| 945 |
'tab' => Controls_Manager::TAB_STYLE, |
| 946 |
] |
| 947 |
); |
| 948 |
|
| 949 |
$ehp_column_structure = new Ehp_Column_Structure( $this, [ |
| 950 |
'condition' => [ |
| 951 |
'layout_preset' => [ |
| 952 |
'interact', |
| 953 |
'engage', |
| 954 |
], |
| 955 |
], |
| 956 |
] ); |
| 957 |
|
| 958 |
$ehp_column_structure->add_style_controls(); |
| 959 |
|
| 960 |
$this->add_responsive_control( |
| 961 |
'form_position', |
| 962 |
[ |
| 963 |
'label' => esc_html__( 'Form Position', 'hello-plus' ), |
| 964 |
'type' => Controls_Manager::CHOOSE, |
| 965 |
'toggle' => false, |
| 966 |
'options' => [ |
| 967 |
'start' => [ |
| 968 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 969 |
'icon' => 'eicon-h-align-' . ( is_rtl() ? 'right' : 'left' ), |
| 970 |
], |
| 971 |
'end' => [ |
| 972 |
'title' => esc_html__( 'End', 'hello-plus' ), |
| 973 |
'icon' => 'eicon-h-align-' . ( is_rtl() ? 'left' : 'right' ), |
| 974 |
], |
| 975 |
], |
| 976 |
'selectors' => [ |
| 977 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-order: var(--ehp-form-order-{{VALUE}}); --ehp-text-order: var(--ehp-text-order-{{VALUE}});', |
| 978 |
], |
| 979 |
'default' => 'end', |
| 980 |
'condition' => [ |
| 981 |
'layout_preset' => [ |
| 982 |
'interact', |
| 983 |
'engage', |
| 984 |
], |
| 985 |
], |
| 986 |
'separator' => 'before', |
| 987 |
] |
| 988 |
); |
| 989 |
|
| 990 |
$this->add_control( |
| 991 |
'content_alignment', |
| 992 |
[ |
| 993 |
'label' => esc_html__( 'Content Alignment', 'hello-plus' ), |
| 994 |
'type' => Controls_Manager::CHOOSE, |
| 995 |
'options' => [ |
| 996 |
'start' => [ |
| 997 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 998 |
'icon' => 'eicon-align-start-v', |
| 999 |
], |
| 1000 |
'center' => [ |
| 1001 |
'title' => esc_html__( 'Center', 'hello-plus' ), |
| 1002 |
'icon' => 'eicon-align-center-v', |
| 1003 |
], |
| 1004 |
'end' => [ |
| 1005 |
'title' => esc_html__( 'End', 'hello-plus' ), |
| 1006 |
'icon' => 'eicon-align-end-v', |
| 1007 |
], |
| 1008 |
], |
| 1009 |
'default' => 'start', |
| 1010 |
'frontend_available' => true, |
| 1011 |
'selectors' => [ |
| 1012 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-content-alignment: {{VALUE}};', |
| 1013 |
], |
| 1014 |
'condition' => [ |
| 1015 |
'layout_preset' => [ |
| 1016 |
'interact', |
| 1017 |
'engage', |
| 1018 |
], |
| 1019 |
], |
| 1020 |
] |
| 1021 |
); |
| 1022 |
|
| 1023 |
$this->add_responsive_control( |
| 1024 |
'content_position', |
| 1025 |
[ |
| 1026 |
'label' => esc_html__( 'Content Position', 'hello-plus' ), |
| 1027 |
'type' => Controls_Manager::CHOOSE, |
| 1028 |
'toggle' => false, |
| 1029 |
'options' => [ |
| 1030 |
'start' => [ |
| 1031 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 1032 |
'icon' => 'eicon-h-align-' . ( is_rtl() ? 'right' : 'left' ), |
| 1033 |
], |
| 1034 |
'center' => [ |
| 1035 |
'title' => esc_html__( 'Center', 'hello-plus' ), |
| 1036 |
'icon' => 'eicon-h-align-center', |
| 1037 |
], |
| 1038 |
], |
| 1039 |
'selectors' => [ |
| 1040 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-content-position: {{VALUE}};', |
| 1041 |
], |
| 1042 |
'default' => 'center', |
| 1043 |
'tablet_default' => 'center', |
| 1044 |
'mobile_default' => 'center', |
| 1045 |
'condition' => [ |
| 1046 |
'layout_preset' => 'quick-connect', |
| 1047 |
], |
| 1048 |
] |
| 1049 |
); |
| 1050 |
|
| 1051 |
$this->add_responsive_control( |
| 1052 |
'text_align', |
| 1053 |
[ |
| 1054 |
'label' => esc_html__( 'Content Alignment', 'hello-plus' ), |
| 1055 |
'type' => Controls_Manager::CHOOSE, |
| 1056 |
'options' => [ |
| 1057 |
'flex-start' => [ |
| 1058 |
'title' => esc_html__( 'Left', 'hello-plus' ), |
| 1059 |
'icon' => 'eicon-text-align-left', |
| 1060 |
], |
| 1061 |
'center' => [ |
| 1062 |
'title' => esc_html__( 'Center', 'hello-plus' ), |
| 1063 |
'icon' => 'eicon-text-align-center', |
| 1064 |
], |
| 1065 |
'flex-end' => [ |
| 1066 |
'title' => esc_html__( 'Right', 'hello-plus' ), |
| 1067 |
'icon' => 'eicon-text-align-right', |
| 1068 |
], |
| 1069 |
], |
| 1070 |
'default' => 'center', |
| 1071 |
'conditions' => [ |
| 1072 |
'relation' => 'and', |
| 1073 |
'terms' => [ |
| 1074 |
[ |
| 1075 |
'name' => 'layout_preset', |
| 1076 |
'operator' => '==', |
| 1077 |
'value' => 'quick-connect', |
| 1078 |
], |
| 1079 |
[ |
| 1080 |
'name' => 'content_position', |
| 1081 |
'operator' => '==', |
| 1082 |
'value' => 'center', |
| 1083 |
], |
| 1084 |
], |
| 1085 |
], |
| 1086 |
'selectors' => [ |
| 1087 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-text-container-align: {{VALUE}};', |
| 1088 |
], |
| 1089 |
] |
| 1090 |
); |
| 1091 |
|
| 1092 |
$this->add_responsive_control( |
| 1093 |
'content_width', |
| 1094 |
[ |
| 1095 |
'label' => esc_html__( 'Content Width', 'hello-plus' ), |
| 1096 |
'type' => Controls_Manager::SLIDER, |
| 1097 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 1098 |
'range' => [ |
| 1099 |
'px' => [ |
| 1100 |
'max' => 1600, |
| 1101 |
], |
| 1102 |
'%' => [ |
| 1103 |
'max' => 100, |
| 1104 |
], |
| 1105 |
], |
| 1106 |
'default' => [ |
| 1107 |
'size' => 640, |
| 1108 |
'unit' => 'px', |
| 1109 |
], |
| 1110 |
'tablet_default' => [ |
| 1111 |
'size' => 640, |
| 1112 |
'unit' => 'px', |
| 1113 |
], |
| 1114 |
'mobile_default' => [ |
| 1115 |
'size' => 320, |
| 1116 |
'unit' => 'px', |
| 1117 |
], |
| 1118 |
'selectors' => [ |
| 1119 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-content-width: {{SIZE}}{{UNIT}};', |
| 1120 |
], |
| 1121 |
'condition' => [ |
| 1122 |
'layout_preset' => 'quick-connect', |
| 1123 |
], |
| 1124 |
] |
| 1125 |
); |
| 1126 |
|
| 1127 |
$this->end_controls_section(); |
| 1128 |
} |
| 1129 |
|
| 1130 |
protected function add_content_additional_options_section(): void { |
| 1131 |
$this->start_controls_section( |
| 1132 |
'section_form_options', |
| 1133 |
[ |
| 1134 |
'label' => esc_html__( 'Additional Options', 'hello-plus' ), |
| 1135 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 1136 |
] |
| 1137 |
); |
| 1138 |
|
| 1139 |
$this->add_control( |
| 1140 |
'form_id', |
| 1141 |
[ |
| 1142 |
'label' => esc_html__( 'Form ID', 'hello-plus' ), |
| 1143 |
'type' => Controls_Manager::TEXT, |
| 1144 |
'ai' => [ |
| 1145 |
'active' => false, |
| 1146 |
], |
| 1147 |
'placeholder' => 'new_form_id', |
| 1148 |
'description' => sprintf( |
| 1149 |
/* translators: %1$s: Opening code tag, %2$s: Closing code tag. */ |
| 1150 |
esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page. This field allows %1$sA-z 0-9%2$s & underscore chars without spaces.', 'hello-plus' ), |
| 1151 |
'<code>', |
| 1152 |
'</code>' |
| 1153 |
), |
| 1154 |
'separator' => 'after', |
| 1155 |
'dynamic' => [ |
| 1156 |
'active' => true, |
| 1157 |
], |
| 1158 |
] |
| 1159 |
); |
| 1160 |
|
| 1161 |
$this->add_control( |
| 1162 |
'custom_messages', |
| 1163 |
[ |
| 1164 |
'label' => esc_html__( 'Custom Messages', 'hello-plus' ), |
| 1165 |
'type' => Controls_Manager::SWITCHER, |
| 1166 |
'default' => '', |
| 1167 |
'separator' => 'before', |
| 1168 |
'render_type' => 'none', |
| 1169 |
] |
| 1170 |
); |
| 1171 |
|
| 1172 |
$default_messages = Ajax_Handler::get_default_messages(); |
| 1173 |
|
| 1174 |
$this->add_control( |
| 1175 |
'success_message', |
| 1176 |
[ |
| 1177 |
'label' => esc_html__( 'Success Message', 'hello-plus' ), |
| 1178 |
'type' => Controls_Manager::TEXT, |
| 1179 |
'default' => $default_messages[ Ajax_Handler::SUCCESS ], |
| 1180 |
'placeholder' => $default_messages[ Ajax_Handler::SUCCESS ], |
| 1181 |
'label_block' => true, |
| 1182 |
'condition' => [ |
| 1183 |
'custom_messages!' => '', |
| 1184 |
], |
| 1185 |
'render_type' => 'none', |
| 1186 |
'dynamic' => [ |
| 1187 |
'active' => true, |
| 1188 |
], |
| 1189 |
] |
| 1190 |
); |
| 1191 |
|
| 1192 |
$this->add_control( |
| 1193 |
'error_message', |
| 1194 |
[ |
| 1195 |
'label' => esc_html__( 'Form Error', 'hello-plus' ), |
| 1196 |
'type' => Controls_Manager::TEXT, |
| 1197 |
'default' => $default_messages[ Ajax_Handler::ERROR ], |
| 1198 |
'placeholder' => $default_messages[ Ajax_Handler::ERROR ], |
| 1199 |
'label_block' => true, |
| 1200 |
'condition' => [ |
| 1201 |
'custom_messages!' => '', |
| 1202 |
], |
| 1203 |
'render_type' => 'none', |
| 1204 |
'dynamic' => [ |
| 1205 |
'active' => true, |
| 1206 |
], |
| 1207 |
] |
| 1208 |
); |
| 1209 |
|
| 1210 |
$this->add_control( |
| 1211 |
'server_message', |
| 1212 |
[ |
| 1213 |
'label' => esc_html__( 'Server Error', 'hello-plus' ), |
| 1214 |
'type' => Controls_Manager::TEXT, |
| 1215 |
'default' => $default_messages[ Ajax_Handler::SERVER_ERROR ], |
| 1216 |
'placeholder' => $default_messages[ Ajax_Handler::SERVER_ERROR ], |
| 1217 |
'label_block' => true, |
| 1218 |
'condition' => [ |
| 1219 |
'custom_messages!' => '', |
| 1220 |
], |
| 1221 |
'render_type' => 'none', |
| 1222 |
'dynamic' => [ |
| 1223 |
'active' => true, |
| 1224 |
], |
| 1225 |
] |
| 1226 |
); |
| 1227 |
|
| 1228 |
$this->add_control( |
| 1229 |
'invalid_message', |
| 1230 |
[ |
| 1231 |
'label' => esc_html__( 'Invalid Form', 'hello-plus' ), |
| 1232 |
'type' => Controls_Manager::TEXT, |
| 1233 |
'default' => $default_messages[ Ajax_Handler::INVALID_FORM ], |
| 1234 |
'placeholder' => $default_messages[ Ajax_Handler::INVALID_FORM ], |
| 1235 |
'label_block' => true, |
| 1236 |
'condition' => [ |
| 1237 |
'custom_messages!' => '', |
| 1238 |
], |
| 1239 |
'render_type' => 'none', |
| 1240 |
'dynamic' => [ |
| 1241 |
'active' => true, |
| 1242 |
], |
| 1243 |
] |
| 1244 |
); |
| 1245 |
|
| 1246 |
$this->end_controls_section(); |
| 1247 |
} |
| 1248 |
|
| 1249 |
protected function add_style_text_section(): void { |
| 1250 |
$this->start_controls_section( |
| 1251 |
'section_text_style', |
| 1252 |
[ |
| 1253 |
'label' => esc_html__( 'Text', 'hello-plus' ), |
| 1254 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1255 |
] |
| 1256 |
); |
| 1257 |
|
| 1258 |
$this->add_control( |
| 1259 |
'heading_text', |
| 1260 |
[ |
| 1261 |
'label' => esc_html__( 'Heading', 'hello-plus' ), |
| 1262 |
'type' => Controls_Manager::HEADING, |
| 1263 |
] |
| 1264 |
); |
| 1265 |
|
| 1266 |
$this->add_control( |
| 1267 |
'heading_color', |
| 1268 |
[ |
| 1269 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1270 |
'type' => Controls_Manager::COLOR, |
| 1271 |
'selectors' => [ |
| 1272 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-heading-color: {{VALUE}};', |
| 1273 |
], |
| 1274 |
'global' => [ |
| 1275 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 1276 |
], |
| 1277 |
] |
| 1278 |
); |
| 1279 |
|
| 1280 |
$this->add_group_control( |
| 1281 |
Group_Control_Typography::get_type(), |
| 1282 |
[ |
| 1283 |
'name' => 'heading_typography', |
| 1284 |
'selector' => '{{WRAPPER}} .ehp-form__heading', |
| 1285 |
'global' => [ |
| 1286 |
'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1287 |
], |
| 1288 |
] |
| 1289 |
); |
| 1290 |
|
| 1291 |
$this->add_control( |
| 1292 |
'heading_description', |
| 1293 |
[ |
| 1294 |
'label' => esc_html__( 'Description', 'hello-plus' ), |
| 1295 |
'type' => Controls_Manager::HEADING, |
| 1296 |
] |
| 1297 |
); |
| 1298 |
|
| 1299 |
$this->add_control( |
| 1300 |
'description_color', |
| 1301 |
[ |
| 1302 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1303 |
'type' => Controls_Manager::COLOR, |
| 1304 |
'selectors' => [ |
| 1305 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-description-color: {{VALUE}};', |
| 1306 |
], |
| 1307 |
'global' => [ |
| 1308 |
'default' => Global_Colors::COLOR_TEXT, |
| 1309 |
], |
| 1310 |
] |
| 1311 |
); |
| 1312 |
|
| 1313 |
$this->add_group_control( |
| 1314 |
Group_Control_Typography::get_type(), |
| 1315 |
[ |
| 1316 |
'name' => 'description_typography', |
| 1317 |
'selector' => '{{WRAPPER}} .ehp-form__description', |
| 1318 |
'global' => [ |
| 1319 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 1320 |
], |
| 1321 |
] |
| 1322 |
); |
| 1323 |
|
| 1324 |
$this->add_responsive_control( |
| 1325 |
'text_spacing', |
| 1326 |
[ |
| 1327 |
'label' => esc_html__( 'Spacing', 'hello-plus' ), |
| 1328 |
'type' => Controls_Manager::SLIDER, |
| 1329 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 1330 |
'range' => [ |
| 1331 |
'px' => [ |
| 1332 |
'max' => 100, |
| 1333 |
], |
| 1334 |
'%' => [ |
| 1335 |
'max' => 100, |
| 1336 |
], |
| 1337 |
], |
| 1338 |
'default' => [ |
| 1339 |
'size' => 20, |
| 1340 |
'unit' => 'px', |
| 1341 |
], |
| 1342 |
'tablet_default' => [ |
| 1343 |
'size' => 20, |
| 1344 |
'unit' => 'px', |
| 1345 |
], |
| 1346 |
'mobile_default' => [ |
| 1347 |
'size' => 20, |
| 1348 |
'unit' => 'px', |
| 1349 |
], |
| 1350 |
'selectors' => [ |
| 1351 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-text-spacing: {{SIZE}}{{UNIT}};', |
| 1352 |
], |
| 1353 |
] |
| 1354 |
); |
| 1355 |
|
| 1356 |
$this->end_controls_section(); |
| 1357 |
} |
| 1358 |
|
| 1359 |
protected function add_style_image_section() { |
| 1360 |
$this->start_controls_section( |
| 1361 |
'style_image', |
| 1362 |
[ |
| 1363 |
'label' => esc_html__( 'Image', 'hello-plus' ), |
| 1364 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1365 |
'condition' => [ |
| 1366 |
'layout_preset' => 'engage', |
| 1367 |
], |
| 1368 |
] |
| 1369 |
); |
| 1370 |
|
| 1371 |
$image = new Ehp_Image( $this, [ 'widget_name' => 'form' ] ); |
| 1372 |
$image->add_style_controls(); |
| 1373 |
|
| 1374 |
$this->end_controls_section(); |
| 1375 |
} |
| 1376 |
|
| 1377 |
protected function add_style_form_section(): void { |
| 1378 |
$this->start_controls_section( |
| 1379 |
'section_form_style', |
| 1380 |
[ |
| 1381 |
'label' => esc_html__( 'Form', 'hello-plus' ), |
| 1382 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1383 |
] |
| 1384 |
); |
| 1385 |
|
| 1386 |
$this->add_control( |
| 1387 |
'column_gap', |
| 1388 |
[ |
| 1389 |
'label' => esc_html__( 'Columns Gap', 'hello-plus' ), |
| 1390 |
'type' => Controls_Manager::SLIDER, |
| 1391 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1392 |
'default' => [ |
| 1393 |
'size' => 32, |
| 1394 |
'unit' => 'px', |
| 1395 |
], |
| 1396 |
'range' => [ |
| 1397 |
'px' => [ |
| 1398 |
'max' => 60, |
| 1399 |
], |
| 1400 |
'em' => [ |
| 1401 |
'max' => 6, |
| 1402 |
], |
| 1403 |
'rem' => [ |
| 1404 |
'max' => 6, |
| 1405 |
], |
| 1406 |
], |
| 1407 |
'selectors' => [ |
| 1408 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-column-gap: {{SIZE}}{{UNIT}};', |
| 1409 |
], |
| 1410 |
] |
| 1411 |
); |
| 1412 |
|
| 1413 |
$this->add_control( |
| 1414 |
'row_gap', |
| 1415 |
[ |
| 1416 |
'label' => esc_html__( 'Rows Gap', 'hello-plus' ), |
| 1417 |
'type' => Controls_Manager::SLIDER, |
| 1418 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1419 |
'default' => [ |
| 1420 |
'size' => 32, |
| 1421 |
'unit' => 'px', |
| 1422 |
], |
| 1423 |
'range' => [ |
| 1424 |
'px' => [ |
| 1425 |
'max' => 60, |
| 1426 |
], |
| 1427 |
'em' => [ |
| 1428 |
'max' => 6, |
| 1429 |
], |
| 1430 |
'rem' => [ |
| 1431 |
'max' => 6, |
| 1432 |
], |
| 1433 |
], |
| 1434 |
'selectors' => [ |
| 1435 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-row-gap: {{SIZE}}{{UNIT}};', |
| 1436 |
], |
| 1437 |
] |
| 1438 |
); |
| 1439 |
|
| 1440 |
$this->add_control( |
| 1441 |
'heading_label', |
| 1442 |
[ |
| 1443 |
'label' => esc_html__( 'Label', 'hello-plus' ), |
| 1444 |
'type' => Controls_Manager::HEADING, |
| 1445 |
'separator' => 'before', |
| 1446 |
] |
| 1447 |
); |
| 1448 |
|
| 1449 |
$this->add_control( |
| 1450 |
'label_spacing', |
| 1451 |
[ |
| 1452 |
'label' => esc_html__( 'Spacing', 'hello-plus' ), |
| 1453 |
'type' => Controls_Manager::SLIDER, |
| 1454 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1455 |
'default' => [ |
| 1456 |
'size' => 0, |
| 1457 |
'unit' => 'px', |
| 1458 |
], |
| 1459 |
'range' => [ |
| 1460 |
'px' => [ |
| 1461 |
'max' => 60, |
| 1462 |
], |
| 1463 |
'em' => [ |
| 1464 |
'max' => 6, |
| 1465 |
], |
| 1466 |
'rem' => [ |
| 1467 |
'max' => 6, |
| 1468 |
], |
| 1469 |
], |
| 1470 |
'selectors' => [ |
| 1471 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-label-spacing: {{SIZE}}{{UNIT}};', |
| 1472 |
], |
| 1473 |
] |
| 1474 |
); |
| 1475 |
|
| 1476 |
$this->add_control( |
| 1477 |
'label_color', |
| 1478 |
[ |
| 1479 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1480 |
'type' => Controls_Manager::COLOR, |
| 1481 |
'selectors' => [ |
| 1482 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-label-color: {{VALUE}};', |
| 1483 |
], |
| 1484 |
'global' => [ |
| 1485 |
'default' => Global_Colors::COLOR_TEXT, |
| 1486 |
], |
| 1487 |
] |
| 1488 |
); |
| 1489 |
|
| 1490 |
$this->add_control( |
| 1491 |
'mark_required_color', |
| 1492 |
[ |
| 1493 |
'label' => esc_html__( 'Mark Color', 'hello-plus' ), |
| 1494 |
'type' => Controls_Manager::COLOR, |
| 1495 |
'default' => '#FF0000', |
| 1496 |
'selectors' => [ |
| 1497 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-mark-color: {{VALUE}};', |
| 1498 |
], |
| 1499 |
'condition' => [ |
| 1500 |
'mark_required' => 'yes', |
| 1501 |
], |
| 1502 |
] |
| 1503 |
); |
| 1504 |
|
| 1505 |
$this->add_group_control( |
| 1506 |
Group_Control_Typography::get_type(), |
| 1507 |
[ |
| 1508 |
'name' => 'label_typography', |
| 1509 |
'selector' => '{{WRAPPER}} .ehp-form__field-label', |
| 1510 |
'global' => [ |
| 1511 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 1512 |
], |
| 1513 |
] |
| 1514 |
); |
| 1515 |
|
| 1516 |
$this->end_controls_section(); |
| 1517 |
} |
| 1518 |
|
| 1519 |
protected function add_style_fields_section(): void { |
| 1520 |
$this->start_controls_section( |
| 1521 |
'section_field_style', |
| 1522 |
[ |
| 1523 |
'label' => esc_html__( 'Fields', 'hello-plus' ), |
| 1524 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1525 |
] |
| 1526 |
); |
| 1527 |
|
| 1528 |
$this->add_control( |
| 1529 |
'input_size', |
| 1530 |
[ |
| 1531 |
'label' => esc_html__( 'Input Size', 'hello-plus' ), |
| 1532 |
'type' => Controls_Manager::SELECT, |
| 1533 |
'options' => [ |
| 1534 |
'xs' => esc_html__( 'Extra Small', 'hello-plus' ), |
| 1535 |
'sm' => esc_html__( 'Small', 'hello-plus' ), |
| 1536 |
'md' => esc_html__( 'Medium', 'hello-plus' ), |
| 1537 |
'lg' => esc_html__( 'Large', 'hello-plus' ), |
| 1538 |
'xl' => esc_html__( 'Extra Large', 'hello-plus' ), |
| 1539 |
], |
| 1540 |
'default' => 'sm', |
| 1541 |
'separator' => 'after', |
| 1542 |
] |
| 1543 |
); |
| 1544 |
|
| 1545 |
$this->add_control( |
| 1546 |
'field_text_color', |
| 1547 |
[ |
| 1548 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1549 |
'type' => Controls_Manager::COLOR, |
| 1550 |
'selectors' => [ |
| 1551 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-field-text-color: {{VALUE}};', |
| 1552 |
], |
| 1553 |
'global' => [ |
| 1554 |
'default' => Global_Colors::COLOR_TEXT, |
| 1555 |
], |
| 1556 |
] |
| 1557 |
); |
| 1558 |
|
| 1559 |
$this->add_group_control( |
| 1560 |
Group_Control_Typography::get_type(), |
| 1561 |
[ |
| 1562 |
'name' => 'field_typography', |
| 1563 |
'selector' => '{{WRAPPER}} .ehp-form__field, {{WRAPPER}} .ehp-form__field::placeholder', |
| 1564 |
'global' => [ |
| 1565 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 1566 |
], |
| 1567 |
] |
| 1568 |
); |
| 1569 |
|
| 1570 |
$this->add_control( |
| 1571 |
'field_background_color', |
| 1572 |
[ |
| 1573 |
'label' => esc_html__( 'Background Color', 'hello-plus' ), |
| 1574 |
'type' => Controls_Manager::COLOR, |
| 1575 |
'default' => '#ffffff', |
| 1576 |
'selectors' => [ |
| 1577 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-field-bg-color: {{VALUE}};', |
| 1578 |
], |
| 1579 |
'separator' => 'before', |
| 1580 |
] |
| 1581 |
); |
| 1582 |
|
| 1583 |
$this->add_control( |
| 1584 |
'field_border_switcher', |
| 1585 |
[ |
| 1586 |
'label' => esc_html__( 'Border', 'hello-plus' ), |
| 1587 |
'type' => Controls_Manager::SWITCHER, |
| 1588 |
'options' => [ |
| 1589 |
'yes' => esc_html__( 'Yes', 'hello-plus' ), |
| 1590 |
'no' => esc_html__( 'No', 'hello-plus' ), |
| 1591 |
], |
| 1592 |
'default' => 'yes', |
| 1593 |
'separator' => 'before', |
| 1594 |
] |
| 1595 |
); |
| 1596 |
|
| 1597 |
$this->add_control( |
| 1598 |
'field_border_width', |
| 1599 |
[ |
| 1600 |
'label' => esc_html__( 'Border Width', 'hello-plus' ), |
| 1601 |
'type' => Controls_Manager::SLIDER, |
| 1602 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1603 |
'range' => [ |
| 1604 |
'px' => [ |
| 1605 |
'max' => 100, |
| 1606 |
], |
| 1607 |
'em' => [ |
| 1608 |
'max' => 10, |
| 1609 |
], |
| 1610 |
'rem' => [ |
| 1611 |
'max' => 10, |
| 1612 |
], |
| 1613 |
], |
| 1614 |
'default' => [ |
| 1615 |
'size' => 2, |
| 1616 |
'unit' => 'px', |
| 1617 |
], |
| 1618 |
'selectors' => [ |
| 1619 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-field-border-width: {{SIZE}}{{UNIT}};', |
| 1620 |
], |
| 1621 |
'condition' => [ |
| 1622 |
'field_border_switcher' => 'yes', |
| 1623 |
], |
| 1624 |
] |
| 1625 |
); |
| 1626 |
|
| 1627 |
$this->add_control( |
| 1628 |
'field_border_color', |
| 1629 |
[ |
| 1630 |
'label' => esc_html__( 'Border Color', 'hello-plus' ), |
| 1631 |
'type' => Controls_Manager::COLOR, |
| 1632 |
'selectors' => [ |
| 1633 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-field-border-color: {{VALUE}};', |
| 1634 |
], |
| 1635 |
'global' => [ |
| 1636 |
'default' => Global_Colors::COLOR_SECONDARY, |
| 1637 |
], |
| 1638 |
'separator' => 'before', |
| 1639 |
'condition' => [ |
| 1640 |
'field_border_switcher' => 'yes', |
| 1641 |
], |
| 1642 |
] |
| 1643 |
); |
| 1644 |
|
| 1645 |
$this->add_control( |
| 1646 |
'fields_shape', |
| 1647 |
[ |
| 1648 |
'label' => esc_html__( 'Shape', 'hello-plus' ), |
| 1649 |
'type' => Controls_Manager::SELECT, |
| 1650 |
'options' => [ |
| 1651 |
'default' => 'Default', |
| 1652 |
'sharp' => 'Sharp', |
| 1653 |
'rounded' => 'Rounded', |
| 1654 |
'round' => 'Round', |
| 1655 |
], |
| 1656 |
'default' => 'default', |
| 1657 |
] |
| 1658 |
); |
| 1659 |
|
| 1660 |
$this->end_controls_section(); |
| 1661 |
} |
| 1662 |
|
| 1663 |
protected function add_style_buttons_section(): void { |
| 1664 |
$this->start_controls_section( |
| 1665 |
'section_button_style', |
| 1666 |
[ |
| 1667 |
'label' => esc_html__( 'Button', 'hello-plus' ), |
| 1668 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1669 |
] |
| 1670 |
); |
| 1671 |
|
| 1672 |
$this->add_control( |
| 1673 |
'button_type', |
| 1674 |
[ |
| 1675 |
'label' => esc_html__( 'Type', 'hello-plus' ), |
| 1676 |
'type' => Controls_Manager::SELECT, |
| 1677 |
'options' => [ |
| 1678 |
'button' => esc_html__( 'Button', 'hello-plus' ), |
| 1679 |
'link' => esc_html__( 'Link', 'hello-plus' ), |
| 1680 |
], |
| 1681 |
'default' => 'button', |
| 1682 |
] |
| 1683 |
); |
| 1684 |
|
| 1685 |
$this->add_responsive_control( |
| 1686 |
'button_align', |
| 1687 |
[ |
| 1688 |
'label' => esc_html__( 'Position', 'hello-plus' ), |
| 1689 |
'type' => Controls_Manager::CHOOSE, |
| 1690 |
'options' => [ |
| 1691 |
'flex-start' => [ |
| 1692 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 1693 |
'icon' => 'eicon-h-align-left', |
| 1694 |
], |
| 1695 |
'center' => [ |
| 1696 |
'title' => esc_html__( 'Center', 'hello-plus' ), |
| 1697 |
'icon' => 'eicon-h-align-center', |
| 1698 |
], |
| 1699 |
'flex-end' => [ |
| 1700 |
'title' => esc_html__( 'End', 'hello-plus' ), |
| 1701 |
'icon' => 'eicon-h-align-right', |
| 1702 |
], |
| 1703 |
], |
| 1704 |
'default' => 'center', |
| 1705 |
'condition' => [ |
| 1706 |
'button_width!' => '100', |
| 1707 |
], |
| 1708 |
] |
| 1709 |
); |
| 1710 |
|
| 1711 |
$this->add_group_control( |
| 1712 |
Group_Control_Typography::get_type(), |
| 1713 |
[ |
| 1714 |
'name' => 'button_typography', |
| 1715 |
'global' => [ |
| 1716 |
'default' => Global_Typography::TYPOGRAPHY_ACCENT, |
| 1717 |
], |
| 1718 |
'selector' => '{{WRAPPER}} .ehp-form__button', |
| 1719 |
] |
| 1720 |
); |
| 1721 |
|
| 1722 |
$start = is_rtl() ? 'right' : 'left'; |
| 1723 |
$end = is_rtl() ? 'left' : 'right'; |
| 1724 |
|
| 1725 |
$this->add_control( |
| 1726 |
'button_icon_align', |
| 1727 |
[ |
| 1728 |
'label' => esc_html__( 'Icon Position', 'hello-plus' ), |
| 1729 |
'type' => Controls_Manager::CHOOSE, |
| 1730 |
'default' => is_rtl() ? 'row-reverse' : 'row', |
| 1731 |
'options' => [ |
| 1732 |
'row' => [ |
| 1733 |
'title' => esc_html__( 'Start', 'hello-plus' ), |
| 1734 |
'icon' => "eicon-h-align-{$start}", |
| 1735 |
], |
| 1736 |
'row-reverse' => [ |
| 1737 |
'title' => esc_html__( 'End', 'hello-plus' ), |
| 1738 |
'icon' => "eicon-h-align-{$end}", |
| 1739 |
], |
| 1740 |
], |
| 1741 |
'selectors_dictionary' => [ |
| 1742 |
'left' => is_rtl() ? 'row-reverse' : 'row', |
| 1743 |
'right' => is_rtl() ? 'row' : 'row-reverse', |
| 1744 |
], |
| 1745 |
'selectors' => [ |
| 1746 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-button-icon-position: {{VALUE}};', |
| 1747 |
], |
| 1748 |
'condition' => [ |
| 1749 |
'selected_button_icon[value]!' => '', |
| 1750 |
], |
| 1751 |
] |
| 1752 |
); |
| 1753 |
|
| 1754 |
$this->add_control( |
| 1755 |
'button_icon_indent', |
| 1756 |
[ |
| 1757 |
'label' => esc_html__( 'Icon Spacing', 'hello-plus' ), |
| 1758 |
'type' => Controls_Manager::SLIDER, |
| 1759 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1760 |
'range' => [ |
| 1761 |
'px' => [ |
| 1762 |
'max' => 100, |
| 1763 |
], |
| 1764 |
'em' => [ |
| 1765 |
'max' => 10, |
| 1766 |
], |
| 1767 |
'rem' => [ |
| 1768 |
'max' => 10, |
| 1769 |
], |
| 1770 |
], |
| 1771 |
'default' => [ |
| 1772 |
'size' => 8, |
| 1773 |
'unit' => 'px', |
| 1774 |
], |
| 1775 |
'condition' => [ |
| 1776 |
'selected_button_icon[value]!' => '', |
| 1777 |
], |
| 1778 |
'selectors' => [ |
| 1779 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-button-icon-spacing: {{SIZE}}{{UNIT}};', |
| 1780 |
], |
| 1781 |
] |
| 1782 |
); |
| 1783 |
|
| 1784 |
$this->start_controls_tabs( 'tabs_button_style' ); |
| 1785 |
|
| 1786 |
$this->start_controls_tab( |
| 1787 |
'tab_button_normal', |
| 1788 |
[ |
| 1789 |
'label' => esc_html__( 'Normal', 'hello-plus' ), |
| 1790 |
] |
| 1791 |
); |
| 1792 |
|
| 1793 |
$this->add_control( |
| 1794 |
'button_text_color', |
| 1795 |
[ |
| 1796 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1797 |
'type' => Controls_Manager::COLOR, |
| 1798 |
'global' => [ |
| 1799 |
'default' => Global_Colors::COLOR_SECONDARY, |
| 1800 |
], |
| 1801 |
'selectors' => [ |
| 1802 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-button-text-color: {{VALUE}};', |
| 1803 |
], |
| 1804 |
] |
| 1805 |
); |
| 1806 |
|
| 1807 |
$this->add_group_control( |
| 1808 |
Group_Control_Background::get_type(), |
| 1809 |
[ |
| 1810 |
'name' => 'button_background', |
| 1811 |
'types' => [ 'classic', 'gradient' ], |
| 1812 |
'exclude' => [ 'image' ], |
| 1813 |
'selector' => '{{WRAPPER}} .is-type-button.ehp-form__button', |
| 1814 |
'fields_options' => [ |
| 1815 |
'background' => [ |
| 1816 |
'default' => 'classic', |
| 1817 |
], |
| 1818 |
'color' => [ |
| 1819 |
'global' => [ |
| 1820 |
'default' => Global_Colors::COLOR_ACCENT, |
| 1821 |
], |
| 1822 |
], |
| 1823 |
], |
| 1824 |
'condition' => [ |
| 1825 |
'button_type' => 'button', |
| 1826 |
], |
| 1827 |
] |
| 1828 |
); |
| 1829 |
|
| 1830 |
$this->end_controls_tab(); |
| 1831 |
|
| 1832 |
$this->start_controls_tab( |
| 1833 |
'tab_button_hover', |
| 1834 |
[ |
| 1835 |
'label' => esc_html__( 'Hover', 'hello-plus' ), |
| 1836 |
] |
| 1837 |
); |
| 1838 |
|
| 1839 |
$this->add_control( |
| 1840 |
'button_text_color_hover', |
| 1841 |
[ |
| 1842 |
'label' => esc_html__( 'Text Color', 'hello-plus' ), |
| 1843 |
'type' => Controls_Manager::COLOR, |
| 1844 |
'global' => [ |
| 1845 |
'default' => Global_Colors::COLOR_TEXT, |
| 1846 |
], |
| 1847 |
'selectors' => [ |
| 1848 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-button-text-color-hover: {{VALUE}};', |
| 1849 |
], |
| 1850 |
] |
| 1851 |
); |
| 1852 |
|
| 1853 |
$this->add_group_control( |
| 1854 |
Group_Control_Background::get_type(), |
| 1855 |
[ |
| 1856 |
'name' => 'button_background_hover', |
| 1857 |
'types' => [ 'classic', 'gradient' ], |
| 1858 |
'exclude' => [ 'image' ], |
| 1859 |
'selector' => '{{WRAPPER}} .is-type-button.ehp-form__button:hover, {{WRAPPER}} .is-type-button.ehp-form__button:focus', |
| 1860 |
'fields_options' => [ |
| 1861 |
'background' => [ |
| 1862 |
'default' => 'classic', |
| 1863 |
], |
| 1864 |
'color' => [ |
| 1865 |
'global' => [ |
| 1866 |
'default' => Global_Colors::COLOR_ACCENT, |
| 1867 |
], |
| 1868 |
], |
| 1869 |
], |
| 1870 |
'condition' => [ |
| 1871 |
'button_type' => 'button', |
| 1872 |
], |
| 1873 |
] |
| 1874 |
); |
| 1875 |
|
| 1876 |
$this->add_control( |
| 1877 |
'button_hover_animation', |
| 1878 |
[ |
| 1879 |
'label' => esc_html__( 'Animation', 'hello-plus' ), |
| 1880 |
'type' => Controls_Manager::HOVER_ANIMATION, |
| 1881 |
] |
| 1882 |
); |
| 1883 |
|
| 1884 |
$this->end_controls_tab(); |
| 1885 |
|
| 1886 |
$this->end_controls_tabs(); |
| 1887 |
|
| 1888 |
$this->add_control( |
| 1889 |
'button_border_switcher', |
| 1890 |
[ |
| 1891 |
'label' => esc_html__( 'Border', 'hello-plus' ), |
| 1892 |
'type' => Controls_Manager::SWITCHER, |
| 1893 |
'options' => [ |
| 1894 |
'yes' => esc_html__( 'Yes', 'hello-plus' ), |
| 1895 |
'no' => esc_html__( 'No', 'hello-plus' ), |
| 1896 |
], |
| 1897 |
'default' => '', |
| 1898 |
'separator' => 'before', |
| 1899 |
] |
| 1900 |
); |
| 1901 |
|
| 1902 |
$this->add_control( |
| 1903 |
'button_border_width', |
| 1904 |
[ |
| 1905 |
'label' => esc_html__( 'Border Width', 'hello-plus' ), |
| 1906 |
'type' => Controls_Manager::SLIDER, |
| 1907 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 1908 |
'range' => [ |
| 1909 |
'px' => [ |
| 1910 |
'max' => 100, |
| 1911 |
], |
| 1912 |
'em' => [ |
| 1913 |
'max' => 10, |
| 1914 |
], |
| 1915 |
'rem' => [ |
| 1916 |
'max' => 10, |
| 1917 |
], |
| 1918 |
], |
| 1919 |
'default' => [ |
| 1920 |
'size' => 2, |
| 1921 |
'unit' => 'px', |
| 1922 |
], |
| 1923 |
'selectors' => [ |
| 1924 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-button-border-width: {{SIZE}}{{UNIT}};', |
| 1925 |
], |
| 1926 |
'condition' => [ |
| 1927 |
'button_border_switcher' => 'yes', |
| 1928 |
], |
| 1929 |
] |
| 1930 |
); |
| 1931 |
|
| 1932 |
$this->add_control( |
| 1933 |
'button_border_color', |
| 1934 |
[ |
| 1935 |
'label' => esc_html__( 'Border Color', 'hello-plus' ), |
| 1936 |
'type' => Controls_Manager::COLOR, |
| 1937 |
'global' => [ |
| 1938 |
'default' => Global_Colors::COLOR_TEXT, |
| 1939 |
], |
| 1940 |
'selectors' => [ |
| 1941 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-button-border-color: {{VALUE}};', |
| 1942 |
], |
| 1943 |
'condition' => [ |
| 1944 |
'button_border_switcher' => 'yes', |
| 1945 |
], |
| 1946 |
] |
| 1947 |
); |
| 1948 |
|
| 1949 |
$shapes = new Ehp_Shapes( $this, [ |
| 1950 |
'widget_name' => 'form', |
| 1951 |
'container_prefix' => 'button', |
| 1952 |
] ); |
| 1953 |
$shapes->add_style_controls(); |
| 1954 |
|
| 1955 |
$this->add_group_control( |
| 1956 |
Group_Control_Box_Shadow::get_type(), |
| 1957 |
[ |
| 1958 |
'name' => 'map_box_shadow', |
| 1959 |
'selector' => '{{WRAPPER}} .ehp-form__button', |
| 1960 |
] |
| 1961 |
); |
| 1962 |
|
| 1963 |
$this->add_responsive_control( |
| 1964 |
'button_text_padding', |
| 1965 |
[ |
| 1966 |
'label' => esc_html__( 'Padding', 'hello-plus' ), |
| 1967 |
'type' => Controls_Manager::DIMENSIONS, |
| 1968 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 1969 |
'default' => [ |
| 1970 |
'top' => '8', |
| 1971 |
'right' => '40', |
| 1972 |
'bottom' => '8', |
| 1973 |
'left' => '40', |
| 1974 |
'unit' => 'px', |
| 1975 |
], |
| 1976 |
'mobile_default' => [ |
| 1977 |
'top' => '8', |
| 1978 |
'right' => '40', |
| 1979 |
'bottom' => '8', |
| 1980 |
'left' => '40', |
| 1981 |
'unit' => 'px', |
| 1982 |
], |
| 1983 |
'tablet_default' => [ |
| 1984 |
'top' => '8', |
| 1985 |
'right' => '40', |
| 1986 |
'bottom' => '8', |
| 1987 |
'left' => '40', |
| 1988 |
'unit' => 'px', |
| 1989 |
], |
| 1990 |
'selectors' => [ |
| 1991 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-button-padding-block-end: {{BOTTOM}}{{UNIT}}; --ehp-form-button-padding-block-start: {{TOP}}{{UNIT}}; --ehp-form-button-padding-inline-end: {{RIGHT}}{{UNIT}}; --ehp-form-button-padding-inline-start: {{LEFT}}{{UNIT}};', |
| 1992 |
], |
| 1993 |
'separator' => 'before', |
| 1994 |
] |
| 1995 |
); |
| 1996 |
|
| 1997 |
$this->end_controls_section(); |
| 1998 |
} |
| 1999 |
|
| 2000 |
protected function add_style_messages_section(): void { |
| 2001 |
$this->start_controls_section( |
| 2002 |
'section_messages_style', |
| 2003 |
[ |
| 2004 |
'label' => esc_html__( 'Messages', 'hello-plus' ), |
| 2005 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2006 |
] |
| 2007 |
); |
| 2008 |
|
| 2009 |
$this->add_group_control( |
| 2010 |
Group_Control_Typography::get_type(), |
| 2011 |
[ |
| 2012 |
'name' => 'message_typography', |
| 2013 |
'global' => [ |
| 2014 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 2015 |
], |
| 2016 |
'selector' => '{{WRAPPER}} .elementor-message', |
| 2017 |
] |
| 2018 |
); |
| 2019 |
|
| 2020 |
$this->add_control( |
| 2021 |
'success_message_color', |
| 2022 |
[ |
| 2023 |
'label' => esc_html__( 'Success Message Color', 'hello-plus' ), |
| 2024 |
'type' => Controls_Manager::COLOR, |
| 2025 |
'selectors' => [ |
| 2026 |
'{{WRAPPER}} .elementor-message.elementor-message-success' => 'color: {{COLOR}};', |
| 2027 |
], |
| 2028 |
] |
| 2029 |
); |
| 2030 |
|
| 2031 |
$this->add_control( |
| 2032 |
'error_message_color', |
| 2033 |
[ |
| 2034 |
'label' => esc_html__( 'Error Message Color', 'hello-plus' ), |
| 2035 |
'type' => Controls_Manager::COLOR, |
| 2036 |
'selectors' => [ |
| 2037 |
'{{WRAPPER}} .elementor-message.elementor-message-danger' => 'color: {{COLOR}};', |
| 2038 |
], |
| 2039 |
] |
| 2040 |
); |
| 2041 |
|
| 2042 |
$this->add_control( |
| 2043 |
'inline_message_color', |
| 2044 |
[ |
| 2045 |
'label' => esc_html__( 'Inline Message Color', 'hello-plus' ), |
| 2046 |
'type' => Controls_Manager::COLOR, |
| 2047 |
'selectors' => [ |
| 2048 |
'{{WRAPPER}} .elementor-message.elementor-help-inline' => 'color: {{COLOR}};', |
| 2049 |
], |
| 2050 |
] |
| 2051 |
); |
| 2052 |
|
| 2053 |
$this->end_controls_section(); |
| 2054 |
} |
| 2055 |
|
| 2056 |
protected function add_style_box_section(): void { |
| 2057 |
$this->start_controls_section( |
| 2058 |
'section_box_style', |
| 2059 |
[ |
| 2060 |
'label' => esc_html__( 'Box', 'hello-plus' ), |
| 2061 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2062 |
] |
| 2063 |
); |
| 2064 |
|
| 2065 |
$this->add_control( |
| 2066 |
'box_heading', |
| 2067 |
[ |
| 2068 |
'label' => esc_html__( 'Background', 'hello-plus' ), |
| 2069 |
'type' => Controls_Manager::HEADING, |
| 2070 |
] |
| 2071 |
); |
| 2072 |
|
| 2073 |
$this->add_group_control( |
| 2074 |
Group_Control_Background::get_type(), |
| 2075 |
[ |
| 2076 |
'name' => 'box_background', |
| 2077 |
'types' => [ 'classic', 'gradient' ], |
| 2078 |
'selector' => '{{WRAPPER}} .ehp-form', |
| 2079 |
'fields_options' => [ |
| 2080 |
'background' => [ |
| 2081 |
'default' => 'classic', |
| 2082 |
], |
| 2083 |
], |
| 2084 |
] |
| 2085 |
); |
| 2086 |
|
| 2087 |
$this->add_control( |
| 2088 |
'box_background_overlay_label', |
| 2089 |
[ |
| 2090 |
'label' => esc_html__( 'Background Overlay', 'hello-plus' ), |
| 2091 |
'type' => Controls_Manager::HEADING, |
| 2092 |
'separator' => 'before', |
| 2093 |
] |
| 2094 |
); |
| 2095 |
|
| 2096 |
$this->add_group_control( |
| 2097 |
Group_Control_Background::get_type(), |
| 2098 |
[ |
| 2099 |
'name' => 'background_overlay', |
| 2100 |
'types' => [ 'classic', 'gradient' ], |
| 2101 |
'selector' => '{{WRAPPER}} .ehp-form__overlay', |
| 2102 |
'frontend_available' => true, |
| 2103 |
] |
| 2104 |
); |
| 2105 |
|
| 2106 |
$this->add_responsive_control( |
| 2107 |
'background_overlay_opacity', |
| 2108 |
[ |
| 2109 |
'label' => esc_html__( 'Opacity', 'hello-plus' ), |
| 2110 |
'type' => Controls_Manager::SLIDER, |
| 2111 |
'range' => [ |
| 2112 |
'%' => [ |
| 2113 |
'max' => 1, |
| 2114 |
'min' => 0.10, |
| 2115 |
'step' => 0.01, |
| 2116 |
], |
| 2117 |
], |
| 2118 |
'default' => [ |
| 2119 |
'unit' => '%', |
| 2120 |
'size' => 0.5, |
| 2121 |
], |
| 2122 |
'selectors' => [ |
| 2123 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-overlay-opacity: {{SIZE}};', |
| 2124 |
], |
| 2125 |
'condition' => [ |
| 2126 |
'background_overlay_background!' => '', |
| 2127 |
], |
| 2128 |
] |
| 2129 |
); |
| 2130 |
|
| 2131 |
$this->add_responsive_control( |
| 2132 |
'box_element_spacing', |
| 2133 |
[ |
| 2134 |
'label' => esc_html__( 'Element Spacing', 'hello-plus' ), |
| 2135 |
'type' => Controls_Manager::SLIDER, |
| 2136 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 2137 |
'range' => [ |
| 2138 |
'px' => [ |
| 2139 |
'max' => 150, |
| 2140 |
], |
| 2141 |
'%' => [ |
| 2142 |
'max' => 100, |
| 2143 |
], |
| 2144 |
], |
| 2145 |
'default' => [ |
| 2146 |
'size' => 32, |
| 2147 |
'unit' => 'px', |
| 2148 |
], |
| 2149 |
'selectors' => [ |
| 2150 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-elements-spacing: {{SIZE}}{{UNIT}};', |
| 2151 |
], |
| 2152 |
'separator' => 'before', |
| 2153 |
'condition' => [ |
| 2154 |
'layout_preset' => [ |
| 2155 |
'quick-connect', |
| 2156 |
'engage', |
| 2157 |
], |
| 2158 |
], |
| 2159 |
] |
| 2160 |
); |
| 2161 |
|
| 2162 |
$this->add_responsive_control( |
| 2163 |
'box_elements_gap', |
| 2164 |
[ |
| 2165 |
'label' => esc_html__( 'Gap', 'hello-plus' ), |
| 2166 |
'type' => Controls_Manager::SLIDER, |
| 2167 |
'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ], |
| 2168 |
'range' => [ |
| 2169 |
'px' => [ |
| 2170 |
'max' => 150, |
| 2171 |
], |
| 2172 |
'%' => [ |
| 2173 |
'max' => 100, |
| 2174 |
], |
| 2175 |
], |
| 2176 |
'default' => [ |
| 2177 |
'size' => 60, |
| 2178 |
'unit' => 'px', |
| 2179 |
], |
| 2180 |
'tablet_default' => [ |
| 2181 |
'size' => 32, |
| 2182 |
'unit' => 'px', |
| 2183 |
], |
| 2184 |
'mobile_default' => [ |
| 2185 |
'size' => 32, |
| 2186 |
'unit' => 'px', |
| 2187 |
], |
| 2188 |
'selectors' => [ |
| 2189 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-elements-gap: {{SIZE}}{{UNIT}};', |
| 2190 |
], |
| 2191 |
'separator' => 'before', |
| 2192 |
'condition' => [ |
| 2193 |
'layout_preset' => [ |
| 2194 |
'interact', |
| 2195 |
'engage', |
| 2196 |
], |
| 2197 |
], |
| 2198 |
] |
| 2199 |
); |
| 2200 |
|
| 2201 |
$this->add_control( |
| 2202 |
'show_box_border', |
| 2203 |
[ |
| 2204 |
'label' => esc_html__( 'Border', 'hello-plus' ), |
| 2205 |
'type' => Controls_Manager::SWITCHER, |
| 2206 |
'label_on' => esc_html__( 'Yes', 'hello-plus' ), |
| 2207 |
'label_off' => esc_html__( 'No', 'hello-plus' ), |
| 2208 |
'return_value' => 'yes', |
| 2209 |
'default' => 'no', |
| 2210 |
'separator' => 'before', |
| 2211 |
] |
| 2212 |
); |
| 2213 |
|
| 2214 |
$this->add_control( |
| 2215 |
'box_border_width', |
| 2216 |
[ |
| 2217 |
'label' => __( 'Border Width', 'hello-plus' ), |
| 2218 |
'type' => Controls_Manager::SLIDER, |
| 2219 |
'size_units' => [ 'px' ], |
| 2220 |
'range' => [ |
| 2221 |
'px' => [ |
| 2222 |
'min' => 0, |
| 2223 |
'max' => 10, |
| 2224 |
'step' => 1, |
| 2225 |
], |
| 2226 |
], |
| 2227 |
'default' => [ |
| 2228 |
'size' => 1, |
| 2229 |
'unit' => 'px', |
| 2230 |
], |
| 2231 |
'selectors' => [ |
| 2232 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-box-border-width: {{SIZE}}{{UNIT}};', |
| 2233 |
], |
| 2234 |
'condition' => [ |
| 2235 |
'show_box_border' => 'yes', |
| 2236 |
], |
| 2237 |
] |
| 2238 |
); |
| 2239 |
|
| 2240 |
$this->add_control( |
| 2241 |
'box_border_color', |
| 2242 |
[ |
| 2243 |
'label' => esc_html__( 'Color', 'hello-plus' ), |
| 2244 |
'type' => Controls_Manager::COLOR, |
| 2245 |
'global' => [ |
| 2246 |
'default' => Global_Colors::COLOR_TEXT, |
| 2247 |
], |
| 2248 |
'selectors' => [ |
| 2249 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-box-border-color: {{VALUE}}', |
| 2250 |
], |
| 2251 |
'condition' => [ |
| 2252 |
'show_box_border' => 'yes', |
| 2253 |
], |
| 2254 |
] |
| 2255 |
); |
| 2256 |
|
| 2257 |
$shapes = new Ehp_Shapes( $this, [ |
| 2258 |
'widget_name' => 'form', |
| 2259 |
'container_prefix' => 'box', |
| 2260 |
] ); |
| 2261 |
$shapes->add_style_controls(); |
| 2262 |
|
| 2263 |
$this->add_group_control( |
| 2264 |
Group_Control_Box_Shadow::get_type(), |
| 2265 |
[ |
| 2266 |
'name' => 'box_box_shadow', |
| 2267 |
'selector' => '{{WRAPPER}} .ehp-form', |
| 2268 |
] |
| 2269 |
); |
| 2270 |
|
| 2271 |
$this->add_responsive_control( |
| 2272 |
'box_padding', |
| 2273 |
[ |
| 2274 |
'label' => esc_html__( 'Padding', 'hello-plus' ), |
| 2275 |
'type' => Controls_Manager::DIMENSIONS, |
| 2276 |
'size_units' => [ 'px', '%', 'em', 'rem' ], |
| 2277 |
'selectors' => [ |
| 2278 |
'{{WRAPPER}} .ehp-form' => '--ehp-form-box-padding-block-end: {{BOTTOM}}{{UNIT}}; --ehp-form-box-padding-block-start: {{TOP}}{{UNIT}}; --ehp-form-box-padding-inline-end: {{RIGHT}}{{UNIT}}; --ehp-form-box-padding-inline-start: {{LEFT}}{{UNIT}};', |
| 2279 |
], |
| 2280 |
'default' => [ |
| 2281 |
'top' => '60', |
| 2282 |
'right' => '60', |
| 2283 |
'bottom' => '60', |
| 2284 |
'left' => '60', |
| 2285 |
'unit' => 'px', |
| 2286 |
], |
| 2287 |
'separator' => 'before', |
| 2288 |
] |
| 2289 |
); |
| 2290 |
|
| 2291 |
$ehp_full_height = new Ehp_Full_Height( $this ); |
| 2292 |
$ehp_full_height->add_style_controls(); |
| 2293 |
|
| 2294 |
$this->end_controls_section(); |
| 2295 |
} |
| 2296 |
} |
| 2297 |
|