← All changes
|
includes/widgets/Form_Builder/Form_Builder.php
+4283
-0
51.1.2
→
51.1.86
View file →
| @@ -1,0 +1,4283 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace King_Addons; | |
| 4 | + | |
| 5 | +use Elementor\Controls_Manager; | |
| 6 | +use Elementor\Group_Control_Border; | |
| 7 | +use Elementor\Group_Control_Typography; | |
| 8 | +use Elementor\Icons_Manager; | |
| 9 | +use Elementor\Repeater; | |
| 10 | +use Elementor\Utils; | |
| 11 | +use Elementor\Widget_Base; | |
| 12 | +use Elementor\Plugin; | |
| 13 | + | |
| 14 | +if (!defined('ABSPATH')) { | |
| 15 | + exit; | |
| 16 | +} | |
| 17 | + | |
| 18 | +class Form_Builder extends Widget_Base | |
| 19 | +{ | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + public function get_name() | |
| 24 | + { | |
| 25 | + return 'king-addons-form-builder'; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public function get_title() | |
| 29 | + { | |
| 30 | + return esc_html__('Form Builder', 'king-addons'); | |
| 31 | + } | |
| 32 | + | |
| 33 | + public function get_icon() | |
| 34 | + { | |
| 35 | + return 'king-addons-icon king-addons-form-builder'; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public function get_categories() | |
| 39 | + { | |
| 40 | + return ['king-addons']; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public function get_keywords() | |
| 44 | + { | |
| 45 | + return ['king addons', 'king', 'addons', 'kingaddons', 'king-addons', 'cf7', 'contact form 7', 'builder', 'ninja', 'caldera', 'contact form', | |
| 46 | + 'caldera forms', 'ninja forms', 'wpforms', 'wp forms', 'email', 'mail', 'email', 'form', 'forms', 'email', 'contact']; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public function get_script_depends() | |
| 50 | + { | |
| 51 | + return [ | |
| 52 | + KING_ADDONS_ASSETS_UNIQUE_KEY . '-animation-loading', | |
| 53 | + KING_ADDONS_ASSETS_UNIQUE_KEY . '-form-builder-script' | |
| 54 | + ]; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public function get_style_depends(): array | |
| 58 | + { | |
| 59 | + return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-form-builder-style']; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public function get_custom_help_url() | |
| 63 | + { | |
| 64 | + return 'mailto:[email protected]?subject=Bug Report - King Addons&body=Please describe the issue'; | |
| 65 | + } | |
| 66 | + | |
| 67 | + protected function get_control_id($control_id) | |
| 68 | + { | |
| 69 | + return $control_id; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public function get_label() | |
| 73 | + { | |
| 74 | + return esc_html__('Email', 'king-addons'); | |
| 75 | + } | |
| 76 | + | |
| 77 | + public static function get_site_domain() | |
| 78 | + { | |
| 79 | + return str_ireplace('www.', '', parse_url(home_url(), PHP_URL_HOST)); | |
| 80 | + } | |
| 81 | + | |
| 82 | + public function submit_action_args() | |
| 83 | + { | |
| 84 | + return [ | |
| 85 | + 'email' => 'Email', | |
| 86 | + 'redirect' => 'Redirect', | |
| 87 | + 'pro-sb' => 'Submission (Pro)', | |
| 88 | + 'pro-mch' => 'Mailchimp (Pro)', | |
| 89 | + 'pro-wh' => 'Webhook (Pro)', | |
| 90 | + 'integrations' => 'Integrations (Pro)', | |
| 91 | + 'payment' => 'Payment (Pro)' | |
| 92 | + ]; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public function register_settings_section_submissions($widget) | |
| 96 | + { | |
| 97 | + $widget->start_controls_section( | |
| 98 | + $this->get_control_id('section_submissions'), | |
| 99 | + [ | |
| 100 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Submissions', 'king-addons'), | |
| 101 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 102 | + 'condition' => [ | |
| 103 | + 'submit_actions' => 'submissions', | |
| 104 | + ], | |
| 105 | + ] | |
| 106 | + ); | |
| 107 | + | |
| 108 | + $widget->add_control( | |
| 109 | + $this->get_control_id('submissions_action_message'), | |
| 110 | + [ | |
| 111 | + 'type' => Controls_Manager::RAW_HTML, | |
| 112 | + 'raw' => sprintf( | |
| 113 | + __( | |
| 114 | + 'View Submissions in King Addons > <a href="%s" target="_blank">Form Submissions</a>', | |
| 115 | + 'king-addons' | |
| 116 | + ), | |
| 117 | + self_admin_url('edit.php?post_type=king-addons-fb-sub') | |
| 118 | + ), | |
| 119 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 120 | + ] | |
| 121 | + ); | |
| 122 | + | |
| 123 | + $widget->end_controls_section(); | |
| 124 | + } | |
| 125 | + | |
| 126 | + public function register_settings_section_webhook($widget) | |
| 127 | + { | |
| 128 | + $widget->start_controls_section( | |
| 129 | + $this->get_control_id('section_webhook'), | |
| 130 | + [ | |
| 131 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Webhook', 'king-addons'), | |
| 132 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 133 | + 'condition' => [ | |
| 134 | + 'submit_actions' => 'webhook', | |
| 135 | + ], | |
| 136 | + ] | |
| 137 | + ); | |
| 138 | + | |
| 139 | + $widget->add_control( | |
| 140 | + 'webhook_url', | |
| 141 | + [ | |
| 142 | + 'label' => esc_html__('Webhook URL', 'king-addons'), | |
| 143 | + 'type' => Controls_Manager::TEXT, | |
| 144 | + 'placeholder' => esc_html__('your-webhook-url.com', 'king-addons'), | |
| 145 | + 'ai' => [ | |
| 146 | + 'active' => false, | |
| 147 | + ], | |
| 148 | + 'dynamic' => [ | |
| 149 | + 'active' => true, | |
| 150 | + ], | |
| 151 | + 'label_block' => true, | |
| 152 | + 'separator' => 'before', | |
| 153 | + 'description' => esc_html__('Enter the webhook URL (e.g. Zapier) that will receive the submitted data.', 'king-addons'), | |
| 154 | + 'render_type' => 'none', | |
| 155 | + ] | |
| 156 | + ); | |
| 157 | + | |
| 158 | + $widget->end_controls_section(); | |
| 159 | + } | |
| 160 | + | |
| 161 | + /** | |
| 162 | + * Settings for the Integrations action. | |
| 163 | + * | |
| 164 | + * Everything here is stored per form and read back on the server when a | |
| 165 | + * submission arrives; nothing travels through the browser. | |
| 166 | + * | |
| 167 | + * @param \Elementor\Widget_Base $widget Widget the controls belong to. | |
| 168 | + * | |
| 169 | + * @return void | |
| 170 | + */ | |
| 171 | + public function register_settings_section_integrations($widget) | |
| 172 | + { | |
| 173 | + if (!class_exists('King_Addons\\Form_Integrations')) { | |
| 174 | + return; | |
| 175 | + } | |
| 176 | + | |
| 177 | + $widget->start_controls_section( | |
| 178 | + $this->get_control_id('section_integrations'), | |
| 179 | + [ | |
| 180 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Integrations', 'king-addons'), | |
| 181 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 182 | + 'condition' => [ | |
| 183 | + 'submit_actions' => 'integrations', | |
| 184 | + ], | |
| 185 | + ] | |
| 186 | + ); | |
| 187 | + | |
| 188 | + $widget->add_control( | |
| 189 | + 'integration_services', | |
| 190 | + [ | |
| 191 | + 'label' => esc_html__('Send to', 'king-addons'), | |
| 192 | + 'type' => Controls_Manager::SELECT2, | |
| 193 | + 'multiple' => true, | |
| 194 | + 'label_block' => true, | |
| 195 | + 'options' => Form_Integrations::services(), | |
| 196 | + 'render_type' => 'none', | |
| 197 | + ] | |
| 198 | + ); | |
| 199 | + | |
| 200 | + $widget->add_control( | |
| 201 | + 'integration_email_field', | |
| 202 | + [ | |
| 203 | + 'label' => esc_html__('Email field ID', 'king-addons'), | |
| 204 | + 'type' => Controls_Manager::TEXT, | |
| 205 | + 'description' => esc_html__('Which field holds the address. Left empty, the first value that looks like an email is used.', 'king-addons'), | |
| 206 | + 'render_type' => 'none', | |
| 207 | + ] | |
| 208 | + ); | |
| 209 | + | |
| 210 | + $widget->add_control( | |
| 211 | + 'integration_name_field', | |
| 212 | + [ | |
| 213 | + 'label' => esc_html__('Name field ID', 'king-addons'), | |
| 214 | + 'type' => Controls_Manager::TEXT, | |
| 215 | + 'render_type' => 'none', | |
| 216 | + ] | |
| 217 | + ); | |
| 218 | + | |
| 219 | + $text_controls = [ | |
| 220 | + ['slack_webhook_url', esc_html__('Slack webhook URL', 'king-addons'), 'slack', 'https://hooks.slack.com/services/…'], | |
| 221 | + ['slack_title', esc_html__('Slack message title', 'king-addons'), 'slack', ''], | |
| 222 | + ['telegram_bot_token', esc_html__('Telegram bot token', 'king-addons'), 'telegram', ''], | |
| 223 | + ['telegram_chat_id', esc_html__('Telegram chat ID', 'king-addons'), 'telegram', ''], | |
| 224 | + ['brevo_api_key', esc_html__('Brevo API key', 'king-addons'), 'brevo', ''], | |
| 225 | + ['brevo_list_id', esc_html__('Brevo list ID', 'king-addons'), 'brevo', ''], | |
| 226 | + ['convertkit_api_key', esc_html__('ConvertKit API key', 'king-addons'), 'convertkit', ''], | |
| 227 | + ['convertkit_form_id', esc_html__('ConvertKit form ID', 'king-addons'), 'convertkit', ''], | |
| 228 | + ['activecampaign_url', esc_html__('ActiveCampaign API URL', 'king-addons'), 'activecampaign', 'https://your-account.api-us1.com'], | |
| 229 | + ['activecampaign_api_key', esc_html__('ActiveCampaign API key', 'king-addons'), 'activecampaign', ''], | |
| 230 | + ['activecampaign_list_id', esc_html__('ActiveCampaign list ID', 'king-addons'), 'activecampaign', ''], | |
| 231 | + ['hubspot_token', esc_html__('HubSpot private app token', 'king-addons'), 'hubspot', ''], | |
| 232 | + ['klaviyo_api_key', esc_html__('Klaviyo private API key', 'king-addons'), 'klaviyo', ''], | |
| 233 | + ['klaviyo_list_id', esc_html__('Klaviyo list ID', 'king-addons'), 'klaviyo', ''], | |
| 234 | + ['google_sheets_url', esc_html__('Apps Script web app URL', 'king-addons'), 'google_sheets', 'https://script.google.com/macros/s/…/exec'], | |
| 235 | + ['google_sheets_secret', esc_html__('Shared secret', 'king-addons'), 'google_sheets', ''], | |
| 236 | + ]; | |
| 237 | + | |
| 238 | + foreach ($text_controls as $control) { | |
| 239 | + list($name, $label, $service, $placeholder) = $control; | |
| 240 | + | |
| 241 | + $widget->add_control( | |
| 242 | + $name, | |
| 243 | + [ | |
| 244 | + 'label' => $label, | |
| 245 | + 'type' => Controls_Manager::TEXT, | |
| 246 | + 'label_block' => true, | |
| 247 | + 'placeholder' => $placeholder, | |
| 248 | + 'render_type' => 'none', | |
| 249 | + 'ai' => ['active' => false], | |
| 250 | + 'condition' => ['integration_services' => $service], | |
| 251 | + ] | |
| 252 | + ); | |
| 253 | + } | |
| 254 | + | |
| 255 | + $widget->add_control( | |
| 256 | + 'google_sheets_notice', | |
| 257 | + [ | |
| 258 | + 'type' => Controls_Manager::RAW_HTML, | |
| 259 | + 'raw' => esc_html__('Google Sheets is reached through a Google Apps Script web app bound to your sheet: Google\'s own API needs an OAuth flow a form widget cannot run.', 'king-addons'), | |
| 260 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 261 | + 'condition' => ['integration_services' => 'google_sheets'], | |
| 262 | + ] | |
| 263 | + ); | |
| 264 | + | |
| 265 | + $widget->end_controls_section(); | |
| 266 | + } | |
| 267 | + | |
| 268 | + /** | |
| 269 | + * Settings for the Payment action. | |
| 270 | + * | |
| 271 | + * @param \Elementor\Widget_Base $widget Widget the controls belong to. | |
| 272 | + * | |
| 273 | + * @return void | |
| 274 | + */ | |
| 275 | + public function register_settings_section_payment($widget) | |
| 276 | + { | |
| 277 | + if (!class_exists('King_Addons\\Form_Payments')) { | |
| 278 | + return; | |
| 279 | + } | |
| 280 | + | |
| 281 | + $widget->start_controls_section( | |
| 282 | + $this->get_control_id('section_payment'), | |
| 283 | + [ | |
| 284 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Payment', 'king-addons'), | |
| 285 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 286 | + 'condition' => [ | |
| 287 | + 'submit_actions' => 'payment', | |
| 288 | + ], | |
| 289 | + ] | |
| 290 | + ); | |
| 291 | + | |
| 292 | + $widget->add_control( | |
| 293 | + 'payment_provider', | |
| 294 | + [ | |
| 295 | + 'label' => esc_html__('Provider', 'king-addons'), | |
| 296 | + 'type' => Controls_Manager::SELECT, | |
| 297 | + 'options' => Form_Payments::providers(), | |
| 298 | + 'default' => 'none', | |
| 299 | + 'render_type' => 'none', | |
| 300 | + 'description' => esc_html__('Keys live in King Addons settings. The visitor pays on the provider\'s own page, so no card details reach this site.', 'king-addons'), | |
| 301 | + ] | |
| 302 | + ); | |
| 303 | + | |
| 304 | + $widget->add_control( | |
| 305 | + 'payment_currency', | |
| 306 | + [ | |
| 307 | + 'label' => esc_html__('Currency', 'king-addons'), | |
| 308 | + 'type' => Controls_Manager::TEXT, | |
| 309 | + 'default' => 'USD', | |
| 310 | + 'render_type' => 'none', | |
| 311 | + 'condition' => ['payment_provider!' => 'none'], | |
| 312 | + ] | |
| 313 | + ); | |
| 314 | + | |
| 315 | + $widget->add_control( | |
| 316 | + 'payment_fixed_amount', | |
| 317 | + [ | |
| 318 | + 'label' => esc_html__('Fixed amount', 'king-addons'), | |
| 319 | + 'type' => Controls_Manager::NUMBER, | |
| 320 | + 'min' => 0, | |
| 321 | + 'step' => 0.01, | |
| 322 | + 'render_type' => 'none', | |
| 323 | + 'condition' => ['payment_provider!' => 'none'], | |
| 324 | + ] | |
| 325 | + ); | |
| 326 | + | |
| 327 | + $widget->add_control( | |
| 328 | + 'payment_amount_field', | |
| 329 | + [ | |
| 330 | + 'label' => esc_html__('Or a calculation field ID', 'king-addons'), | |
| 331 | + 'type' => Controls_Manager::TEXT, | |
| 332 | + 'render_type' => 'none', | |
| 333 | + 'description' => esc_html__('The server works the total out again from that field\'s formula; the number the browser shows is never trusted.', 'king-addons'), | |
| 334 | + 'condition' => ['payment_provider!' => 'none'], | |
| 335 | + ] | |
| 336 | + ); | |
| 337 | + | |
| 338 | + $widget->add_control( | |
| 339 | + 'payment_max_amount', | |
| 340 | + [ | |
| 341 | + 'label' => esc_html__('Refuse above', 'king-addons'), | |
| 342 | + 'type' => Controls_Manager::NUMBER, | |
| 343 | + 'min' => 0, | |
| 344 | + 'step' => 0.01, | |
| 345 | + 'render_type' => 'none', | |
| 346 | + 'description' => esc_html__('A ceiling for calculated totals. 0 means no ceiling.', 'king-addons'), | |
| 347 | + 'condition' => ['payment_provider!' => 'none'], | |
| 348 | + ] | |
| 349 | + ); | |
| 350 | + | |
| 351 | + $widget->add_control( | |
| 352 | + 'payment_description', | |
| 353 | + [ | |
| 354 | + 'label' => esc_html__('What is being paid for', 'king-addons'), | |
| 355 | + 'type' => Controls_Manager::TEXT, | |
| 356 | + 'label_block' => true, | |
| 357 | + 'render_type' => 'none', | |
| 358 | + 'condition' => ['payment_provider!' => 'none'], | |
| 359 | + ] | |
| 360 | + ); | |
| 361 | + | |
| 362 | + $widget->add_control( | |
| 363 | + 'payment_success_url', | |
| 364 | + [ | |
| 365 | + 'label' => esc_html__('After paying', 'king-addons'), | |
| 366 | + 'type' => Controls_Manager::TEXT, | |
| 367 | + 'label_block' => true, | |
| 368 | + 'render_type' => 'none', | |
| 369 | + 'description' => esc_html__('A page on this site. Anything else is ignored.', 'king-addons'), | |
| 370 | + 'condition' => ['payment_provider!' => 'none'], | |
| 371 | + ] | |
| 372 | + ); | |
| 373 | + | |
| 374 | + $widget->add_control( | |
| 375 | + 'payment_cancel_url', | |
| 376 | + [ | |
| 377 | + 'label' => esc_html__('If they cancel', 'king-addons'), | |
| 378 | + 'type' => Controls_Manager::TEXT, | |
| 379 | + 'label_block' => true, | |
| 380 | + 'render_type' => 'none', | |
| 381 | + 'condition' => ['payment_provider!' => 'none'], | |
| 382 | + ] | |
| 383 | + ); | |
| 384 | + | |
| 385 | + $widget->end_controls_section(); | |
| 386 | + } | |
| 387 | + | |
| 388 | + public function register_settings_section_email($widget) | |
| 389 | + { | |
| 390 | + $widget->start_controls_section( | |
| 391 | + $this->get_control_id('section_email'), | |
| 392 | + [ | |
| 393 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . $this->get_label(), | |
| 394 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 395 | + 'condition' => [ | |
| 396 | + 'submit_actions' => 'email', | |
| 397 | + ], | |
| 398 | + ] | |
| 399 | + ); | |
| 400 | + | |
| 401 | + $widget->add_control( | |
| 402 | + $this->get_control_id('email_to'), | |
| 403 | + [ | |
| 404 | + 'label' => esc_html__('To', 'king-addons'), | |
| 405 | + 'type' => Controls_Manager::TEXT, | |
| 406 | + 'default' => get_option('admin_email'), | |
| 407 | + 'label_block' => true, | |
| 408 | + 'title' => esc_html__('Separate emails with commas', 'king-addons'), | |
| 409 | + 'render_type' => 'none', | |
| 410 | + 'dynamic' => [ | |
| 411 | + 'active' => true, | |
| 412 | + ], | |
| 413 | + ] | |
| 414 | + ); | |
| 415 | + | |
| 416 | + | |
| 417 | + $default_message = sprintf(esc_html__('New message from %s', 'king-addons'), get_option('blogname')); | |
| 418 | + | |
| 419 | + $widget->add_control( | |
| 420 | + $this->get_control_id('email_subject'), | |
| 421 | + [ | |
| 422 | + 'label' => esc_html__('Subject', 'king-addons'), | |
| 423 | + 'type' => Controls_Manager::TEXT, | |
| 424 | + 'default' => $default_message, | |
| 425 | + 'placeholder' => $default_message, | |
| 426 | + 'label_block' => true, | |
| 427 | + 'render_type' => 'none', | |
| 428 | + 'dynamic' => [ | |
| 429 | + 'active' => true, | |
| 430 | + ], | |
| 431 | + ] | |
| 432 | + ); | |
| 433 | + | |
| 434 | + $widget->add_control( | |
| 435 | + $this->get_control_id('email_content'), | |
| 436 | + [ | |
| 437 | + 'label' => esc_html__('Message', 'king-addons'), | |
| 438 | + 'type' => Controls_Manager::TEXTAREA, | |
| 439 | + 'default' => '[all-fields]', | |
| 440 | + 'placeholder' => '[all-fields]', | |
| 441 | + 'description' => sprintf( | |
| 442 | + esc_html__('By default, the form submits all fields. To modify this behavior, copy the shortcode of the fields you wish to include and paste it in place of %s.', 'king-addons'), | |
| 443 | + '<code>[all-fields]</code>' | |
| 444 | + ), | |
| 445 | + 'render_type' => 'none', | |
| 446 | + 'dynamic' => [ | |
| 447 | + 'active' => true, | |
| 448 | + ], | |
| 449 | + ] | |
| 450 | + ); | |
| 451 | + | |
| 452 | + $site_domain = $this->get_site_domain(); | |
| 453 | + | |
| 454 | + $widget->add_control( | |
| 455 | + $this->get_control_id('email_from'), | |
| 456 | + [ | |
| 457 | + 'label' => esc_html__('From Email', 'king-addons'), | |
| 458 | + 'type' => Controls_Manager::TEXT, | |
| 459 | + 'description' => esc_html__('Shortcodes such as [id="email"] can be inserted based on the ID of the associated mail field.', 'king-addons'), | |
| 460 | + 'default' => 'email@' . $site_domain, | |
| 461 | + 'render_type' => 'none', | |
| 462 | + 'dynamic' => [ | |
| 463 | + 'active' => true, | |
| 464 | + ], | |
| 465 | + ] | |
| 466 | + ); | |
| 467 | + | |
| 468 | + $widget->add_control( | |
| 469 | + $this->get_control_id('email_from_name'), | |
| 470 | + [ | |
| 471 | + 'label' => esc_html__('From Name', 'king-addons'), | |
| 472 | + 'type' => Controls_Manager::TEXT, | |
| 473 | + 'default' => get_bloginfo('name'), | |
| 474 | + 'render_type' => 'none', | |
| 475 | + 'dynamic' => [ | |
| 476 | + 'active' => true, | |
| 477 | + ], | |
| 478 | + ] | |
| 479 | + ); | |
| 480 | + | |
| 481 | + $widget->add_control( | |
| 482 | + $this->get_control_id('email_reply_to'), | |
| 483 | + [ | |
| 484 | + 'label' => esc_html__('Reply To', 'king-addons'), | |
| 485 | + 'type' => Controls_Manager::TEXT, | |
| 486 | + 'default' => 'email@' . $site_domain, | |
| 487 | + 'render_type' => 'none' | |
| 488 | + ] | |
| 489 | + ); | |
| 490 | + | |
| 491 | + $widget->add_control( | |
| 492 | + $this->get_control_id('email_to_cc'), | |
| 493 | + [ | |
| 494 | + 'label' => esc_html__('Cc', 'king-addons'), | |
| 495 | + 'type' => Controls_Manager::TEXT, | |
| 496 | + 'default' => '', | |
| 497 | + 'title' => esc_html__('Separate emails with commas', 'king-addons'), | |
| 498 | + 'render_type' => 'none', | |
| 499 | + 'dynamic' => [ | |
| 500 | + 'active' => true, | |
| 501 | + ], | |
| 502 | + ] | |
| 503 | + ); | |
| 504 | + | |
| 505 | + $widget->add_control( | |
| 506 | + $this->get_control_id('email_to_bcc'), | |
| 507 | + [ | |
| 508 | + 'label' => esc_html__('Bcc', 'king-addons'), | |
| 509 | + 'type' => Controls_Manager::TEXT, | |
| 510 | + 'default' => '', | |
| 511 | + 'title' => esc_html__('Separate emails with commas', 'king-addons'), | |
| 512 | + 'render_type' => 'none', | |
| 513 | + 'dynamic' => [ | |
| 514 | + 'active' => true, | |
| 515 | + ], | |
| 516 | + ] | |
| 517 | + ); | |
| 518 | + | |
| 519 | + $widget->add_control( | |
| 520 | + $this->get_control_id('form_metadata'), | |
| 521 | + [ | |
| 522 | + 'label' => esc_html__('Meta Data', 'king-addons'), | |
| 523 | + 'type' => Controls_Manager::SELECT2, | |
| 524 | + 'multiple' => true, | |
| 525 | + 'label_block' => true, | |
| 526 | + 'separator' => 'before', | |
| 527 | + 'default' => [ | |
| 528 | + 'date', | |
| 529 | + 'time', | |
| 530 | + 'credit' | |
| 531 | + ], | |
| 532 | + 'options' => [ | |
| 533 | + 'date' => esc_html__('Date', 'king-addons'), | |
| 534 | + 'time' => esc_html__('Time', 'king-addons'), | |
| 535 | + 'page_url' => esc_html__('Page URL', 'king-addons'), | |
| 536 | + 'page_title' => esc_html__('Page Title', 'king-addons'), | |
| 537 | + 'user_agent' => esc_html__('User Agent', 'king-addons'), | |
| 538 | + 'remote_ip' => esc_html__('Remote IP', 'king-addons'), | |
| 539 | + 'credit' => esc_html__('Credit', 'king-addons'), | |
| 540 | + ], | |
| 541 | + 'render_type' => 'none', | |
| 542 | + ] | |
| 543 | + ); | |
| 544 | + | |
| 545 | + $widget->add_control( | |
| 546 | + $this->get_control_id('email_content_type'), | |
| 547 | + [ | |
| 548 | + 'label' => esc_html__('Send As', 'king-addons'), | |
| 549 | + 'type' => Controls_Manager::SELECT, | |
| 550 | + 'default' => 'html', | |
| 551 | + 'render_type' => 'none', | |
| 552 | + 'options' => [ | |
| 553 | + 'html' => esc_html__('HTML', 'king-addons'), | |
| 554 | + 'plain' => esc_html__('Plain', 'king-addons'), | |
| 555 | + ], | |
| 556 | + ] | |
| 557 | + ); | |
| 558 | + | |
| 559 | + $widget->end_controls_section(); | |
| 560 | + } | |
| 561 | + | |
| 562 | + public function register_settings_section_redirect($widget) | |
| 563 | + { | |
| 564 | + $widget->start_controls_section( | |
| 565 | + 'section_redirect', | |
| 566 | + [ | |
| 567 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Redirect', 'king-addons'), | |
| 568 | + 'condition' => [ | |
| 569 | + 'submit_actions' => 'redirect', | |
| 570 | + ], | |
| 571 | + ] | |
| 572 | + ); | |
| 573 | + | |
| 574 | + $widget->add_control( | |
| 575 | + 'redirect_to', | |
| 576 | + [ | |
| 577 | + 'label' => esc_html__('Redirect To', 'king-addons'), | |
| 578 | + 'type' => Controls_Manager::TEXT, | |
| 579 | + 'dynamic' => [ | |
| 580 | + 'active' => true | |
| 581 | + ], | |
| 582 | + 'placeholder' => esc_html__('https://example.com', 'king-addons'), | |
| 583 | + 'label_block' => true | |
| 584 | + ] | |
| 585 | + ); | |
| 586 | + | |
| 587 | + $widget->end_controls_section(); | |
| 588 | + } | |
| 589 | + | |
| 590 | + public function register_settings_section_mailchimp() | |
| 591 | + { | |
| 592 | + $this->start_controls_section( | |
| 593 | + 'section_mailchimp', | |
| 594 | + [ | |
| 595 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Mailchimp', 'king-addons'), | |
| 596 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 597 | + 'condition' => [ | |
| 598 | + 'submit_actions' => 'mailchimp' | |
| 599 | + ] | |
| 600 | + ] | |
| 601 | + ); | |
| 602 | + | |
| 603 | + $this->add_control( | |
| 604 | + 'mailchimp_audience', | |
| 605 | + [ | |
| 606 | + 'label' => esc_html__('Select Audience', 'king-addons'), | |
| 607 | + 'type' => Controls_Manager::SELECT, | |
| 608 | + 'default' => 'def', | |
| 609 | + | |
| 610 | + 'options' => Core::getMailchimpLists(), | |
| 611 | + ] | |
| 612 | + ); | |
| 613 | + | |
| 614 | + | |
| 615 | + $this->add_control( | |
| 616 | + 'mailchimp_groups', | |
| 617 | + [ | |
| 618 | + 'label' => esc_html__('Groups', 'king-addons'), | |
| 619 | + 'type' => Controls_Manager::SELECT2, | |
| 620 | + 'multiple' => true, | |
| 621 | + 'options' => Core::getMailchimpGroups(), | |
| 622 | + | |
| 623 | + 'label_block' => true, | |
| 624 | + ] | |
| 625 | + ); | |
| 626 | + | |
| 627 | + if ('' == get_option('king_addons_mailchimp_api_key')) { | |
| 628 | + $this->add_control( | |
| 629 | + 'mailchimp_key_notice', | |
| 630 | + [ | |
| 631 | + 'type' => Controls_Manager::RAW_HTML, | |
| 632 | + 'raw' => sprintf(__('Navigate to <strong><a href="%s" target="_blank">Dashboard > %s > Integrations</a></strong> to set up <strong>MailChimp API Key</strong>.', 'king-addons'), admin_url('admin.php?page=king-addons-settings'), Core::getPluginName()), | |
| 633 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 634 | + ] | |
| 635 | + ); | |
| 636 | + } | |
| 637 | + | |
| 638 | + $this->add_control( | |
| 639 | + 'mailchimp_fields', | |
| 640 | + [ | |
| 641 | + 'label' => esc_html__('Fields', 'king-addons'), | |
| 642 | + 'type' => Controls_Manager::HEADING, | |
| 643 | + 'separator' => 'before', | |
| 644 | + ] | |
| 645 | + ); | |
| 646 | + | |
| 647 | + $this->add_control( | |
| 648 | + 'email_field', | |
| 649 | + [ | |
| 650 | + 'label' => esc_html__('Email', 'king-addons'), | |
| 651 | + 'type' => Controls_Manager::SELECT, | |
| 652 | + 'options' => [] | |
| 653 | + ] | |
| 654 | + ); | |
| 655 | + | |
| 656 | + $this->add_control( | |
| 657 | + 'first_name_field', | |
| 658 | + [ | |
| 659 | + 'label' => esc_html__('First Name', 'king-addons'), | |
| 660 | + 'type' => Controls_Manager::SELECT, | |
| 661 | + 'options' => [] | |
| 662 | + ] | |
| 663 | + ); | |
| 664 | + | |
| 665 | + $this->add_control( | |
| 666 | + 'last_name_field', | |
| 667 | + [ | |
| 668 | + 'label' => esc_html__('Last Name', 'king-addons'), | |
| 669 | + 'type' => Controls_Manager::SELECT, | |
| 670 | + 'options' => [] | |
| 671 | + ] | |
| 672 | + ); | |
| 673 | + | |
| 674 | + $this->add_control( | |
| 675 | + 'phone_field', | |
| 676 | + [ | |
| 677 | + 'label' => esc_html__('Phone', 'king-addons'), | |
| 678 | + 'type' => Controls_Manager::SELECT, | |
| 679 | + 'options' => [] | |
| 680 | + ] | |
| 681 | + ); | |
| 682 | + | |
| 683 | + $this->add_control( | |
| 684 | + 'birthday_field', | |
| 685 | + [ | |
| 686 | + 'label' => esc_html__('Birthday', 'king-addons'), | |
| 687 | + 'type' => Controls_Manager::SELECT, | |
| 688 | + 'options' => [] | |
| 689 | + ] | |
| 690 | + ); | |
| 691 | + | |
| 692 | + $this->add_control( | |
| 693 | + 'address_field', | |
| 694 | + [ | |
| 695 | + 'label' => esc_html__('Address', 'king-addons'), | |
| 696 | + 'type' => Controls_Manager::SELECT, | |
| 697 | + 'options' => [] | |
| 698 | + ] | |
| 699 | + ); | |
| 700 | + | |
| 701 | + $this->add_control( | |
| 702 | + 'country_field', | |
| 703 | + [ | |
| 704 | + 'label' => esc_html__('Country', 'king-addons'), | |
| 705 | + 'type' => Controls_Manager::SELECT, | |
| 706 | + 'options' => [] | |
| 707 | + ] | |
| 708 | + ); | |
| 709 | + | |
| 710 | + $this->add_control( | |
| 711 | + 'city_field', | |
| 712 | + [ | |
| 713 | + 'label' => esc_html__('City', 'king-addons'), | |
| 714 | + 'type' => Controls_Manager::SELECT, | |
| 715 | + 'options' => [] | |
| 716 | + ] | |
| 717 | + ); | |
| 718 | + | |
| 719 | + $this->add_control( | |
| 720 | + 'state_field', | |
| 721 | + [ | |
| 722 | + 'label' => esc_html__('State', 'king-addons'), | |
| 723 | + 'type' => Controls_Manager::SELECT, | |
| 724 | + 'options' => [] | |
| 725 | + ] | |
| 726 | + ); | |
| 727 | + | |
| 728 | + $this->add_control( | |
| 729 | + 'zip_field', | |
| 730 | + [ | |
| 731 | + 'label' => esc_html__('Zip', 'king-addons'), | |
| 732 | + 'type' => Controls_Manager::SELECT, | |
| 733 | + 'options' => [] | |
| 734 | + ] | |
| 735 | + ); | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | +$this->end_controls_section(); | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + } | |
| 745 | + | |
| 746 | + public $last_prev_btn_text; | |
| 747 | + | |
| 748 | + public $last_next_btn_text; | |
| 749 | + | |
| 750 | + protected function register_controls() | |
| 751 | + { | |
| 752 | + | |
| 753 | + $this->start_controls_section( | |
| 754 | + 'section_form_fields', | |
| 755 | + [ | |
| 756 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Fields', 'king-addons'), | |
| 757 | + ] | |
| 758 | + ); | |
| 759 | + | |
| 760 | + | |
| 761 | + $repeater = new Repeater(); | |
| 762 | + | |
| 763 | + $field_types = [ | |
| 764 | + 'text' => esc_html__('Text', 'king-addons'), | |
| 765 | + 'textarea' => esc_html__('Textarea', 'king-addons'), | |
| 766 | + 'email' => esc_html__('Email', 'king-addons'), | |
| 767 | + 'url' => esc_html__('URL (Link)', 'king-addons'), | |
| 768 | + 'number' => esc_html__('Number', 'king-addons'), | |
| 769 | + 'tel' => esc_html__('Tel (Phone Number)', 'king-addons'), | |
| 770 | + 'radio' => esc_html__('Radio', 'king-addons'), | |
| 771 | + 'select' => esc_html__('Select', 'king-addons'), | |
| 772 | + 'checkbox' => esc_html__('Checkbox', 'king-addons'), | |
| 773 | + 'date' => esc_html__('Date', 'king-addons'), | |
| 774 | + 'time' => esc_html__('Time', 'king-addons'), | |
| 775 | + 'upload' => esc_html__('File Upload', 'king-addons'), | |
| 776 | + 'password' => esc_html__('Password', 'king-addons'), | |
| 777 | + 'html' => esc_html__('HTML', 'king-addons'), | |
| 778 | + 'recaptcha-v3' => esc_html__('reCAPTCHA V3', 'king-addons'), | |
| 779 | + 'hidden' => esc_html__('Hidden Field', 'king-addons'), | |
| 780 | + 'king-addons-fb-step' => esc_html__('Step', 'king-addons'), | |
| 781 | + ]; | |
| 782 | + | |
| 783 | + // Range, rating, signature and acceptance: controls and markup live in | |
| 784 | + // helpers/Extra_Fields.php. | |
| 785 | + if (class_exists('King_Addons\\Form_Extra_Fields')) { | |
| 786 | + $field_types = array_merge($field_types, Form_Extra_Fields::field_types()); | |
| 787 | + } | |
| 788 | + | |
| 789 | + $repeater->add_control( | |
| 790 | + 'field_type', | |
| 791 | + [ | |
| 792 | + 'label' => esc_html__('Type', 'king-addons'), | |
| 793 | + 'type' => Controls_Manager::SELECT, | |
| 794 | + 'options' => $field_types, | |
| 795 | + 'default' => 'text', | |
| 796 | + ] | |
| 797 | + ); | |
| 798 | + | |
| 799 | + $repeater->add_control( | |
| 800 | + 'field_step_notice', | |
| 801 | + [ | |
| 802 | + 'type' => Controls_Manager::RAW_HTML, | |
| 803 | + 'raw' => esc_html__('Step should be a First element of fields group. Ex: Step 1 followed by Field 1, Field 2. Step 2 followed by Field 3, Field 4.', 'king-addons'), | |
| 804 | + 'content_classes' => 'elementor-panel-alert', | |
| 805 | + 'condition' => [ | |
| 806 | + 'field_type' => 'king-addons-fb-step' | |
| 807 | + ] | |
| 808 | + ] | |
| 809 | + ); | |
| 810 | + | |
| 811 | + if (class_exists('King_Addons\\Form_Extra_Fields')) { | |
| 812 | + Form_Extra_Fields::register_controls($repeater); | |
| 813 | + } | |
| 814 | + | |
| 815 | + if (class_exists('King_Addons\\Form_Conditional_Logic')) { | |
| 816 | + Form_Conditional_Logic::register_controls($repeater); | |
| 817 | + } | |
| 818 | + | |
| 819 | + if ('' == get_option('king_addons_recaptcha_v3_site_key')) { | |
| 820 | + $repeater->add_control( | |
| 821 | + 'recaptcha_key_notice', | |
| 822 | + [ | |
| 823 | + 'type' => Controls_Manager::RAW_HTML, | |
| 824 | + 'raw' => sprintf(__('Navigate to <strong><a href="%s" target="_blank">Dashboard > %s > Integrations</a></strong> to set up <strong>reCaptcha Site Key</strong>.', 'king-addons'), admin_url('admin.php?page=king-addons-settings'), Core::getPluginName()), | |
| 825 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 826 | + 'condition' => [ | |
| 827 | + 'field_type' => 'recaptcha-v3' | |
| 828 | + ] | |
| 829 | + ] | |
| 830 | + ); | |
| 831 | + } | |
| 832 | + | |
| 833 | + $repeater->add_control( | |
| 834 | + 'field_label', | |
| 835 | + [ | |
| 836 | + 'label' => esc_html__('Label', 'king-addons'), | |
| 837 | + 'type' => Controls_Manager::TEXT, | |
| 838 | + 'default' => '', | |
| 839 | + 'dynamic' => [ | |
| 840 | + 'active' => true, | |
| 841 | + ], | |
| 842 | + ] | |
| 843 | + ); | |
| 844 | + | |
| 845 | + $repeater->add_control( | |
| 846 | + 'field_sub_label', | |
| 847 | + [ | |
| 848 | + 'label' => esc_html__('Sub Label', 'king-addons'), | |
| 849 | + 'type' => Controls_Manager::TEXT, | |
| 850 | + 'default' => '', | |
| 851 | + 'dynamic' => [ | |
| 852 | + 'active' => true, | |
| 853 | + ], | |
| 854 | + 'condition' => [ | |
| 855 | + 'field_type' => 'king-addons-fb-step' | |
| 856 | + ] | |
| 857 | + ] | |
| 858 | + ); | |
| 859 | + | |
| 860 | + $repeater->add_control( | |
| 861 | + 'previous_button_text', | |
| 862 | + [ | |
| 863 | + 'label' => esc_html__('Previous Button', 'king-addons'), | |
| 864 | + 'type' => Controls_Manager::TEXT, | |
| 865 | + 'default' => 'Previous', | |
| 866 | + 'dynamic' => [ | |
| 867 | + 'active' => true, | |
| 868 | + ], | |
| 869 | + 'condition' => [ | |
| 870 | + 'field_type' => 'king-addons-fb-step' | |
| 871 | + ] | |
| 872 | + ] | |
| 873 | + ); | |
| 874 | + | |
| 875 | + $repeater->add_control( | |
| 876 | + 'next_button_text', | |
| 877 | + [ | |
| 878 | + 'label' => esc_html__('Next Button', 'king-addons'), | |
| 879 | + 'type' => Controls_Manager::TEXT, | |
| 880 | + 'default' => 'Next', | |
| 881 | + 'dynamic' => [ | |
| 882 | + 'active' => true, | |
| 883 | + ], | |
| 884 | + 'condition' => [ | |
| 885 | + 'field_type' => 'king-addons-fb-step' | |
| 886 | + ] | |
| 887 | + ] | |
| 888 | + ); | |
| 889 | + | |
| 890 | + $repeater->add_control( | |
| 891 | + 'step_icon', | |
| 892 | + [ | |
| 893 | + 'label' => esc_html__('Icon', 'king-addons'), | |
| 894 | + 'type' => Controls_Manager::ICONS, | |
| 895 | + 'skin' => 'inline', | |
| 896 | + 'label_block' => false, | |
| 897 | + 'separator' => 'before', | |
| 898 | + 'default' => [ | |
| 899 | + 'value' => 'far fa-edit', | |
| 900 | + 'library' => 'regular' | |
| 901 | + ], | |
| 902 | + 'condition' => [ | |
| 903 | + 'field_type' => 'king-addons-fb-step' | |
| 904 | + ] | |
| 905 | + ] | |
| 906 | + ); | |
| 907 | + | |
| 908 | + $repeater->add_control( | |
| 909 | + 'placeholder', | |
| 910 | + [ | |
| 911 | + 'label' => esc_html__('Placeholder', 'king-addons'), | |
| 912 | + 'type' => Controls_Manager::TEXT, | |
| 913 | + 'default' => '', | |
| 914 | + 'conditions' => [ | |
| 915 | + 'terms' => [ | |
| 916 | + [ | |
| 917 | + 'name' => 'field_type', | |
| 918 | + 'operator' => 'in', | |
| 919 | + 'value' => [ | |
| 920 | + 'tel', | |
| 921 | + 'text', | |
| 922 | + 'email', | |
| 923 | + 'textarea', | |
| 924 | + 'number', | |
| 925 | + 'url', | |
| 926 | + 'password', | |
| 927 | + ], | |
| 928 | + ], | |
| 929 | + ], | |
| 930 | + ], | |
| 931 | + 'dynamic' => [ | |
| 932 | + 'active' => true, | |
| 933 | + ], | |
| 934 | + ] | |
| 935 | + ); | |
| 936 | + | |
| 937 | + $repeater->add_control( | |
| 938 | + 'field_value', | |
| 939 | + [ | |
| 940 | + 'label' => esc_html__('Default Value', 'king-addons'), | |
| 941 | + 'type' => Controls_Manager::TEXT, | |
| 942 | + 'default' => '', | |
| 943 | + 'dynamic' => [ | |
| 944 | + 'active' => true, | |
| 945 | + ], | |
| 946 | + 'conditions' => [ | |
| 947 | + 'terms' => [ | |
| 948 | + [ | |
| 949 | + 'name' => 'field_type', | |
| 950 | + 'operator' => 'in', | |
| 951 | + 'value' => [ | |
| 952 | + 'text', | |
| 953 | + 'email', | |
| 954 | + 'textarea', | |
| 955 | + 'url', | |
| 956 | + 'tel', | |
| 957 | + 'radio', | |
| 958 | + 'select', | |
| 959 | + 'number', | |
| 960 | + 'date', | |
| 961 | + 'time', | |
| 962 | + 'hidden', | |
| 963 | + ], | |
| 964 | + ], | |
| 965 | + ], | |
| 966 | + ], | |
| 967 | + ] | |
| 968 | + ); | |
| 969 | + | |
| 970 | + $repeater->add_control( | |
| 971 | + 'field_id', | |
| 972 | + [ | |
| 973 | + 'label' => esc_html__('ID', 'king-addons'), | |
| 974 | + 'type' => Controls_Manager::TEXT, | |
| 975 | + 'description' => esc_html__('Element ID should be unique and not used elsewhere in this widget.', 'king-addons'), | |
| 976 | + 'default' => '', | |
| 977 | + 'render_type' => 'none', | |
| 978 | + 'required' => true, | |
| 979 | + 'dynamic' => [ | |
| 980 | + 'active' => true, | |
| 981 | + ] | |
| 982 | + ] | |
| 983 | + ); | |
| 984 | + | |
| 985 | + $shortcode_value = '{{ view.container.settings.get( \'field_id\' ) }}'; | |
| 986 | + | |
| 987 | + $repeater->add_control( | |
| 988 | + 'shortcode', | |
| 989 | + [ | |
| 990 | + 'label' => esc_html__('Shortcode', 'king-addons'), | |
| 991 | + 'type' => Controls_Manager::RAW_HTML, | |
| 992 | + 'classes' => 'forms-field-shortcode', | |
| 993 | + 'raw' => '<input class="king-addons-form-field-shortcode" value=\'[id="' . $shortcode_value . '"]\' readonly />' | |
| 994 | + ] | |
| 995 | + ); | |
| 996 | + | |
| 997 | + $repeater->add_control( | |
| 998 | + 'required', | |
| 999 | + [ | |
| 1000 | + 'label' => esc_html__('Required', 'king-addons'), | |
| 1001 | + 'type' => Controls_Manager::SWITCHER, | |
| 1002 | + 'return_value' => 'true', | |
| 1003 | + 'default' => '', | |
| 1004 | + 'conditions' => [ | |
| 1005 | + 'terms' => [ | |
| 1006 | + [ | |
| 1007 | + 'name' => 'field_type', | |
| 1008 | + 'operator' => '!in', | |
| 1009 | + 'value' => [ | |
| 1010 | + 'recaptcha', | |
| 1011 | + 'recaptcha-v3', | |
| 1012 | + 'hidden', | |
| 1013 | + 'html', | |
| 1014 | + 'king-addons-fb-step', | |
| 1015 | + ], | |
| 1016 | + ], | |
| 1017 | + ], | |
| 1018 | + ], | |
| 1019 | + ] | |
| 1020 | + ); | |
| 1021 | + | |
| 1022 | + $repeater->add_control( | |
| 1023 | + 'allow_multiple_upload', | |
| 1024 | + [ | |
| 1025 | + 'label' => esc_html__('Multiple', 'king-addons'), | |
| 1026 | + 'type' => Controls_Manager::SWITCHER, | |
| 1027 | + 'condition' => [ | |
| 1028 | + 'field_type' => 'upload' | |
| 1029 | + ], | |
| 1030 | + ] | |
| 1031 | + ); | |
| 1032 | + | |
| 1033 | + $max_file_size = wp_max_upload_size() / pow(1024, 2); | |
| 1034 | + | |
| 1035 | + $repeater->add_control( | |
| 1036 | + 'file_size', | |
| 1037 | + [ | |
| 1038 | + 'label' => esc_html__('File Size (MB)', 'king-addons'), | |
| 1039 | + 'type' => Controls_Manager::NUMBER, | |
| 1040 | + 'min' => 1, | |
| 1041 | + 'max' => $max_file_size, | |
| 1042 | + 'king-addons-fb-step' => 1, | |
| 1043 | + 'description' => esc_html__('Max upload size allowed is ' . $max_file_size . 'MB. Please contact your hosting to increase it.', 'king-addons'), | |
| 1044 | + 'condition' => [ | |
| 1045 | + 'field_type' => 'upload' | |
| 1046 | + ] | |
| 1047 | + ] | |
| 1048 | + ); | |
| 1049 | + | |
| 1050 | + $repeater->add_control( | |
| 1051 | + 'file_types', | |
| 1052 | + [ | |
| 1053 | + 'label' => esc_html__('File Types', 'king-addons'), | |
| 1054 | + 'type' => Controls_Manager::TEXT, | |
| 1055 | + 'description' => esc_html__('Enter the comma separated file types to allow.', 'king-addons'), | |
| 1056 | + 'condition' => [ | |
| 1057 | + 'field_type' => 'upload', | |
| 1058 | + ] | |
| 1059 | + ] | |
| 1060 | + ); | |
| 1061 | + | |
| 1062 | + $repeater->add_control( | |
| 1063 | + 'field_options', | |
| 1064 | + [ | |
| 1065 | + 'label' => esc_html__('Options', 'king-addons'), | |
| 1066 | + 'type' => Controls_Manager::TEXTAREA, | |
| 1067 | + 'default' => '', | |
| 1068 | + 'description' => esc_html__('Insert each option on a separate line. To set a different label and value for an option, separate them with a pipe ("|"). Example: First Option|f_option', 'king-addons'), | |
| 1069 | + 'conditions' => [ | |
| 1070 | + 'terms' => [ | |
| 1071 | + [ | |
| 1072 | + 'name' => 'field_type', | |
| 1073 | + 'operator' => 'in', | |
| 1074 | + 'value' => [ | |
| 1075 | + 'select', | |
| 1076 | + 'checkbox', | |
| 1077 | + 'radio', | |
| 1078 | + ], | |
| 1079 | + ], | |
| 1080 | + ], | |
| 1081 | + ], | |
| 1082 | + ] | |
| 1083 | + ); | |
| 1084 | + | |
| 1085 | + $repeater->add_control( | |
| 1086 | + 'allow_multiple', | |
| 1087 | + [ | |
| 1088 | + 'label' => esc_html__('Multiple Selection', 'king-addons'), | |
| 1089 | + 'type' => Controls_Manager::SWITCHER, | |
| 1090 | + 'return_value' => 'true', | |
| 1091 | + 'conditions' => [ | |
| 1092 | + 'terms' => [ | |
| 1093 | + [ | |
| 1094 | + 'name' => 'field_type', | |
| 1095 | + 'value' => 'select', | |
| 1096 | + ], | |
| 1097 | + ], | |
| 1098 | + ], | |
| 1099 | + ] | |
| 1100 | + ); | |
| 1101 | + | |
| 1102 | + $repeater->add_control( | |
| 1103 | + 'select_size', | |
| 1104 | + [ | |
| 1105 | + 'label' => esc_html__('Rows', 'king-addons'), | |
| 1106 | + 'type' => Controls_Manager::NUMBER, | |
| 1107 | + 'min' => 2, | |
| 1108 | + 'king-addons-fb-step' => 1, | |
| 1109 | + 'conditions' => [ | |
| 1110 | + 'terms' => [ | |
| 1111 | + [ | |
| 1112 | + 'name' => 'field_type', | |
| 1113 | + 'value' => 'select', | |
| 1114 | + ], | |
| 1115 | + [ | |
| 1116 | + 'name' => 'allow_multiple', | |
| 1117 | + 'value' => 'true', | |
| 1118 | + ], | |
| 1119 | + ], | |
| 1120 | + ], | |
| 1121 | + ] | |
| 1122 | + ); | |
| 1123 | + | |
| 1124 | + $repeater->add_control( | |
| 1125 | + 'inline_list', | |
| 1126 | + [ | |
| 1127 | + 'label' => esc_html__('Inline List', 'king-addons'), | |
| 1128 | + 'type' => Controls_Manager::SWITCHER, | |
| 1129 | + 'return_value' => 'king-addons-inline-sub-group', | |
| 1130 | + 'default' => '', | |
| 1131 | + 'conditions' => [ | |
| 1132 | + 'terms' => [ | |
| 1133 | + [ | |
| 1134 | + 'name' => 'field_type', | |
| 1135 | + 'operator' => 'in', | |
| 1136 | + 'value' => [ | |
| 1137 | + 'checkbox', | |
| 1138 | + 'radio', | |
| 1139 | + ], | |
| 1140 | + ], | |
| 1141 | + ], | |
| 1142 | + ], | |
| 1143 | + ] | |
| 1144 | + ); | |
| 1145 | + | |
| 1146 | + $repeater->add_control( | |
| 1147 | + 'field_html', | |
| 1148 | + [ | |
| 1149 | + 'label' => esc_html__('HTML', 'king-addons'), | |
| 1150 | + 'type' => Controls_Manager::TEXTAREA, | |
| 1151 | + 'dynamic' => [ | |
| 1152 | + 'active' => true, | |
| 1153 | + ], | |
| 1154 | + 'conditions' => [ | |
| 1155 | + 'terms' => [ | |
| 1156 | + [ | |
| 1157 | + 'name' => 'field_type', | |
| 1158 | + 'value' => 'html', | |
| 1159 | + ], | |
| 1160 | + ], | |
| 1161 | + ], | |
| 1162 | + ] | |
| 1163 | + ); | |
| 1164 | + | |
| 1165 | + $repeater->add_responsive_control( | |
| 1166 | + 'width', | |
| 1167 | + [ | |
| 1168 | + 'label' => esc_html__('Column Width', 'king-addons'), | |
| 1169 | + 'type' => Controls_Manager::SLIDER, | |
| 1170 | + 'size_units' => ['%'], | |
| 1171 | + 'range' => [ | |
| 1172 | + '%' => [ | |
| 1173 | + 'min' => 10, | |
| 1174 | + 'max' => 100, | |
| 1175 | + ], | |
| 1176 | + ], | |
| 1177 | + 'default' => [ | |
| 1178 | + 'unit' => '%', | |
| 1179 | + 'size' => 100, | |
| 1180 | + ], | |
| 1181 | + 'selectors' => [ | |
| 1182 | + '{{WRAPPER}} {{CURRENT_ITEM}}' => 'width: {{SIZE}}%;', | |
| 1183 | + ], | |
| 1184 | + 'conditions' => [ | |
| 1185 | + 'terms' => [ | |
| 1186 | + [ | |
| 1187 | + 'name' => 'field_type', | |
| 1188 | + 'operator' => '!in', | |
| 1189 | + 'value' => [ | |
| 1190 | + 'hidden', | |
| 1191 | + 'recaptcha', | |
| 1192 | + 'recaptcha-v3', | |
| 1193 | + 'king-addons-fb-step', | |
| 1194 | + ], | |
| 1195 | + ], | |
| 1196 | + ], | |
| 1197 | + ], | |
| 1198 | + ] | |
| 1199 | + ); | |
| 1200 | + | |
| 1201 | + $repeater->add_control( | |
| 1202 | + 'rows', | |
| 1203 | + [ | |
| 1204 | + 'label' => esc_html__('Rows', 'king-addons'), | |
| 1205 | + 'type' => Controls_Manager::NUMBER, | |
| 1206 | + 'default' => 7, | |
| 1207 | + 'conditions' => [ | |
| 1208 | + 'terms' => [ | |
| 1209 | + [ | |
| 1210 | + 'name' => 'field_type', | |
| 1211 | + 'value' => 'textarea', | |
| 1212 | + ], | |
| 1213 | + ], | |
| 1214 | + ], | |
| 1215 | + ] | |
| 1216 | + ); | |
| 1217 | + | |
| 1218 | + $repeater->add_control( | |
| 1219 | + 'recaptcha_size', [ | |
| 1220 | + 'label' => esc_html__('Size', 'king-addons'), | |
| 1221 | + 'type' => Controls_Manager::SELECT, | |
| 1222 | + 'default' => 'normal', | |
| 1223 | + 'options' => [ | |
| 1224 | + 'normal' => esc_html__('Normal', 'king-addons'), | |
| 1225 | + 'compact' => esc_html__('Compact', 'king-addons'), | |
| 1226 | + ], | |
| 1227 | + 'conditions' => [ | |
| 1228 | + 'terms' => [ | |
| 1229 | + [ | |
| 1230 | + 'name' => 'field_type', | |
| 1231 | + 'value' => 'recaptcha', | |
| 1232 | + ], | |
| 1233 | + ], | |
| 1234 | + ], | |
| 1235 | + ] | |
| 1236 | + ); | |
| 1237 | + | |
| 1238 | + $repeater->add_control( | |
| 1239 | + 'recaptcha_style', | |
| 1240 | + [ | |
| 1241 | + 'label' => esc_html__('Style', 'king-addons'), | |
| 1242 | + 'type' => Controls_Manager::SELECT, | |
| 1243 | + 'default' => 'light', | |
| 1244 | + 'options' => [ | |
| 1245 | + 'light' => esc_html__('Light', 'king-addons'), | |
| 1246 | + 'dark' => esc_html__('Dark', 'king-addons'), | |
| 1247 | + ], | |
| 1248 | + 'conditions' => [ | |
| 1249 | + 'terms' => [ | |
| 1250 | + [ | |
| 1251 | + 'name' => 'field_type', | |
| 1252 | + 'value' => 'recaptcha', | |
| 1253 | + ], | |
| 1254 | + ], | |
| 1255 | + ], | |
| 1256 | + ] | |
| 1257 | + ); | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + $repeater->add_control( | |
| 1261 | + 'css_classes', | |
| 1262 | + [ | |
| 1263 | + 'label' => esc_html__('CSS Classes', 'king-addons'), | |
| 1264 | + 'type' => Controls_Manager::HIDDEN, | |
| 1265 | + 'default' => '', | |
| 1266 | + 'title' => esc_html__('Add your custom class without the dot, e.g: "your-class"', 'king-addons'), | |
| 1267 | + ] | |
| 1268 | + ); | |
| 1269 | + | |
| 1270 | + $this->add_control( | |
| 1271 | + 'form_fields', | |
| 1272 | + [ | |
| 1273 | + | |
| 1274 | + 'type' => Controls_Manager::REPEATER, | |
| 1275 | + 'fields' => $repeater->get_controls(), | |
| 1276 | + 'default' => [ | |
| 1277 | + [ | |
| 1278 | + 'field_id' => 'name', | |
| 1279 | + 'field_type' => 'text', | |
| 1280 | + 'field_label' => esc_html__('Name', 'king-addons'), | |
| 1281 | + 'placeholder' => esc_html__('Name', 'king-addons'), | |
| 1282 | + 'width' => '100', | |
| 1283 | + 'dynamic' => [ | |
| 1284 | + 'active' => true, | |
| 1285 | + ], | |
| 1286 | + ], | |
| 1287 | + [ | |
| 1288 | + 'field_id' => 'email', | |
| 1289 | + 'field_type' => 'email', | |
| 1290 | + 'required' => 'true', | |
| 1291 | + 'field_label' => esc_html__('Email', 'king-addons'), | |
| 1292 | + 'placeholder' => esc_html__('Email', 'king-addons'), | |
| 1293 | + 'width' => '100', | |
| 1294 | + ], | |
| 1295 | + [ | |
| 1296 | + 'field_id' => 'message', | |
| 1297 | + 'field_type' => 'textarea', | |
| 1298 | + 'field_label' => esc_html__('Message', 'king-addons'), | |
| 1299 | + 'placeholder' => esc_html__('Message', 'king-addons'), | |
| 1300 | + 'width' => '100', | |
| 1301 | + ], | |
| 1302 | + ], | |
| 1303 | + 'title_field' => '{{ field_label }}', | |
| 1304 | + ] | |
| 1305 | + ); | |
| 1306 | + | |
| 1307 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 1308 | + $this->add_control( | |
| 1309 | + 'fields_to_show_pro_notice', | |
| 1310 | + [ | |
| 1311 | + 'type' => Controls_Manager::RAW_HTML, | |
| 1312 | + 'raw' => __('More than 3 Fields (Excluding Steps) are available in the <strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-form-builder-settings-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>'), | |
| 1313 | + 'content_classes' => 'king-addons-pro-notice' | |
| 1314 | + ] | |
| 1315 | + ); | |
| 1316 | + } | |
| 1317 | + | |
| 1318 | + $this->end_controls_section(); | |
| 1319 | + | |
| 1320 | + $this->start_controls_section( | |
| 1321 | + 'section_buttons', | |
| 1322 | + [ | |
| 1323 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Buttons', 'king-addons'), | |
| 1324 | + ] | |
| 1325 | + ); | |
| 1326 | + | |
| 1327 | + $this->add_responsive_control( | |
| 1328 | + 'button_width', | |
| 1329 | + [ | |
| 1330 | + 'label' => esc_html__('Column Width', 'king-addons'), | |
| 1331 | + 'type' => Controls_Manager::SLIDER, | |
| 1332 | + 'size_units' => ['%'], | |
| 1333 | + 'range' => [ | |
| 1334 | + '%' => [ | |
| 1335 | + 'min' => 10, | |
| 1336 | + 'max' => 100, | |
| 1337 | + ], | |
| 1338 | + ], | |
| 1339 | + 'default' => [ | |
| 1340 | + 'unit' => '%', | |
| 1341 | + 'size' => 100, | |
| 1342 | + ], | |
| 1343 | + 'selectors' => [ | |
| 1344 | + '{{WRAPPER}} .king-addons-field-group.king-addons-form-field-type-submit' => 'width: {{SIZE}}%;', | |
| 1345 | + '{{WRAPPER}} .king-addons-step-buttons-wrap' => 'width: {{SIZE}}%;' | |
| 1346 | + ], | |
| 1347 | + 'frontend_available' => true, | |
| 1348 | + ] | |
| 1349 | + ); | |
| 1350 | + | |
| 1351 | + $this->add_responsive_control( | |
| 1352 | + 'buttons_width', | |
| 1353 | + [ | |
| 1354 | + 'label' => esc_html__('Step Buttons Width', 'king-addons'), | |
| 1355 | + 'type' => Controls_Manager::SLIDER, | |
| 1356 | + 'size_units' => ['px', '%'], | |
| 1357 | + 'range' => [ | |
| 1358 | + 'px' => [ | |
| 1359 | + 'min' => 0, | |
| 1360 | + 'max' => 500, | |
| 1361 | + ], | |
| 1362 | + '%' => [ | |
| 1363 | + 'min' => 0, | |
| 1364 | + 'max' => 100, | |
| 1365 | + ] | |
| 1366 | + ], | |
| 1367 | + 'default' => [ | |
| 1368 | + 'unit' => 'px', | |
| 1369 | + 'size' => 150, | |
| 1370 | + ], | |
| 1371 | + 'selectors' => [ | |
| 1372 | + '{{WRAPPER}} .king-addons-fb-step-prev' => 'width: {{SIZE}}{{UNIT}};', | |
| 1373 | + '{{WRAPPER}} .king-addons-fb-step-next' => 'width: {{SIZE}}{{UNIT}};', | |
| 1374 | + '{{WRAPPER}} .king-addons-fb-step-tab .king-addons-button' => 'width: {{SIZE}}{{UNIT}};' | |
| 1375 | + ], | |
| 1376 | + ] | |
| 1377 | + ); | |
| 1378 | + | |
| 1379 | + $this->add_responsive_control( | |
| 1380 | + 'button_align', | |
| 1381 | + [ | |
| 1382 | + 'label' => esc_html__('Alignment', 'king-addons'), | |
| 1383 | + 'type' => Controls_Manager::CHOOSE, | |
| 1384 | + 'options' => [ | |
| 1385 | + 'left' => [ | |
| 1386 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 1387 | + 'icon' => 'eicon-text-align-left', | |
| 1388 | + ], | |
| 1389 | + 'center' => [ | |
| 1390 | + 'title' => esc_html__('Center', 'king-addons'), | |
| 1391 | + 'icon' => 'eicon-text-align-center', | |
| 1392 | + ], | |
| 1393 | + 'right' => [ | |
| 1394 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 1395 | + 'icon' => 'eicon-text-align-right', | |
| 1396 | + ], | |
| 1397 | + ], | |
| 1398 | + 'default' => 'center', | |
| 1399 | + 'selectors_dictionary' => [ | |
| 1400 | + 'left' => 'margin-left: 0; margin-right: auto;', | |
| 1401 | + 'center' => 'margin-left: auto; margin-right: auto;', | |
| 1402 | + 'right' => 'margin-left: auto; margin-right: 0;' | |
| 1403 | + ], | |
| 1404 | + 'selectors' => [ | |
| 1405 | + '{{WRAPPER}} .king-addons-step-buttons-wrap' => '{{VALUE}}', | |
| 1406 | + '{{WRAPPER}} .king-addons-fb-step-tab:first-of-type .king-addons-fb-step-next' => '{{VALUE}}', | |
| 1407 | + ], | |
| 1408 | + ] | |
| 1409 | + ); | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + $this->add_control( | |
| 1413 | + 'heading_submit_button', | |
| 1414 | + [ | |
| 1415 | + 'label' => esc_html__('Submit Button', 'king-addons'), | |
| 1416 | + 'type' => Controls_Manager::HEADING, | |
| 1417 | + ] | |
| 1418 | + ); | |
| 1419 | + | |
| 1420 | + $this->add_control( | |
| 1421 | + 'button_text', | |
| 1422 | + [ | |
| 1423 | + 'label' => esc_html__('Submit', 'king-addons'), | |
| 1424 | + 'type' => Controls_Manager::TEXT, | |
| 1425 | + 'default' => esc_html__('Send', 'king-addons'), | |
| 1426 | + 'placeholder' => esc_html__('Send', 'king-addons'), | |
| 1427 | + 'dynamic' => [ | |
| 1428 | + 'active' => true, | |
| 1429 | + ], | |
| 1430 | + ] | |
| 1431 | + ); | |
| 1432 | + | |
| 1433 | + $this->add_control( | |
| 1434 | + 'selected_button_icon', | |
| 1435 | + [ | |
| 1436 | + 'label' => esc_html__('Icon', 'king-addons'), | |
| 1437 | + 'type' => Controls_Manager::ICONS, | |
| 1438 | + 'skin' => 'inline', | |
| 1439 | + 'label_block' => false, | |
| 1440 | + ] | |
| 1441 | + ); | |
| 1442 | + | |
| 1443 | + $this->add_control( | |
| 1444 | + 'button_icon_align', | |
| 1445 | + [ | |
| 1446 | + 'label' => esc_html__('Icon Position', 'king-addons'), | |
| 1447 | + 'type' => Controls_Manager::SELECT, | |
| 1448 | + 'default' => 'left', | |
| 1449 | + 'options' => [ | |
| 1450 | + 'left' => esc_html__('Before', 'king-addons'), | |
| 1451 | + 'right' => esc_html__('After', 'king-addons'), | |
| 1452 | + ], | |
| 1453 | + 'condition' => [ | |
| 1454 | + 'selected_button_icon[value]!' => '', | |
| 1455 | + ], | |
| 1456 | + ] | |
| 1457 | + ); | |
| 1458 | + | |
| 1459 | + $this->add_control( | |
| 1460 | + 'button_icon_indent', | |
| 1461 | + [ | |
| 1462 | + 'label' => esc_html__('Icon Spacing', 'king-addons'), | |
| 1463 | + 'type' => Controls_Manager::SLIDER, | |
| 1464 | + 'range' => [ | |
| 1465 | + 'px' => [ | |
| 1466 | + 'max' => 50, | |
| 1467 | + ], | |
| 1468 | + ], | |
| 1469 | + 'condition' => [ | |
| 1470 | + 'selected_button_icon[value]!' => '', | |
| 1471 | + ], | |
| 1472 | + 'selectors' => [ | |
| 1473 | + '{{WRAPPER}} .king-addons-button .king-addons-align-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};', | |
| 1474 | + '{{WRAPPER}} .king-addons-button .king-addons-align-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};', | |
| 1475 | + ], | |
| 1476 | + ] | |
| 1477 | + ); | |
| 1478 | + | |
| 1479 | + $this->add_control( | |
| 1480 | + 'button_css_id', | |
| 1481 | + [ | |
| 1482 | + 'label' => esc_html__('Button ID', 'king-addons'), | |
| 1483 | + 'type' => Controls_Manager::TEXT, | |
| 1484 | + 'default' => '', | |
| 1485 | + 'title' => esc_html__('Add your custom id WITHOUT the Pound key. e.g: my-id', 'king-addons'), | |
| 1486 | + 'description' => esc_html__('Element ID should be unique and not used elsewhere in this widget', 'king-addons'), | |
| 1487 | + 'separator' => 'before', | |
| 1488 | + 'dynamic' => [ | |
| 1489 | + 'active' => true, | |
| 1490 | + ], | |
| 1491 | + ] | |
| 1492 | + ); | |
| 1493 | + | |
| 1494 | + $this->end_controls_section(); | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + $this->start_controls_section( | |
| 1498 | + 'section_form_settings', | |
| 1499 | + [ | |
| 1500 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Settings', 'king-addons'), | |
| 1501 | + 'tab' => Controls_Manager::TAB_CONTENT | |
| 1502 | + ] | |
| 1503 | + ); | |
| 1504 | + | |
| 1505 | + $this->add_control( | |
| 1506 | + 'form_name', | |
| 1507 | + [ | |
| 1508 | + 'label' => esc_html__('Form Name', 'king-addons'), | |
| 1509 | + 'type' => Controls_Manager::TEXT, | |
| 1510 | + 'default' => esc_html__('New Form', 'king-addons'), | |
| 1511 | + 'placeholder' => esc_html__('Form Name', 'king-addons'), | |
| 1512 | + ] | |
| 1513 | + ); | |
| 1514 | + | |
| 1515 | + $this->add_control( | |
| 1516 | + 'form_id', | |
| 1517 | + [ | |
| 1518 | + 'label' => esc_html__('Form ID', 'king-addons'), | |
| 1519 | + 'type' => Controls_Manager::TEXT, | |
| 1520 | + 'placeholder' => 'form_id', | |
| 1521 | + 'description' => esc_html__('Form ID should be unique and shouldn\'t contain spaces', 'king-addons'), | |
| 1522 | + 'separator' => 'after', | |
| 1523 | + 'dynamic' => [ | |
| 1524 | + 'active' => true, | |
| 1525 | + ], | |
| 1526 | + ] | |
| 1527 | + ); | |
| 1528 | + | |
| 1529 | + $this->add_control( | |
| 1530 | + 'success_message', | |
| 1531 | + [ | |
| 1532 | + 'label' => esc_html__('Success Message', 'king-addons'), | |
| 1533 | + 'type' => Controls_Manager::TEXT, | |
| 1534 | + 'default' => esc_html__('Submission successful', 'king-addons'), | |
| 1535 | + 'placeholder' => esc_html__('Submission successful', 'king-addons'), | |
| 1536 | + 'label_block' => true, | |
| 1537 | + 'frontend_available' => true, | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + 'render_type' => 'none', | |
| 1541 | + 'dynamic' => [ | |
| 1542 | + 'active' => true, | |
| 1543 | + ], | |
| 1544 | + ] | |
| 1545 | + ); | |
| 1546 | + | |
| 1547 | + $this->add_control( | |
| 1548 | + 'error_message', | |
| 1549 | + [ | |
| 1550 | + 'label' => esc_html__('Error Message', 'king-addons'), | |
| 1551 | + 'type' => Controls_Manager::TEXT, | |
| 1552 | + 'default' => esc_html__('Submission failed', 'king-addons'), | |
| 1553 | + 'placeholder' => esc_html__('Submission failed', 'king-addons'), | |
| 1554 | + 'label_block' => true, | |
| 1555 | + 'frontend_available' => true, | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + 'render_type' => 'none', | |
| 1559 | + 'dynamic' => [ | |
| 1560 | + 'active' => true, | |
| 1561 | + ], | |
| 1562 | + ] | |
| 1563 | + ); | |
| 1564 | + | |
| 1565 | + $this->add_control( | |
| 1566 | + 'show_labels', | |
| 1567 | + [ | |
| 1568 | + 'label' => esc_html__('Show Field Labels', 'king-addons'), | |
| 1569 | + 'type' => Controls_Manager::SWITCHER, | |
| 1570 | + 'label_on' => esc_html__('Show', 'king-addons'), | |
| 1571 | + 'label_off' => esc_html__('Hide', 'king-addons'), | |
| 1572 | + 'return_value' => 'true', | |
| 1573 | + 'default' => 'true', | |
| 1574 | + 'separator' => 'before', | |
| 1575 | + ] | |
| 1576 | + ); | |
| 1577 | + | |
| 1578 | + $this->add_control( | |
| 1579 | + 'show_placeholders', | |
| 1580 | + [ | |
| 1581 | + 'label' => esc_html__('Show Placeholders', 'king-addons'), | |
| 1582 | + 'type' => Controls_Manager::SWITCHER, | |
| 1583 | + 'label_on' => esc_html__('Show', 'king-addons'), | |
| 1584 | + 'label_off' => esc_html__('Hide', 'king-addons'), | |
| 1585 | + 'return_value' => 'true', | |
| 1586 | + 'default' => 'true' | |
| 1587 | + ] | |
| 1588 | + ); | |
| 1589 | + | |
| 1590 | + $this->add_control( | |
| 1591 | + 'label_position', | |
| 1592 | + [ | |
| 1593 | + 'label' => esc_html__('Label Position', 'king-addons'), | |
| 1594 | + 'type' => Controls_Manager::HIDDEN, | |
| 1595 | + 'options' => [ | |
| 1596 | + 'above' => esc_html__('Above', 'king-addons'), | |
| 1597 | + 'inline' => esc_html__('Inline', 'king-addons'), | |
| 1598 | + ], | |
| 1599 | + 'default' => 'above', | |
| 1600 | + 'condition' => [ | |
| 1601 | + 'show_labels!' => '', | |
| 1602 | + ], | |
| 1603 | + ] | |
| 1604 | + ); | |
| 1605 | + | |
| 1606 | + $this->add_control( | |
| 1607 | + 'mark_required', | |
| 1608 | + [ | |
| 1609 | + 'label' => esc_html__('Show Required Mark', 'king-addons'), | |
| 1610 | + 'type' => Controls_Manager::SWITCHER, | |
| 1611 | + 'label_on' => esc_html__('Show', 'king-addons'), | |
| 1612 | + 'label_off' => esc_html__('Hide', 'king-addons'), | |
| 1613 | + 'default' => '', | |
| 1614 | + 'condition' => [ | |
| 1615 | + 'show_labels!' => '', | |
| 1616 | + ], | |
| 1617 | + ] | |
| 1618 | + ); | |
| 1619 | + | |
| 1620 | + $this->end_controls_section(); | |
| 1621 | + | |
| 1622 | + $this->start_controls_section( | |
| 1623 | + 'section_integration', | |
| 1624 | + [ | |
| 1625 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Actions', 'king-addons'), | |
| 1626 | + ] | |
| 1627 | + ); | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + $default_submit_actions = ['email']; | |
| 1631 | + | |
| 1632 | + $this->add_control( | |
| 1633 | + 'submit_actions', | |
| 1634 | + [ | |
| 1635 | + 'label' => esc_html__('Add Action', 'king-addons'), | |
| 1636 | + 'type' => Controls_Manager::SELECT2, | |
| 1637 | + 'multiple' => true, | |
| 1638 | + 'options' => $this->submit_action_args(), | |
| 1639 | + 'render_type' => 'none', | |
| 1640 | + 'label_block' => true, | |
| 1641 | + 'default' => $default_submit_actions, | |
| 1642 | + 'description' => esc_html__('Select the actions to perform after a user submits the form (e.g., sending an email notification). Once an action is selected, its corresponding settings will be displayed below.', 'king-addons'), | |
| 1643 | + ] | |
| 1644 | + ); | |
| 1645 | + | |
| 1646 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 1647 | + $this->add_control( | |
| 1648 | + 'submit_actions_notice', | |
| 1649 | + [ | |
| 1650 | + 'type' => Controls_Manager::RAW_HTML, | |
| 1651 | + 'raw' => __('<strong>Submission</strong> and <strong>Mailchimp</strong> actions are only available <br> in the <strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-form-builder-settings-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>'), | |
| 1652 | + 'content_classes' => 'king-addons-pro-notice' | |
| 1653 | + ] | |
| 1654 | + ); | |
| 1655 | + } | |
| 1656 | + | |
| 1657 | + if (class_exists('King_Addons\\Form_Partial_Entries')) { | |
| 1658 | + $this->add_control( | |
| 1659 | + 'partial_entries', | |
| 1660 | + [ | |
| 1661 | + 'label' => esc_html__('Save partial entries', 'king-addons'), | |
| 1662 | + 'type' => Controls_Manager::SWITCHER, | |
| 1663 | + 'return_value' => 'yes', | |
| 1664 | + 'separator' => 'before', | |
| 1665 | + 'description' => esc_html__('Keeps what a visitor typed even if they never press submit. Drafts appear alongside submissions and are removed after 30 days.', 'king-addons'), | |
| 1666 | + ] | |
| 1667 | + ); | |
| 1668 | + } | |
| 1669 | + | |
| 1670 | + if (class_exists('King_Addons\\Form_Spam_Protection')) { | |
| 1671 | + $this->add_control( | |
| 1672 | + 'spam_protection', | |
| 1673 | + [ | |
| 1674 | + 'label' => esc_html__('Spam protection', 'king-addons'), | |
| 1675 | + 'type' => Controls_Manager::SELECT, | |
| 1676 | + 'options' => Form_Spam_Protection::modes(), | |
| 1677 | + 'default' => 'none', | |
| 1678 | + 'separator' => 'before', | |
| 1679 | + 'description' => esc_html__('Honeypot needs no account. Turnstile and hCaptcha need their keys in King Addons settings.', 'king-addons'), | |
| 1680 | + ] | |
| 1681 | + ); | |
| 1682 | + } | |
| 1683 | + | |
| 1684 | + $this->end_controls_section(); | |
| 1685 | + | |
| 1686 | + $this->register_settings_section_submissions($this); | |
| 1687 | + | |
| 1688 | + $this->register_settings_section_email($this); | |
| 1689 | + | |
| 1690 | + $this->register_settings_section_webhook($this); | |
| 1691 | + | |
| 1692 | + $this->register_settings_section_integrations($this); | |
| 1693 | + | |
| 1694 | + $this->register_settings_section_payment($this); | |
| 1695 | + | |
| 1696 | + $this->register_settings_section_redirect($this); | |
| 1697 | + | |
| 1698 | + $this->register_settings_section_mailchimp(); | |
| 1699 | + | |
| 1700 | + $this->start_controls_section( | |
| 1701 | + 'section_form_step_settings', | |
| 1702 | + [ | |
| 1703 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Steps', 'king-addons'), | |
| 1704 | + 'tab' => Controls_Manager::TAB_CONTENT | |
| 1705 | + ] | |
| 1706 | + ); | |
| 1707 | + | |
| 1708 | + $this->add_control( | |
| 1709 | + 'step_type', | |
| 1710 | + [ | |
| 1711 | + 'label' => esc_html__('Type', 'king-addons'), | |
| 1712 | + 'type' => Controls_Manager::SELECT, | |
| 1713 | + 'frontend_available' => true, | |
| 1714 | + 'render_type' => 'template', | |
| 1715 | + 'options' => [ | |
| 1716 | + 'none' => 'None', | |
| 1717 | + 'text' => 'Label', | |
| 1718 | + 'icon' => 'Icon', | |
| 1719 | + 'number' => 'Number', | |
| 1720 | + 'progress_bar' => 'Progress Bar', | |
| 1721 | + 'number_text' => 'Number & Label', | |
| 1722 | + 'icon_text' => 'Icon & Label', | |
| 1723 | + ], | |
| 1724 | + 'prefix_class' => 'king-addons-fb-step-type-', | |
| 1725 | + 'default' => 'number_text' | |
| 1726 | + ] | |
| 1727 | + ); | |
| 1728 | + | |
| 1729 | + $this->add_control( | |
| 1730 | + 'step_content_layout', | |
| 1731 | + [ | |
| 1732 | + 'label' => esc_html__('Content Layout', 'king-addons'), | |
| 1733 | + 'type' => Controls_Manager::SELECT, | |
| 1734 | + 'frontend_available' => true, | |
| 1735 | + 'options' => [ | |
| 1736 | + 'horizontal' => 'Horizontal', | |
| 1737 | + 'vertical' => 'Vertical', | |
| 1738 | + ], | |
| 1739 | + 'default' => 'vertical', | |
| 1740 | + 'prefix_class' => 'king-addons-fb-step-content-layout-', | |
| 1741 | + 'condition' => [ | |
| 1742 | + 'step_type!' => ['progress_bar', 'none'] | |
| 1743 | + ] | |
| 1744 | + ] | |
| 1745 | + ); | |
| 1746 | + | |
| 1747 | + $this->add_control( | |
| 1748 | + 'show_separator', | |
| 1749 | + [ | |
| 1750 | + 'label' => esc_html__('Separator', 'king-addons'), | |
| 1751 | + 'type' => Controls_Manager::SWITCHER, | |
| 1752 | + 'default' => 'yes', | |
| 1753 | + 'condition' => [ | |
| 1754 | + 'step_type!' => 'progress_bar' | |
| 1755 | + ] | |
| 1756 | + ] | |
| 1757 | + ); | |
| 1758 | + | |
| 1759 | + $this->add_responsive_control( | |
| 1760 | + 'step_box_align', | |
| 1761 | + [ | |
| 1762 | + 'label' => esc_html__('Box Alignment', 'king-addons'), | |
| 1763 | + 'type' => Controls_Manager::CHOOSE, | |
| 1764 | + 'options' => [ | |
| 1765 | + 'flex-start' => [ | |
| 1766 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 1767 | + 'icon' => 'eicon-text-align-left', | |
| 1768 | + ], | |
| 1769 | + 'center' => [ | |
| 1770 | + 'title' => esc_html__('Center', 'king-addons'), | |
| 1771 | + 'icon' => 'eicon-text-align-center', | |
| 1772 | + ], | |
| 1773 | + 'flex-end' => [ | |
| 1774 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 1775 | + 'icon' => 'eicon-text-align-right', | |
| 1776 | + ], | |
| 1777 | + ], | |
| 1778 | + 'default' => 'center', | |
| 1779 | + 'selectors' => [ | |
| 1780 | + '{{WRAPPER}}.king-addons-fb-step-content-layout-vertical .king-addons-fb-step' => 'align-items: {{VALUE}}', | |
| 1781 | + '{{WRAPPER}}.king-addons-fb-step-content-layout-horizontal .king-addons-fb-step' => 'justify-content: {{VALUE}}' | |
| 1782 | + ], | |
| 1783 | + 'condition' => [ | |
| 1784 | + 'step_type!' => ['progress_bar', 'none'] | |
| 1785 | + ] | |
| 1786 | + ] | |
| 1787 | + ); | |
| 1788 | + | |
| 1789 | + $this->add_responsive_control( | |
| 1790 | + 'step_align', | |
| 1791 | + [ | |
| 1792 | + 'label' => esc_html__('Alignment', 'king-addons'), | |
| 1793 | + 'type' => Controls_Manager::CHOOSE, | |
| 1794 | + 'options' => [ | |
| 1795 | + 'left' => [ | |
| 1796 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 1797 | + 'icon' => 'eicon-text-align-left', | |
| 1798 | + ], | |
| 1799 | + 'center' => [ | |
| 1800 | + 'title' => esc_html__('Center', 'king-addons'), | |
| 1801 | + 'icon' => 'eicon-text-align-center', | |
| 1802 | + ], | |
| 1803 | + 'right' => [ | |
| 1804 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 1805 | + 'icon' => 'eicon-text-align-right', | |
| 1806 | + ], | |
| 1807 | + ], | |
| 1808 | + 'default' => 'center', | |
| 1809 | + 'selectors' => [ | |
| 1810 | + '{{WRAPPER}} .king-addons-fb-step' => 'text-align: {{VALUE}}' | |
| 1811 | + ], | |
| 1812 | + 'condition' => [ | |
| 1813 | + 'step_type!' => ['progress_bar', 'none'] | |
| 1814 | + ] | |
| 1815 | + ] | |
| 1816 | + ); | |
| 1817 | + | |
| 1818 | + $this->end_controls_section(); | |
| 1819 | + | |
| 1820 | + $this->start_controls_section( | |
| 1821 | + 'section_form_style', | |
| 1822 | + [ | |
| 1823 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Form', 'king-addons'), | |
| 1824 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 1825 | + ] | |
| 1826 | + ); | |
| 1827 | + | |
| 1828 | + $this->add_control( | |
| 1829 | + 'label_color', | |
| 1830 | + [ | |
| 1831 | + 'label' => esc_html__('Label Color', 'king-addons'), | |
| 1832 | + 'type' => Controls_Manager::COLOR, | |
| 1833 | + 'default' => '#7a7a7a', | |
| 1834 | + 'selectors' => [ | |
| 1835 | + '{{WRAPPER}} .king-addons-field-group > label, {{WRAPPER}} .king-addons-field-sub-group label' => 'color: {{VALUE}};', | |
| 1836 | + ] | |
| 1837 | + ] | |
| 1838 | + ); | |
| 1839 | + | |
| 1840 | + $this->add_control( | |
| 1841 | + 'mark_required_color', | |
| 1842 | + [ | |
| 1843 | + 'label' => esc_html__('Mark Color', 'king-addons'), | |
| 1844 | + 'type' => Controls_Manager::COLOR, | |
| 1845 | + 'default' => '#CB3030', | |
| 1846 | + 'selectors' => [ | |
| 1847 | + '{{WRAPPER}} .king-addons-required-mark .king-addons-form-field-label:after' => 'color: {{COLOR}};', | |
| 1848 | + ], | |
| 1849 | + 'condition' => [ | |
| 1850 | + 'mark_required' => 'yes', | |
| 1851 | + ], | |
| 1852 | + ] | |
| 1853 | + ); | |
| 1854 | + | |
| 1855 | + $this->add_group_control( | |
| 1856 | + Group_Control_Typography::get_type(), | |
| 1857 | + [ | |
| 1858 | + 'name' => 'label_typography', | |
| 1859 | + 'selector' => '{{WRAPPER}} .king-addons-field-group > label' | |
| 1860 | + ] | |
| 1861 | + ); | |
| 1862 | + | |
| 1863 | + $this->add_control( | |
| 1864 | + 'label_spacing', | |
| 1865 | + [ | |
| 1866 | + 'label' => esc_html__('Distance', 'king-addons'), | |
| 1867 | + 'type' => Controls_Manager::SLIDER, | |
| 1868 | + 'default' => [ | |
| 1869 | + 'size' => 0, | |
| 1870 | + ], | |
| 1871 | + 'range' => [ | |
| 1872 | + 'px' => [ | |
| 1873 | + 'min' => 0, | |
| 1874 | + 'max' => 60, | |
| 1875 | + ], | |
| 1876 | + ], | |
| 1877 | + 'selectors' => [ | |
| 1878 | + 'body.rtl {{WRAPPER}} .king-addons-labels-inline .king-addons-field-group > label' => 'padding-left: {{SIZE}}{{UNIT}};', | |
| 1879 | + | |
| 1880 | + 'body:not(.rtl) {{WRAPPER}} .king-addons-labels-inline .king-addons-field-group > label' => 'padding-right: {{SIZE}}{{UNIT}};', | |
| 1881 | + | |
| 1882 | + 'body {{WRAPPER}} .king-addons-labels-above .king-addons-field-group > label' => 'padding-bottom: {{SIZE}}{{UNIT}};', | |
| 1883 | + | |
| 1884 | + ], | |
| 1885 | + ] | |
| 1886 | + ); | |
| 1887 | + | |
| 1888 | + $this->add_control( | |
| 1889 | + 'heading_label', | |
| 1890 | + [ | |
| 1891 | + 'label' => esc_html__('Inputs', 'king-addons'), | |
| 1892 | + 'type' => Controls_Manager::HEADING, | |
| 1893 | + 'separator' => 'before', | |
| 1894 | + ] | |
| 1895 | + ); | |
| 1896 | + | |
| 1897 | + $this->add_control( | |
| 1898 | + 'column_gap', | |
| 1899 | + [ | |
| 1900 | + 'label' => esc_html__('Horizontal Distance', 'king-addons'), | |
| 1901 | + 'type' => Controls_Manager::SLIDER, | |
| 1902 | + 'default' => [ | |
| 1903 | + 'size' => 10, | |
| 1904 | + ], | |
| 1905 | + 'range' => [ | |
| 1906 | + 'px' => [ | |
| 1907 | + 'min' => 0, | |
| 1908 | + 'max' => 60, | |
| 1909 | + ], | |
| 1910 | + ], | |
| 1911 | + 'selectors' => [ | |
| 1912 | + '{{WRAPPER}} .king-addons-field-group' => 'padding-right: calc( {{SIZE}}{{UNIT}}/2 ); padding-left: calc( {{SIZE}}{{UNIT}}/2 );', | |
| 1913 | + '{{WRAPPER}} .king-addons-fb-step-wrap' => 'padding-left: calc( -{{SIZE}}{{UNIT}}/2 ); padding-right: calc( -{{SIZE}}{{UNIT}}/2 );', | |
| 1914 | + '{{WRAPPER}} .king-addons-step-buttons-wrap' => 'padding-right: calc( {{SIZE}}{{UNIT}}/2 ); padding-left: calc( {{SIZE}}{{UNIT}}/2 );', | |
| 1915 | + '{{WRAPPER}} .king-addons-form-fields-wrap' => 'margin-left: calc( -{{SIZE}}{{UNIT}}/2 ); margin-right: calc( -{{SIZE}}{{UNIT}}/2 );', | |
| 1916 | + ], | |
| 1917 | + ] | |
| 1918 | + ); | |
| 1919 | + | |
| 1920 | + $this->add_control( | |
| 1921 | + 'row_gap', | |
| 1922 | + [ | |
| 1923 | + 'label' => esc_html__('Vertical Distance', 'king-addons'), | |
| 1924 | + 'type' => Controls_Manager::SLIDER, | |
| 1925 | + 'default' => [ | |
| 1926 | + 'size' => 10, | |
| 1927 | + ], | |
| 1928 | + 'range' => [ | |
| 1929 | + 'px' => [ | |
| 1930 | + 'min' => 0, | |
| 1931 | + 'max' => 60, | |
| 1932 | + ], | |
| 1933 | + ], | |
| 1934 | + 'selectors' => [ | |
| 1935 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-step-buttons-wrap)' => 'margin-bottom: {{SIZE}}{{UNIT}};', | |
| 1936 | + '{{WRAPPER}} .king-addons-field-group.recaptcha-v3-bottomleft, {{WRAPPER}} .king-addons-field-group.recaptcha-v3-bottomright' => 'margin-bottom: 0;', | |
| 1937 | + ], | |
| 1938 | + ] | |
| 1939 | + ); | |
| 1940 | + | |
| 1941 | + $this->add_responsive_control( | |
| 1942 | + 'labels_align', | |
| 1943 | + [ | |
| 1944 | + 'label' => esc_html__('Align Labels', 'king-addons'), | |
| 1945 | + 'type' => Controls_Manager::CHOOSE, | |
| 1946 | + 'options' => [ | |
| 1947 | + 'flex-start' => [ | |
| 1948 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 1949 | + 'icon' => 'eicon-text-align-left', | |
| 1950 | + ], | |
| 1951 | + 'center' => [ | |
| 1952 | + 'title' => esc_html__('Center', 'king-addons'), | |
| 1953 | + 'icon' => 'eicon-text-align-center', | |
| 1954 | + ], | |
| 1955 | + 'flex-end' => [ | |
| 1956 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 1957 | + 'icon' => 'eicon-text-align-right', | |
| 1958 | + ], | |
| 1959 | + ], | |
| 1960 | + 'default' => 'flex-start', | |
| 1961 | + 'selectors' => [ | |
| 1962 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-step-buttons-wrap)' => 'justify-content: {{VALUE}}' | |
| 1963 | + ], | |
| 1964 | + 'separator' => 'before' | |
| 1965 | + ] | |
| 1966 | + ); | |
| 1967 | + | |
| 1968 | + $this->end_controls_section(); | |
| 1969 | + | |
| 1970 | + $this->start_controls_section( | |
| 1971 | + 'section_field_style', | |
| 1972 | + [ | |
| 1973 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Field', 'king-addons'), | |
| 1974 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 1975 | + ] | |
| 1976 | + ); | |
| 1977 | + | |
| 1978 | + $this->start_controls_tabs('tabs_fields_style'); | |
| 1979 | + | |
| 1980 | + $this->start_controls_tab( | |
| 1981 | + 'tab_fields_normal', | |
| 1982 | + [ | |
| 1983 | + 'label' => esc_html__('Normal', 'king-addons'), | |
| 1984 | + ] | |
| 1985 | + ); | |
| 1986 | + | |
| 1987 | + $this->add_control( | |
| 1988 | + 'field_text_color', | |
| 1989 | + [ | |
| 1990 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 1991 | + 'type' => Controls_Manager::COLOR, | |
| 1992 | + 'default' => '#7a7a7a', | |
| 1993 | + 'selectors' => [ | |
| 1994 | + '{{WRAPPER}} .king-addons-field-group .king-addons-form-field' => 'color: {{VALUE}};', | |
| 1995 | + '{{WRAPPER}} .king-addons-field-group .king-addons-form-field svg' => 'fill: {{VALUE}};', | |
| 1996 | + '{{WRAPPER}} .king-addons-field-group input[type="radio"] + label' => 'color: {{VALUE}};', | |
| 1997 | + '{{WRAPPER}} .king-addons-field-group input[type="checkbox"] + label' => 'color: {{VALUE}};' | |
| 1998 | + ] | |
| 1999 | + ] | |
| 2000 | + ); | |
| 2001 | + | |
| 2002 | + $this->add_control( | |
| 2003 | + 'field_background_color', | |
| 2004 | + [ | |
| 2005 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2006 | + 'type' => Controls_Manager::COLOR, | |
| 2007 | + 'default' => '#ffffff', | |
| 2008 | + 'selectors' => [ | |
| 2009 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap)' => 'background-color: {{VALUE}};', | |
| 2010 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select' => 'background-color: {{VALUE}};', | |
| 2011 | + ] | |
| 2012 | + ] | |
| 2013 | + ); | |
| 2014 | + | |
| 2015 | + $this->add_control( | |
| 2016 | + 'field_border_color', | |
| 2017 | + [ | |
| 2018 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2019 | + 'type' => Controls_Manager::COLOR, | |
| 2020 | + 'selectors' => [ | |
| 2021 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap)' => 'border-color: {{VALUE}};', | |
| 2022 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select' => 'border-color: {{VALUE}};', | |
| 2023 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap::before' => 'color: {{VALUE}};', | |
| 2024 | + ] | |
| 2025 | + ] | |
| 2026 | + ); | |
| 2027 | + | |
| 2028 | + $this->add_group_control( | |
| 2029 | + Group_Control_Typography::get_type(), | |
| 2030 | + [ | |
| 2031 | + 'name' => 'field_typography', | |
| 2032 | + 'selector' => '{{WRAPPER}} .king-addons-field-group .king-addons-form-field, {{WRAPPER}} .king-addons-field-sub-group label' | |
| 2033 | + ] | |
| 2034 | + ); | |
| 2035 | + | |
| 2036 | + $this->end_controls_tab(); | |
| 2037 | + | |
| 2038 | + $this->start_controls_tab( | |
| 2039 | + 'tab_fields_focus', | |
| 2040 | + [ | |
| 2041 | + 'label' => esc_html__('Focus', 'king-addons'), | |
| 2042 | + ] | |
| 2043 | + ); | |
| 2044 | + | |
| 2045 | + $this->add_control( | |
| 2046 | + 'field_text_color_focus', | |
| 2047 | + [ | |
| 2048 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 2049 | + 'type' => Controls_Manager::COLOR, | |
| 2050 | + 'default' => '#7a7a7a', | |
| 2051 | + 'selectors' => [ | |
| 2052 | + '{{WRAPPER}} .king-addons-field-group .king-addons-form-field:focus' => 'color: {{VALUE}};', | |
| 2053 | + '{{WRAPPER}} .king-addons-field-group input[type="radio"]:focus' => 'color: {{VALUE}};', | |
| 2054 | + '{{WRAPPER}} .king-addons-field-group input[type="checkbox"]:focus' => 'color: {{VALUE}};' | |
| 2055 | + ] | |
| 2056 | + ] | |
| 2057 | + ); | |
| 2058 | + | |
| 2059 | + $this->add_control( | |
| 2060 | + 'field_background_color_focus', | |
| 2061 | + [ | |
| 2062 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2063 | + 'type' => Controls_Manager::COLOR, | |
| 2064 | + 'default' => '#ffffff', | |
| 2065 | + 'selectors' => [ | |
| 2066 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap):focus' => 'background-color: {{VALUE}};', | |
| 2067 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select:focus' => 'background-color: {{VALUE}};', | |
| 2068 | + ] | |
| 2069 | + ] | |
| 2070 | + ); | |
| 2071 | + | |
| 2072 | + $this->add_control( | |
| 2073 | + 'field_border_color_focus', | |
| 2074 | + [ | |
| 2075 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2076 | + 'type' => Controls_Manager::COLOR, | |
| 2077 | + 'selectors' => [ | |
| 2078 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap):focus' => 'border-color: {{VALUE}};', | |
| 2079 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select:focus' => 'border-color: {{VALUE}};', | |
| 2080 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap:focus-within::before' => 'color: {{VALUE}};', | |
| 2081 | + ] | |
| 2082 | + ] | |
| 2083 | + ); | |
| 2084 | + | |
| 2085 | + $this->end_controls_tab(); | |
| 2086 | + | |
| 2087 | + $this->start_controls_tab( | |
| 2088 | + 'tab_fields_error', | |
| 2089 | + [ | |
| 2090 | + 'label' => esc_html__('Error', 'king-addons'), | |
| 2091 | + ] | |
| 2092 | + ); | |
| 2093 | + | |
| 2094 | + $this->add_control( | |
| 2095 | + 'field_text_color_error', | |
| 2096 | + [ | |
| 2097 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 2098 | + 'type' => Controls_Manager::COLOR, | |
| 2099 | + 'default' => '#CB3030', | |
| 2100 | + 'selectors' => [ | |
| 2101 | + '{{WRAPPER}} .king-addons-field-group .king-addons-form-field.king-addons-form-error' => 'color: {{VALUE}};', | |
| 2102 | + '{{WRAPPER}} .king-addons-field-group input[type="radio"].king-addons-form-error' => 'color: {{VALUE}};', | |
| 2103 | + '{{WRAPPER}} .king-addons-field-group input[type="checkbox"].king-addons-form-error' => 'color: {{VALUE}};', | |
| 2104 | + | |
| 2105 | + ] | |
| 2106 | + ] | |
| 2107 | + ); | |
| 2108 | + | |
| 2109 | + $this->add_control( | |
| 2110 | + 'field_background_color_error', | |
| 2111 | + [ | |
| 2112 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2113 | + 'type' => Controls_Manager::COLOR, | |
| 2114 | + 'default' => '#ffffff', | |
| 2115 | + 'selectors' => [ | |
| 2116 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap).king-addons-form-error' => 'background-color: {{VALUE}};', | |
| 2117 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select.king-addons-form-error' => 'background-color: {{VALUE}};', | |
| 2118 | + ] | |
| 2119 | + ] | |
| 2120 | + ); | |
| 2121 | + | |
| 2122 | + $this->add_control( | |
| 2123 | + 'field_border_color_error', | |
| 2124 | + [ | |
| 2125 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2126 | + 'type' => Controls_Manager::COLOR, | |
| 2127 | + 'default' => '#CB3030', | |
| 2128 | + 'selectors' => [ | |
| 2129 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap).king-addons-form-error' => 'border-color: {{VALUE}};', | |
| 2130 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select.king-addons-form-error' => 'border-color: {{VALUE}};', | |
| 2131 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap.king-addons-form-error-wrap::before' => 'color: {{VALUE}};', | |
| 2132 | + ] | |
| 2133 | + ] | |
| 2134 | + ); | |
| 2135 | + | |
| 2136 | + $this->end_controls_tab(); | |
| 2137 | + | |
| 2138 | + $this->end_controls_tabs(); | |
| 2139 | + | |
| 2140 | + $this->add_control( | |
| 2141 | + 'field_border_width', | |
| 2142 | + [ | |
| 2143 | + 'label' => esc_html__('Border Width', 'king-addons'), | |
| 2144 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2145 | + 'placeholder' => '1', | |
| 2146 | + 'size_units' => ['px', '%', 'em'], | |
| 2147 | + 'selectors' => [ | |
| 2148 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap)' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2149 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2150 | + ], | |
| 2151 | + 'separator' => 'before' | |
| 2152 | + ] | |
| 2153 | + ); | |
| 2154 | + | |
| 2155 | + $this->add_control( | |
| 2156 | + 'field_border_radius', | |
| 2157 | + [ | |
| 2158 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 2159 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2160 | + 'size_units' => ['px', '%', 'em'], | |
| 2161 | + 'default' => [ | |
| 2162 | + 'top' => 3, | |
| 2163 | + 'right' => 3, | |
| 2164 | + 'bottom' => 3, | |
| 2165 | + 'left' => 3, | |
| 2166 | + 'unit' => 'px' | |
| 2167 | + ], | |
| 2168 | + 'selectors' => [ | |
| 2169 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2170 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2171 | + ], | |
| 2172 | + ] | |
| 2173 | + ); | |
| 2174 | + | |
| 2175 | + $this->add_control( | |
| 2176 | + 'field_padding', | |
| 2177 | + [ | |
| 2178 | + 'label' => esc_html__('Padding', 'king-addons'), | |
| 2179 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2180 | + 'size_units' => ['px', '%', 'em'], | |
| 2181 | + 'default' => [ | |
| 2182 | + 'top' => 6, | |
| 2183 | + 'right' => 5, | |
| 2184 | + 'bottom' => 7, | |
| 2185 | + 'left' => 10, | |
| 2186 | + 'unit' => 'px' | |
| 2187 | + ], | |
| 2188 | + 'selectors' => [ | |
| 2189 | + '{{WRAPPER}} .king-addons-field-group:not(.king-addons-form-field-type-upload) .king-addons-form-field:not(.king-addons-select-wrap)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2190 | + '{{WRAPPER}} .king-addons-field-group .king-addons-select-wrap select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2191 | + '{{WRAPPER}} .king-addons-field-group input[type="date"]::before' => 'right: {{RIGHT}}{{UNIT}};', | |
| 2192 | + '{{WRAPPER}} .king-addons-field-group input[type="time"]::before' => 'right: {{RIGHT}}{{UNIT}};', | |
| 2193 | + ], | |
| 2194 | + ] | |
| 2195 | + ); | |
| 2196 | + | |
| 2197 | + $this->add_control( | |
| 2198 | + 'radio_and_checkbox_distance', | |
| 2199 | + [ | |
| 2200 | + 'label' => esc_html__('Radio & Checkbox', 'king-addons'), | |
| 2201 | + 'type' => Controls_Manager::HEADING, | |
| 2202 | + ] | |
| 2203 | + ); | |
| 2204 | + | |
| 2205 | + $this->add_control( | |
| 2206 | + 'radion_&_checkbox_padding', | |
| 2207 | + [ | |
| 2208 | + 'label' => esc_html__('Margin', 'king-addons'), | |
| 2209 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2210 | + 'size_units' => ['px', '%', 'em'], | |
| 2211 | + 'default' => [ | |
| 2212 | + 'top' => 0, | |
| 2213 | + 'right' => 0, | |
| 2214 | + 'bottom' => 0, | |
| 2215 | + 'left' => 0, | |
| 2216 | + 'unit' => 'px' | |
| 2217 | + ], | |
| 2218 | + 'selectors' => [ | |
| 2219 | + '{{WRAPPER}} .king-addons-form-field-option' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2220 | + ], | |
| 2221 | + ] | |
| 2222 | + ); | |
| 2223 | + | |
| 2224 | + $this->add_responsive_control( | |
| 2225 | + 'radion_&_checkbox_gutter', | |
| 2226 | + [ | |
| 2227 | + 'label' => esc_html__('Inner Gutter', 'king-addons'), | |
| 2228 | + 'type' => Controls_Manager::SLIDER, | |
| 2229 | + 'size_units' => ['px'], | |
| 2230 | + 'range' => [ | |
| 2231 | + 'px' => [ | |
| 2232 | + 'min' => 0, | |
| 2233 | + 'max' => 50, | |
| 2234 | + ], | |
| 2235 | + ], | |
| 2236 | + 'default' => [ | |
| 2237 | + 'unit' => 'px', | |
| 2238 | + 'size' => 5, | |
| 2239 | + ], | |
| 2240 | + 'selectors' => [ | |
| 2241 | + '{{WRAPPER}} .king-addons-form-field-option label' => 'margin-left: {{SIZE}}{{UNIT}};', | |
| 2242 | + '{{WRAPPER}}.king-addons-custom-styles-yes .king-addons-form-field-option label:before' => 'margin-right: {{SIZE}}{{UNIT}};', | |
| 2243 | + ], | |
| 2244 | + 'separator' => 'before' | |
| 2245 | + ] | |
| 2246 | + ); | |
| 2247 | + | |
| 2248 | + $this->end_controls_section(); | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + $this->start_controls_section( | |
| 2252 | + 'section_style_checkbox_radio', | |
| 2253 | + [ | |
| 2254 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Checkbox & Radio', 'king-addons'), | |
| 2255 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 2256 | + 'show_label' => false, | |
| 2257 | + ] | |
| 2258 | + ); | |
| 2259 | + | |
| 2260 | + $this->add_control( | |
| 2261 | + 'checkbox_radio_custom', | |
| 2262 | + [ | |
| 2263 | + 'label' => esc_html__('Use Custom Styles', 'king-addons'), | |
| 2264 | + 'type' => Controls_Manager::SWITCHER, | |
| 2265 | + 'default' => 'yes', | |
| 2266 | + 'prefix_class' => 'king-addons-custom-styles-' | |
| 2267 | + ] | |
| 2268 | + ); | |
| 2269 | + | |
| 2270 | + $this->add_control( | |
| 2271 | + 'checkbox_radio_static_color', | |
| 2272 | + [ | |
| 2273 | + 'label' => esc_html__('Static Color', 'king-addons'), | |
| 2274 | + 'type' => Controls_Manager::COLOR, | |
| 2275 | + 'default' => '#FFFFFF', | |
| 2276 | + 'selectors' => [ | |
| 2277 | + '{{WRAPPER}} .king-addons-form-field-type-checkbox .king-addons-form-field-option label:before' => 'background-color: {{VALUE}}', | |
| 2278 | + '{{WRAPPER}} .king-addons-form-field-type-radio .king-addons-form-field-option label:before' => 'background-color: {{VALUE}}', | |
| 2279 | + ], | |
| 2280 | + 'condition' => [ | |
| 2281 | + 'checkbox_radio_custom' => 'yes' | |
| 2282 | + ] | |
| 2283 | + ] | |
| 2284 | + ); | |
| 2285 | + | |
| 2286 | + $this->add_control( | |
| 2287 | + 'checkbox_radio_active_color', | |
| 2288 | + [ | |
| 2289 | + 'label' => esc_html__('Active Color', 'king-addons'), | |
| 2290 | + 'type' => Controls_Manager::COLOR, | |
| 2291 | + 'default' => '#5B03FF', | |
| 2292 | + 'selectors' => [ | |
| 2293 | + '{{WRAPPER}} .king-addons-form-field-type-checkbox .king-addons-form-field-option label:before' => 'color: {{VALUE}}', | |
| 2294 | + '{{WRAPPER}} .king-addons-form-field-type-radio .king-addons-form-field-option label:before' => 'color: {{VALUE}}', | |
| 2295 | + ], | |
| 2296 | + 'condition' => [ | |
| 2297 | + 'checkbox_radio_custom' => 'yes' | |
| 2298 | + ] | |
| 2299 | + ] | |
| 2300 | + ); | |
| 2301 | + | |
| 2302 | + $this->add_control( | |
| 2303 | + 'checkbox_radio_border_color', | |
| 2304 | + [ | |
| 2305 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2306 | + 'type' => Controls_Manager::COLOR, | |
| 2307 | + 'default' => '#E8E8E8', | |
| 2308 | + 'selectors' => [ | |
| 2309 | + '{{WRAPPER}} .king-addons-form-field-type-checkbox .king-addons-form-field-option label:before' => 'border-color: {{VALUE}}', | |
| 2310 | + '{{WRAPPER}} .king-addons-form-field-type-radio .king-addons-form-field-option label:before' => 'border-color: {{VALUE}}', | |
| 2311 | + ], | |
| 2312 | + 'condition' => [ | |
| 2313 | + 'checkbox_radio_custom' => 'yes' | |
| 2314 | + ] | |
| 2315 | + ] | |
| 2316 | + ); | |
| 2317 | + | |
| 2318 | + $this->add_control( | |
| 2319 | + 'checkbox_radio_size', | |
| 2320 | + [ | |
| 2321 | + 'label' => esc_html__('Size', 'king-addons'), | |
| 2322 | + 'type' => Controls_Manager::SLIDER, | |
| 2323 | + 'size_units' => ['px'], | |
| 2324 | + 'range' => [ | |
| 2325 | + 'px' => [ | |
| 2326 | + 'min' => 10, | |
| 2327 | + 'max' => 50, | |
| 2328 | + ], | |
| 2329 | + ], | |
| 2330 | + 'default' => [ | |
| 2331 | + 'unit' => 'px', | |
| 2332 | + 'size' => 16, | |
| 2333 | + ], | |
| 2334 | + 'selectors' => [ | |
| 2335 | + '{{WRAPPER}} .king-addons-form-field-type-checkbox .king-addons-form-field-option label:before' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}}; font-size: calc({{SIZE}}{{UNIT}} / 1.3);', | |
| 2336 | + '{{WRAPPER}} .king-addons-form-field-type-radio .king-addons-form-field-option label:before' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}}; font-size: calc({{SIZE}}{{UNIT}} / 1.3);', | |
| 2337 | + '{{WRAPPER}} .king-addons-form-field-type-checkbox input' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', | |
| 2338 | + '{{WRAPPER}} .king-addons-form-field-type-radio input' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};' | |
| 2339 | + ], | |
| 2340 | + 'separator' => 'before', | |
| 2341 | + 'condition' => [ | |
| 2342 | + 'checkbox_radio_custom' => 'yes' | |
| 2343 | + ] | |
| 2344 | + ] | |
| 2345 | + ); | |
| 2346 | + | |
| 2347 | + $this->end_controls_section(); | |
| 2348 | + | |
| 2349 | + $this->start_controls_section( | |
| 2350 | + 'section_button_style', | |
| 2351 | + [ | |
| 2352 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Buttons', 'king-addons'), | |
| 2353 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 2354 | + ] | |
| 2355 | + ); | |
| 2356 | + | |
| 2357 | + $this->start_controls_tabs('tabs_button_style'); | |
| 2358 | + | |
| 2359 | + $this->start_controls_tab( | |
| 2360 | + 'tab_button_normal', | |
| 2361 | + [ | |
| 2362 | + 'label' => esc_html__('Normal', 'king-addons'), | |
| 2363 | + ] | |
| 2364 | + ); | |
| 2365 | + | |
| 2366 | + $this->add_control( | |
| 2367 | + 'heading_next_submit_button', | |
| 2368 | + [ | |
| 2369 | + 'label' => esc_html__('Submit Button, Next Button', 'king-addons'), | |
| 2370 | + 'type' => Controls_Manager::HEADING, | |
| 2371 | + ] | |
| 2372 | + ); | |
| 2373 | + | |
| 2374 | + $this->add_control( | |
| 2375 | + 'button_background_color', | |
| 2376 | + [ | |
| 2377 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2378 | + 'type' => Controls_Manager::COLOR, | |
| 2379 | + 'default' => '#5B03FF', | |
| 2380 | + 'selectors' => [ | |
| 2381 | + '{{WRAPPER}} .king-addons-fb-step-next' => 'background-color: {{VALUE}};', | |
| 2382 | + '{{WRAPPER}} .king-addons-button[type="submit"]' => 'background-color: {{VALUE}};', | |
| 2383 | + ], | |
| 2384 | + ] | |
| 2385 | + ); | |
| 2386 | + | |
| 2387 | + $this->add_control( | |
| 2388 | + 'button_text_color', | |
| 2389 | + [ | |
| 2390 | + 'label' => esc_html__('Text Color', 'king-addons'), | |
| 2391 | + 'type' => Controls_Manager::COLOR, | |
| 2392 | + 'default' => '#ffffff', | |
| 2393 | + 'selectors' => [ | |
| 2394 | + '{{WRAPPER}} .king-addons-fb-step-next' => 'color: {{VALUE}};', | |
| 2395 | + '{{WRAPPER}} .king-addons-button[type="submit"]' => 'color: {{VALUE}};', | |
| 2396 | + '{{WRAPPER}} .king-addons-double-bounce .king-addons-child' => 'background-color: {{VALUE}} !important;', | |
| 2397 | + '{{WRAPPER}} .king-addons-button[type="submit"] svg *' => 'fill: {{VALUE}};' | |
| 2398 | + ], | |
| 2399 | + ] | |
| 2400 | + ); | |
| 2401 | + | |
| 2402 | + $this->add_control( | |
| 2403 | + 'button_border_color', | |
| 2404 | + [ | |
| 2405 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2406 | + 'type' => Controls_Manager::COLOR, | |
| 2407 | + 'default' => '', | |
| 2408 | + 'selectors' => [ | |
| 2409 | + '{{WRAPPER}} .king-addons-fb-step-prev' => 'border-color: {{VALUE}};', | |
| 2410 | + '{{WRAPPER}} .king-addons-fb-step-next' => 'border-color: {{VALUE}};', | |
| 2411 | + '{{WRAPPER}} .king-addons-button[type="submit"]' => 'border-color: {{VALUE}};', | |
| 2412 | + ], | |
| 2413 | + 'condition' => [ | |
| 2414 | + 'button_border_border!' => '', | |
| 2415 | + ], | |
| 2416 | + ] | |
| 2417 | + ); | |
| 2418 | + | |
| 2419 | + $this->add_control( | |
| 2420 | + 'heading_previous_button', | |
| 2421 | + [ | |
| 2422 | + 'label' => esc_html__('Previous Button', 'king-addons'), | |
| 2423 | + 'type' => Controls_Manager::HEADING, | |
| 2424 | + ] | |
| 2425 | + ); | |
| 2426 | + | |
| 2427 | + $this->add_control( | |
| 2428 | + 'previous_button_background_color', | |
| 2429 | + [ | |
| 2430 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2431 | + 'type' => Controls_Manager::COLOR, | |
| 2432 | + 'default' => '#5B03FF', | |
| 2433 | + 'selectors' => [ | |
| 2434 | + '{{WRAPPER}} .king-addons-fb-step-prev' => 'background-color: {{VALUE}};', | |
| 2435 | + ], | |
| 2436 | + ] | |
| 2437 | + ); | |
| 2438 | + | |
| 2439 | + $this->add_control( | |
| 2440 | + 'previous_button_text_color', | |
| 2441 | + [ | |
| 2442 | + 'label' => esc_html__('Text Color', 'king-addons'), | |
| 2443 | + 'type' => Controls_Manager::COLOR, | |
| 2444 | + 'default' => '#ffffff', | |
| 2445 | + 'selectors' => [ | |
| 2446 | + '{{WRAPPER}} .king-addons-fb-step-prev' => 'color: {{VALUE}};', | |
| 2447 | + ], | |
| 2448 | + ] | |
| 2449 | + ); | |
| 2450 | + | |
| 2451 | + $this->add_control( | |
| 2452 | + 'previous_button_border_color', | |
| 2453 | + [ | |
| 2454 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2455 | + 'type' => Controls_Manager::COLOR, | |
| 2456 | + 'default' => '', | |
| 2457 | + 'selectors' => [ | |
| 2458 | + '{{WRAPPER}} .king-addons-fb-step-prev' => 'border-color: {{VALUE}};', | |
| 2459 | + ], | |
| 2460 | + 'condition' => [ | |
| 2461 | + 'button_border_border!' => '', | |
| 2462 | + ], | |
| 2463 | + ] | |
| 2464 | + ); | |
| 2465 | + | |
| 2466 | + $this->add_group_control( | |
| 2467 | + Group_Control_Typography::get_type(), | |
| 2468 | + [ | |
| 2469 | + 'name' => 'button_typography', | |
| 2470 | + 'selector' => '{{WRAPPER}} .king-addons-button, {{WRAPPER}} .king-addons-fb-step-prev, {{WRAPPER}} .king-addons-fb-step-next', | |
| 2471 | + ] | |
| 2472 | + ); | |
| 2473 | + | |
| 2474 | + $this->end_controls_tab(); | |
| 2475 | + | |
| 2476 | + $this->start_controls_tab( | |
| 2477 | + 'tab_button_hover', | |
| 2478 | + [ | |
| 2479 | + 'label' => esc_html__('Hover', 'king-addons'), | |
| 2480 | + ] | |
| 2481 | + ); | |
| 2482 | + | |
| 2483 | + $this->add_control( | |
| 2484 | + 'heading_next_submit_button_hover', | |
| 2485 | + [ | |
| 2486 | + 'label' => esc_html__('Next & Submit Button', 'king-addons'), | |
| 2487 | + 'type' => Controls_Manager::HEADING, | |
| 2488 | + ] | |
| 2489 | + ); | |
| 2490 | + | |
| 2491 | + $this->add_control( | |
| 2492 | + 'button_background_hover_color', | |
| 2493 | + [ | |
| 2494 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2495 | + 'type' => Controls_Manager::COLOR, | |
| 2496 | + 'default' => '', | |
| 2497 | + 'selectors' => [ | |
| 2498 | + '{{WRAPPER}} .king-addons-fb-step-next:hover' => 'background-color: {{VALUE}};', | |
| 2499 | + '{{WRAPPER}} .king-addons-button[type="submit"]:hover' => 'background-color: {{VALUE}};', | |
| 2500 | + ], | |
| 2501 | + ] | |
| 2502 | + ); | |
| 2503 | + | |
| 2504 | + $this->add_control( | |
| 2505 | + 'button_hover_color', | |
| 2506 | + [ | |
| 2507 | + 'label' => esc_html__('Text Color', 'king-addons'), | |
| 2508 | + 'type' => Controls_Manager::COLOR, | |
| 2509 | + 'default' => '#ffffff', | |
| 2510 | + 'selectors' => [ | |
| 2511 | + '{{WRAPPER}} .king-addons-fb-step-next:hover' => 'color: {{VALUE}};', | |
| 2512 | + '{{WRAPPER}} .king-addons-button[type="submit"]:hover' => 'color: {{VALUE}};', | |
| 2513 | + '{{WRAPPER}} .king-addons-button[type="submit"]:hover svg *' => 'fill: {{VALUE}};', | |
| 2514 | + ], | |
| 2515 | + ] | |
| 2516 | + ); | |
| 2517 | + | |
| 2518 | + $this->add_control( | |
| 2519 | + 'button_hover_border_color', | |
| 2520 | + [ | |
| 2521 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2522 | + 'type' => Controls_Manager::COLOR, | |
| 2523 | + 'default' => '', | |
| 2524 | + 'selectors' => [ | |
| 2525 | + '{{WRAPPER}} .king-addons-fb-step-next:hover' => 'border-color: {{VALUE}};', | |
| 2526 | + '{{WRAPPER}} .king-addons-button[type="submit"]:hover' => 'border-color: {{VALUE}};', | |
| 2527 | + ], | |
| 2528 | + 'condition' => [ | |
| 2529 | + 'button_border_border!' => '', | |
| 2530 | + ], | |
| 2531 | + ] | |
| 2532 | + ); | |
| 2533 | + | |
| 2534 | + $this->add_control( | |
| 2535 | + 'heading_previous_button_hover', | |
| 2536 | + [ | |
| 2537 | + 'label' => esc_html__('Previous Button', 'king-addons'), | |
| 2538 | + 'type' => Controls_Manager::HEADING, | |
| 2539 | + ] | |
| 2540 | + ); | |
| 2541 | + | |
| 2542 | + $this->add_control( | |
| 2543 | + 'previous_button_background_color_hover', | |
| 2544 | + [ | |
| 2545 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2546 | + 'type' => Controls_Manager::COLOR, | |
| 2547 | + 'default' => '', | |
| 2548 | + 'selectors' => [ | |
| 2549 | + '{{WRAPPER}} .king-addons-fb-step-prev:hover' => 'background-color: {{VALUE}};', | |
| 2550 | + ], | |
| 2551 | + ] | |
| 2552 | + ); | |
| 2553 | + | |
| 2554 | + $this->add_control( | |
| 2555 | + 'previous_button_text_color_hover', | |
| 2556 | + [ | |
| 2557 | + 'label' => esc_html__('Text Color', 'king-addons'), | |
| 2558 | + 'type' => Controls_Manager::COLOR, | |
| 2559 | + 'default' => '#ffffff', | |
| 2560 | + 'selectors' => [ | |
| 2561 | + '{{WRAPPER}} .king-addons-fb-step-prev:hover' => 'color: {{VALUE}};', | |
| 2562 | + ], | |
| 2563 | + ] | |
| 2564 | + ); | |
| 2565 | + | |
| 2566 | + $this->add_control( | |
| 2567 | + 'previous_button_border_color_hover', | |
| 2568 | + [ | |
| 2569 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2570 | + 'type' => Controls_Manager::COLOR, | |
| 2571 | + 'default' => '', | |
| 2572 | + 'selectors' => [ | |
| 2573 | + '{{WRAPPER}} .king-addons-fb-step-prev:hover' => 'border-color: {{VALUE}};', | |
| 2574 | + ], | |
| 2575 | + 'condition' => [ | |
| 2576 | + 'button_border_border!' => '', | |
| 2577 | + ], | |
| 2578 | + ] | |
| 2579 | + ); | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + $this->end_controls_tab(); | |
| 2583 | + | |
| 2584 | + $this->end_controls_tabs(); | |
| 2585 | + | |
| 2586 | + $this->add_group_control( | |
| 2587 | + Group_Control_Border::get_type(), [ | |
| 2588 | + 'name' => 'button_border', | |
| 2589 | + 'selector' => '{{WRAPPER}} .king-addons-button, {{WRAPPER}} .king-addons-fb-step-prev, {{WRAPPER}} .king-addons-fb-step-next', | |
| 2590 | + 'exclude' => [ | |
| 2591 | + 'color', | |
| 2592 | + ], | |
| 2593 | + 'separator' => 'before', | |
| 2594 | + ] | |
| 2595 | + ); | |
| 2596 | + | |
| 2597 | + $this->add_control( | |
| 2598 | + 'button_border_radius', | |
| 2599 | + [ | |
| 2600 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 2601 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2602 | + 'size_units' => ['px', '%', 'em'], | |
| 2603 | + 'selectors' => [ | |
| 2604 | + '{{WRAPPER}} .king-addons-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2605 | + '{{WRAPPER}} .king-addons-fb-step-prev' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2606 | + '{{WRAPPER}} .king-addons-fb-step-next' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' | |
| 2607 | + ], | |
| 2608 | + ] | |
| 2609 | + ); | |
| 2610 | + | |
| 2611 | + $this->add_control( | |
| 2612 | + 'button_text_padding', | |
| 2613 | + [ | |
| 2614 | + 'label' => esc_html__('Text Padding', 'king-addons'), | |
| 2615 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2616 | + 'size_units' => ['px', 'em', '%'], | |
| 2617 | + 'selectors' => [ | |
| 2618 | + '{{WRAPPER}} .king-addons-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2619 | + '{{WRAPPER}} .king-addons-fb-step-prev' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2620 | + '{{WRAPPER}} .king-addons-fb-step-next' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' | |
| 2621 | + ], | |
| 2622 | + ] | |
| 2623 | + ); | |
| 2624 | + | |
| 2625 | + $this->end_controls_section(); | |
| 2626 | + | |
| 2627 | + $this->start_controls_section( | |
| 2628 | + 'section_step_style', | |
| 2629 | + [ | |
| 2630 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Step', 'king-addons'), | |
| 2631 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 2632 | + ] | |
| 2633 | + ); | |
| 2634 | + | |
| 2635 | + $this->start_controls_tabs('tabs_step_style'); | |
| 2636 | + | |
| 2637 | + $this->start_controls_tab( | |
| 2638 | + 'tab_step_normal', | |
| 2639 | + [ | |
| 2640 | + 'label' => esc_html__('Normal', 'king-addons'), | |
| 2641 | + ] | |
| 2642 | + ); | |
| 2643 | + | |
| 2644 | + $this->add_control( | |
| 2645 | + 'main_label_color', | |
| 2646 | + [ | |
| 2647 | + 'label' => esc_html__('Label Color', 'king-addons'), | |
| 2648 | + 'type' => Controls_Manager::COLOR, | |
| 2649 | + 'default' => '#7a7a7a', | |
| 2650 | + 'selectors' => [ | |
| 2651 | + '{{WRAPPER}} .king-addons-fb-step-main-label' => 'color: {{VALUE}};', | |
| 2652 | + ] | |
| 2653 | + ] | |
| 2654 | + ); | |
| 2655 | + | |
| 2656 | + $this->add_control( | |
| 2657 | + 'sub_label_color', | |
| 2658 | + [ | |
| 2659 | + 'label' => esc_html__('Sub Label Color', 'king-addons'), | |
| 2660 | + 'type' => Controls_Manager::COLOR, | |
| 2661 | + 'default' => '#7a7a7a', | |
| 2662 | + 'selectors' => [ | |
| 2663 | + '{{WRAPPER}} .king-addons-fb-step-sub-label' => 'color: {{VALUE}};', | |
| 2664 | + ] | |
| 2665 | + ] | |
| 2666 | + ); | |
| 2667 | + | |
| 2668 | + $this->add_control( | |
| 2669 | + 'step_bg_color', | |
| 2670 | + [ | |
| 2671 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2672 | + 'type' => Controls_Manager::COLOR, | |
| 2673 | + 'selectors' => [ | |
| 2674 | + '{{WRAPPER}} .king-addons-fb-step' => 'background-color: {{VALUE}};' | |
| 2675 | + ], | |
| 2676 | + ] | |
| 2677 | + ); | |
| 2678 | + | |
| 2679 | + $this->add_control( | |
| 2680 | + 'step_border_color', | |
| 2681 | + [ | |
| 2682 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2683 | + 'type' => Controls_Manager::COLOR, | |
| 2684 | + 'default' => '#5B03FF', | |
| 2685 | + 'selectors' => [ | |
| 2686 | + '{{WRAPPER}} .king-addons-fb-step' => 'border-color: {{VALUE}};' | |
| 2687 | + ] | |
| 2688 | + ] | |
| 2689 | + ); | |
| 2690 | + | |
| 2691 | + $this->end_controls_tab(); | |
| 2692 | + | |
| 2693 | + $this->start_controls_tab( | |
| 2694 | + 'tab_step_active', | |
| 2695 | + [ | |
| 2696 | + 'label' => esc_html__('Active', 'king-addons'), | |
| 2697 | + ] | |
| 2698 | + ); | |
| 2699 | + | |
| 2700 | + $this->add_control( | |
| 2701 | + 'main_label_color_active', | |
| 2702 | + [ | |
| 2703 | + 'label' => esc_html__('Label Color', 'king-addons'), | |
| 2704 | + 'type' => Controls_Manager::COLOR, | |
| 2705 | + 'default' => '#7a7a7a', | |
| 2706 | + 'selectors' => [ | |
| 2707 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-active .king-addons-fb-step-main-label' => 'color: {{VALUE}};', | |
| 2708 | + ] | |
| 2709 | + ] | |
| 2710 | + ); | |
| 2711 | + | |
| 2712 | + $this->add_control( | |
| 2713 | + 'sub_label_color_active', | |
| 2714 | + [ | |
| 2715 | + 'label' => esc_html__('Sub Label Color', 'king-addons'), | |
| 2716 | + 'type' => Controls_Manager::COLOR, | |
| 2717 | + 'default' => '#7a7a7a', | |
| 2718 | + 'selectors' => [ | |
| 2719 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-active .king-addons-fb-step-sub-label' => 'color: {{VALUE}};', | |
| 2720 | + ] | |
| 2721 | + ] | |
| 2722 | + ); | |
| 2723 | + | |
| 2724 | + $this->add_control( | |
| 2725 | + 'step_bg_color_active', | |
| 2726 | + [ | |
| 2727 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2728 | + 'type' => Controls_Manager::COLOR, | |
| 2729 | + 'selectors' => [ | |
| 2730 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-active' => 'background-color: {{VALUE}};', | |
| 2731 | + ] | |
| 2732 | + ] | |
| 2733 | + ); | |
| 2734 | + | |
| 2735 | + $this->add_control( | |
| 2736 | + 'step_border_color_active', | |
| 2737 | + [ | |
| 2738 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2739 | + 'type' => Controls_Manager::COLOR, | |
| 2740 | + 'selectors' => [ | |
| 2741 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-active' => 'border-color: {{VALUE}};' | |
| 2742 | + ] | |
| 2743 | + ] | |
| 2744 | + ); | |
| 2745 | + | |
| 2746 | + $this->end_controls_tab(); | |
| 2747 | + | |
| 2748 | + $this->start_controls_tab( | |
| 2749 | + 'tab_step_finished', | |
| 2750 | + [ | |
| 2751 | + 'label' => esc_html__('Finished', 'king-addons'), | |
| 2752 | + ] | |
| 2753 | + ); | |
| 2754 | + | |
| 2755 | + $this->add_control( | |
| 2756 | + 'main_label_color_finish', | |
| 2757 | + [ | |
| 2758 | + 'label' => esc_html__('Label Color', 'king-addons'), | |
| 2759 | + 'type' => Controls_Manager::COLOR, | |
| 2760 | + 'default' => '#7a7a7a', | |
| 2761 | + 'selectors' => [ | |
| 2762 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-finish .king-addons-fb-step-main-label' => 'color: {{VALUE}};', | |
| 2763 | + ] | |
| 2764 | + ] | |
| 2765 | + ); | |
| 2766 | + | |
| 2767 | + $this->add_control( | |
| 2768 | + 'sub_label_color_finish', | |
| 2769 | + [ | |
| 2770 | + 'label' => esc_html__('Sub Label Color', 'king-addons'), | |
| 2771 | + 'type' => Controls_Manager::COLOR, | |
| 2772 | + 'default' => '#7a7a7a', | |
| 2773 | + 'selectors' => [ | |
| 2774 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-finish .king-addons-fb-step-sub-label' => 'color: {{VALUE}};', | |
| 2775 | + ] | |
| 2776 | + ] | |
| 2777 | + ); | |
| 2778 | + | |
| 2779 | + $this->add_control( | |
| 2780 | + 'step_bg_color_finish', | |
| 2781 | + [ | |
| 2782 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2783 | + 'type' => Controls_Manager::COLOR, | |
| 2784 | + 'selectors' => [ | |
| 2785 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-finish' => 'background-color: {{VALUE}};', | |
| 2786 | + ] | |
| 2787 | + ] | |
| 2788 | + ); | |
| 2789 | + | |
| 2790 | + $this->add_control( | |
| 2791 | + 'step_border_color_finish', | |
| 2792 | + [ | |
| 2793 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2794 | + 'type' => Controls_Manager::COLOR, | |
| 2795 | + 'selectors' => [ | |
| 2796 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-finish' => 'border-color: {{VALUE}};' | |
| 2797 | + ] | |
| 2798 | + ] | |
| 2799 | + ); | |
| 2800 | + | |
| 2801 | + $this->end_controls_tab(); | |
| 2802 | + | |
| 2803 | + $this->end_controls_tabs(); | |
| 2804 | + | |
| 2805 | + $this->add_responsive_control( | |
| 2806 | + 'step_wrap_distance', | |
| 2807 | + [ | |
| 2808 | + 'label' => esc_html__('Distance', 'king-addons'), | |
| 2809 | + 'type' => Controls_Manager::SLIDER, | |
| 2810 | + 'size_units' => ['px'], | |
| 2811 | + 'range' => [ | |
| 2812 | + 'px' => [ | |
| 2813 | + 'min' => 0, | |
| 2814 | + 'max' => 50, | |
| 2815 | + ], | |
| 2816 | + ], | |
| 2817 | + 'default' => [ | |
| 2818 | + 'unit' => 'px', | |
| 2819 | + 'size' => 15, | |
| 2820 | + ], | |
| 2821 | + 'selectors' => [ | |
| 2822 | + '{{WRAPPER}} .king-addons-fb-step-wrap' => 'margin-bottom: {{SIZE}}{{UNIT}};', | |
| 2823 | + ], | |
| 2824 | + 'separator' => 'before' | |
| 2825 | + ] | |
| 2826 | + ); | |
| 2827 | + | |
| 2828 | + $this->add_responsive_control( | |
| 2829 | + 'step_wrap_gutter', | |
| 2830 | + [ | |
| 2831 | + 'label' => esc_html__('Gutter', 'king-addons'), | |
| 2832 | + 'type' => Controls_Manager::SLIDER, | |
| 2833 | + 'size_units' => ['px'], | |
| 2834 | + 'range' => [ | |
| 2835 | + 'px' => [ | |
| 2836 | + 'min' => 0, | |
| 2837 | + 'max' => 25 | |
| 2838 | + ] | |
| 2839 | + ], | |
| 2840 | + 'default' => [ | |
| 2841 | + 'unit' => 'px', | |
| 2842 | + 'size' => 5 | |
| 2843 | + ], | |
| 2844 | + 'selectors' => [ | |
| 2845 | + '{{WRAPPER}} .king-addons-fb-step-sep' => 'margin-left: {{SIZE}}{{UNIT}}; margin-right: {{SIZE}}{{UNIT}}', | |
| 2846 | + '{{WRAPPER}} .king-addons-separator-off .king-addons-fb-step:not(:last-of-type)' => 'margin-right: {{SIZE}}{{UNIT}}' | |
| 2847 | + ], | |
| 2848 | + 'separator' => 'before' | |
| 2849 | + ] | |
| 2850 | + ); | |
| 2851 | + | |
| 2852 | + $this->add_control( | |
| 2853 | + 'step_border_type', | |
| 2854 | + [ | |
| 2855 | + 'label' => esc_html__('Border Type', 'king-addons'), | |
| 2856 | + 'type' => Controls_Manager::SELECT, | |
| 2857 | + 'options' => [ | |
| 2858 | + 'none' => esc_html__('None', 'king-addons'), | |
| 2859 | + 'solid' => esc_html__('Solid', 'king-addons'), | |
| 2860 | + 'double' => esc_html__('Double', 'king-addons'), | |
| 2861 | + 'dotted' => esc_html__('Dotted', 'king-addons'), | |
| 2862 | + 'dashed' => esc_html__('Dashed', 'king-addons'), | |
| 2863 | + 'groove' => esc_html__('Groove', 'king-addons'), | |
| 2864 | + ], | |
| 2865 | + 'default' => 'solid', | |
| 2866 | + 'selectors' => [ | |
| 2867 | + '{{WRAPPER}} .king-addons-fb-step' => 'border-style: {{VALUE}};', | |
| 2868 | + ], | |
| 2869 | + 'separator' => 'before', | |
| 2870 | + ] | |
| 2871 | + ); | |
| 2872 | + | |
| 2873 | + $this->add_responsive_control( | |
| 2874 | + 'step_border_width', | |
| 2875 | + [ | |
| 2876 | + 'label' => esc_html__('Border Width', 'king-addons'), | |
| 2877 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2878 | + 'size_units' => ['px'], | |
| 2879 | + 'default' => [ | |
| 2880 | + 'top' => 1, | |
| 2881 | + 'right' => 1, | |
| 2882 | + 'bottom' => 1, | |
| 2883 | + 'left' => 1, | |
| 2884 | + ], | |
| 2885 | + 'selectors' => [ | |
| 2886 | + '{{WRAPPER}} .king-addons-fb-step' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2887 | + ], | |
| 2888 | + 'condition' => [ | |
| 2889 | + 'step_border_type!' => 'none', | |
| 2890 | + ], | |
| 2891 | + ] | |
| 2892 | + ); | |
| 2893 | + | |
| 2894 | + $this->add_control( | |
| 2895 | + 'step_border_radius', | |
| 2896 | + [ | |
| 2897 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 2898 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2899 | + 'size_units' => ['px', '%', 'em'], | |
| 2900 | + 'selectors' => [ | |
| 2901 | + '{{WRAPPER}} .king-addons-fb-step' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2902 | + ], | |
| 2903 | + 'separator' => 'before', | |
| 2904 | + ] | |
| 2905 | + ); | |
| 2906 | + | |
| 2907 | + $this->add_responsive_control( | |
| 2908 | + 'step_padding', | |
| 2909 | + [ | |
| 2910 | + 'label' => esc_html__('Padding', 'king-addons'), | |
| 2911 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 2912 | + 'size_units' => ['px', 'em', '%'], | |
| 2913 | + 'default' => [ | |
| 2914 | + 'unit' => 'px', | |
| 2915 | + 'top' => 10, | |
| 2916 | + 'right' => 10, | |
| 2917 | + 'bottom' => 10, | |
| 2918 | + 'left' => 10, | |
| 2919 | + ], | |
| 2920 | + 'selectors' => [ | |
| 2921 | + | |
| 2922 | + '{{WRAPPER}} .king-addons-fb-step' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 2923 | + '{{WRAPPER}}' => '--king-addons-fb-steps-padding: {{TOP}}{{UNIT}};' | |
| 2924 | + ], | |
| 2925 | + ] | |
| 2926 | + ); | |
| 2927 | + | |
| 2928 | + $this->add_control( | |
| 2929 | + 'step_inner_styles', | |
| 2930 | + [ | |
| 2931 | + 'label' => esc_html__('Step Indicator', 'king-addons'), | |
| 2932 | + 'type' => Controls_Manager::HEADING, | |
| 2933 | + 'separator' => 'before', | |
| 2934 | + ] | |
| 2935 | + ); | |
| 2936 | + | |
| 2937 | + $this->start_controls_tabs('tabs_step_inner_style'); | |
| 2938 | + | |
| 2939 | + $this->start_controls_tab( | |
| 2940 | + 'tab_step_inner_normal', | |
| 2941 | + [ | |
| 2942 | + 'label' => esc_html__('Normal', 'king-addons'), | |
| 2943 | + ] | |
| 2944 | + ); | |
| 2945 | + | |
| 2946 | + $this->add_control( | |
| 2947 | + 'step_inner_color', | |
| 2948 | + [ | |
| 2949 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 2950 | + 'type' => Controls_Manager::COLOR, | |
| 2951 | + 'default' => '#FFFFFF', | |
| 2952 | + 'selectors' => [ | |
| 2953 | + '{{WRAPPER}} .king-addons-fb-step-content i' => 'color: {{VALUE}};', | |
| 2954 | + '{{WRAPPER}} .king-addons-fb-step-content svg' => 'fill: {{VALUE}};', | |
| 2955 | + '{{WRAPPER}} .king-addons-fb-step-content' => 'color: {{VALUE}};' | |
| 2956 | + ] | |
| 2957 | + ] | |
| 2958 | + ); | |
| 2959 | + | |
| 2960 | + $this->add_control( | |
| 2961 | + 'step_inner_bg_color', | |
| 2962 | + [ | |
| 2963 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 2964 | + 'type' => Controls_Manager::COLOR, | |
| 2965 | + 'default' => '#5B03FF', | |
| 2966 | + 'selectors' => [ | |
| 2967 | + '{{WRAPPER}} .king-addons-fb-step-content' => 'background-color: {{VALUE}};' | |
| 2968 | + ], | |
| 2969 | + ] | |
| 2970 | + ); | |
| 2971 | + | |
| 2972 | + $this->add_control( | |
| 2973 | + 'step_inner_border_color', | |
| 2974 | + [ | |
| 2975 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 2976 | + 'type' => Controls_Manager::COLOR, | |
| 2977 | + 'default' => '#5B03FF', | |
| 2978 | + 'selectors' => [ | |
| 2979 | + '{{WRAPPER}} .king-addons-fb-step-content' => 'border-color: {{VALUE}};' | |
| 2980 | + ] | |
| 2981 | + ] | |
| 2982 | + ); | |
| 2983 | + | |
| 2984 | + $this->end_controls_tab(); | |
| 2985 | + | |
| 2986 | + $this->start_controls_tab( | |
| 2987 | + 'tab_step_inner_active', | |
| 2988 | + [ | |
| 2989 | + 'label' => esc_html__('Active', 'king-addons'), | |
| 2990 | + ] | |
| 2991 | + ); | |
| 2992 | + | |
| 2993 | + $this->add_control( | |
| 2994 | + 'step_inner_color_active', | |
| 2995 | + [ | |
| 2996 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 2997 | + 'type' => Controls_Manager::COLOR, | |
| 2998 | + 'default' => '#FFFFFF', | |
| 2999 | + 'selectors' => [ | |
| 3000 | + '{{WRAPPER}} .king-addons-fb-step-active .king-addons-fb-step-content i' => 'color: {{VALUE}};', | |
| 3001 | + '{{WRAPPER}} .king-addons-fb-step-active .king-addons-fb-step-content svg' => 'fill: {{VALUE}};', | |
| 3002 | + '{{WRAPPER}} .king-addons-fb-step-active .king-addons-fb-step-content' => 'color: {{VALUE}};' | |
| 3003 | + ] | |
| 3004 | + ] | |
| 3005 | + ); | |
| 3006 | + | |
| 3007 | + $this->add_control( | |
| 3008 | + 'step_inner_bg_color_active', | |
| 3009 | + [ | |
| 3010 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 3011 | + 'type' => Controls_Manager::COLOR, | |
| 3012 | + 'default' => '#5B03FF', | |
| 3013 | + 'selectors' => [ | |
| 3014 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-active .king-addons-fb-step-content' => 'background-color: {{VALUE}};', | |
| 3015 | + ] | |
| 3016 | + ] | |
| 3017 | + ); | |
| 3018 | + | |
| 3019 | + $this->add_control( | |
| 3020 | + 'step_inner_border_color_active', | |
| 3021 | + [ | |
| 3022 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 3023 | + 'type' => Controls_Manager::COLOR, | |
| 3024 | + 'default' => '#5B03FF', | |
| 3025 | + 'selectors' => [ | |
| 3026 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-active .king-addons-fb-step-content' => 'border-color: {{VALUE}};' | |
| 3027 | + ] | |
| 3028 | + ] | |
| 3029 | + ); | |
| 3030 | + | |
| 3031 | + $this->end_controls_tab(); | |
| 3032 | + | |
| 3033 | + $this->start_controls_tab( | |
| 3034 | + 'tab_step_inner_finish', | |
| 3035 | + [ | |
| 3036 | + 'label' => esc_html__('Finish', 'king-addons'), | |
| 3037 | + ] | |
| 3038 | + ); | |
| 3039 | + | |
| 3040 | + $this->add_control( | |
| 3041 | + 'step_inner_color_finish', | |
| 3042 | + [ | |
| 3043 | + 'label' => esc_html__('Color (Labels, Icon, Number)', 'king-addons'), | |
| 3044 | + 'type' => Controls_Manager::COLOR, | |
| 3045 | + 'default' => '#FFFFFF', | |
| 3046 | + 'selectors' => [ | |
| 3047 | + '{{WRAPPER}} .king-addons-fb-step-finish .king-addons-fb-step-content i' => 'color: {{VALUE}};', | |
| 3048 | + '{{WRAPPER}} .king-addons-fb-step-finish .king-addons-fb-step-content svg' => 'fill: {{VALUE}};', | |
| 3049 | + '{{WRAPPER}} .king-addons-fb-step-finish .king-addons-fb-step-content' => 'color: {{VALUE}};' | |
| 3050 | + ] | |
| 3051 | + ] | |
| 3052 | + ); | |
| 3053 | + | |
| 3054 | + $this->add_control( | |
| 3055 | + 'step_inner_bg_color_finish', | |
| 3056 | + [ | |
| 3057 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 3058 | + 'type' => Controls_Manager::COLOR, | |
| 3059 | + 'default' => '#5B03FF', | |
| 3060 | + 'selectors' => [ | |
| 3061 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-finish .king-addons-fb-step-content' => 'background-color: {{VALUE}};', | |
| 3062 | + ] | |
| 3063 | + ] | |
| 3064 | + ); | |
| 3065 | + | |
| 3066 | + $this->add_control( | |
| 3067 | + 'step_inner_border_color_finish', | |
| 3068 | + [ | |
| 3069 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 3070 | + 'type' => Controls_Manager::COLOR, | |
| 3071 | + 'default' => '#5B03FF', | |
| 3072 | + 'selectors' => [ | |
| 3073 | + '{{WRAPPER}} .king-addons-fb-step.king-addons-fb-step-finish .king-addons-fb-step-content' => 'border-color: {{VALUE}};' | |
| 3074 | + ] | |
| 3075 | + ] | |
| 3076 | + ); | |
| 3077 | + | |
| 3078 | + $this->end_controls_tab(); | |
| 3079 | + | |
| 3080 | + $this->end_controls_tabs(); | |
| 3081 | + | |
| 3082 | + $this->add_control( | |
| 3083 | + 'step_inner_border_type', | |
| 3084 | + [ | |
| 3085 | + 'label' => esc_html__('Border Type', 'king-addons'), | |
| 3086 | + 'type' => Controls_Manager::SELECT, | |
| 3087 | + 'options' => [ | |
| 3088 | + 'none' => esc_html__('None', 'king-addons'), | |
| 3089 | + 'solid' => esc_html__('Solid', 'king-addons'), | |
| 3090 | + 'double' => esc_html__('Double', 'king-addons'), | |
| 3091 | + 'dotted' => esc_html__('Dotted', 'king-addons'), | |
| 3092 | + 'dashed' => esc_html__('Dashed', 'king-addons'), | |
| 3093 | + 'groove' => esc_html__('Groove', 'king-addons'), | |
| 3094 | + ], | |
| 3095 | + 'default' => 'solid', | |
| 3096 | + 'selectors' => [ | |
| 3097 | + '{{WRAPPER}} .king-addons-fb-step-content' => 'border-style: {{VALUE}};', | |
| 3098 | + ], | |
| 3099 | + 'separator' => 'before', | |
| 3100 | + ] | |
| 3101 | + ); | |
| 3102 | + | |
| 3103 | + $this->add_responsive_control( | |
| 3104 | + 'step_inner_border_width', | |
| 3105 | + [ | |
| 3106 | + 'label' => esc_html__('Border Width', 'king-addons'), | |
| 3107 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 3108 | + 'size_units' => ['px'], | |
| 3109 | + 'default' => [ | |
| 3110 | + 'top' => 1, | |
| 3111 | + 'right' => 1, | |
| 3112 | + 'bottom' => 1, | |
| 3113 | + 'left' => 1, | |
| 3114 | + ], | |
| 3115 | + 'selectors' => [ | |
| 3116 | + '{{WRAPPER}} .king-addons-fb-step-content' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 3117 | + ], | |
| 3118 | + 'condition' => [ | |
| 3119 | + 'step_inner_border_type!' => 'none', | |
| 3120 | + ], | |
| 3121 | + ] | |
| 3122 | + ); | |
| 3123 | + | |
| 3124 | + $this->add_control( | |
| 3125 | + 'step_inner_border_radius', | |
| 3126 | + [ | |
| 3127 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 3128 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 3129 | + 'size_units' => ['px', '%', 'em'], | |
| 3130 | + 'selectors' => [ | |
| 3131 | + '{{WRAPPER}} .king-addons-fb-step-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 3132 | + ], | |
| 3133 | + 'separator' => 'before', | |
| 3134 | + ] | |
| 3135 | + ); | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + $this->add_responsive_control( | |
| 3139 | + 'step_inner_padding', | |
| 3140 | + [ | |
| 3141 | + 'label' => esc_html__('Box Size', 'king-addons'), | |
| 3142 | + 'type' => Controls_Manager::SLIDER, | |
| 3143 | + 'size_units' => ['px'], | |
| 3144 | + 'range' => [ | |
| 3145 | + 'px' => [ | |
| 3146 | + 'min' => 0, | |
| 3147 | + 'max' => 200, | |
| 3148 | + ], | |
| 3149 | + ], | |
| 3150 | + 'default' => [ | |
| 3151 | + 'unit' => 'px', | |
| 3152 | + 'size' => 20, | |
| 3153 | + ], | |
| 3154 | + 'selectors' => [ | |
| 3155 | + '{{WRAPPER}}' => '--king-addons-fb-steps-indicator-padding: {{SIZE}}{{UNIT}};', | |
| 3156 | + ], | |
| 3157 | + 'separator' => 'before' | |
| 3158 | + ] | |
| 3159 | + ); | |
| 3160 | + | |
| 3161 | + $this->add_responsive_control( | |
| 3162 | + 'step_icon_size', | |
| 3163 | + [ | |
| 3164 | + 'label' => esc_html__('Icon Size', 'king-addons'), | |
| 3165 | + 'type' => Controls_Manager::SLIDER, | |
| 3166 | + 'size_units' => ['px'], | |
| 3167 | + 'range' => [ | |
| 3168 | + 'px' => [ | |
| 3169 | + 'min' => 0, | |
| 3170 | + 'max' => 25, | |
| 3171 | + ], | |
| 3172 | + ], | |
| 3173 | + 'default' => [ | |
| 3174 | + 'unit' => 'px', | |
| 3175 | + 'size' => 12, | |
| 3176 | + ], | |
| 3177 | + 'selectors' => [ | |
| 3178 | + '{{WRAPPER}} .king-addons-fb-step' => 'font-size: {{SIZE}}{{UNIT}};', | |
| 3179 | + '{{WRAPPER}} .king-addons-fb-step svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', | |
| 3180 | + ], | |
| 3181 | + 'condition' => [ | |
| 3182 | + 'step_type' => ['icon', 'icon_text'] | |
| 3183 | + ] | |
| 3184 | + ] | |
| 3185 | + ); | |
| 3186 | + | |
| 3187 | + $this->add_responsive_control( | |
| 3188 | + 'step_label_distance', | |
| 3189 | + [ | |
| 3190 | + 'label' => esc_html__('Distance', 'king-addons'), | |
| 3191 | + 'type' => Controls_Manager::SLIDER, | |
| 3192 | + 'size_units' => ['px'], | |
| 3193 | + 'range' => [ | |
| 3194 | + 'px' => [ | |
| 3195 | + 'min' => 0, | |
| 3196 | + 'max' => 50, | |
| 3197 | + ], | |
| 3198 | + ], | |
| 3199 | + 'default' => [ | |
| 3200 | + 'unit' => 'px', | |
| 3201 | + 'size' => 5, | |
| 3202 | + ], | |
| 3203 | + 'selectors' => [ | |
| 3204 | + '{{WRAPPER}}.king-addons-fb-step-content-layout-horizontal .king-addons-fb-step-label' => 'margin-left: {{SIZE}}{{UNIT}};', | |
| 3205 | + '{{WRAPPER}}.king-addons-fb-step-content-layout-vertical .king-addons-fb-step-label' => 'margin-top: {{SIZE}}{{UNIT}};' | |
| 3206 | + ], | |
| 3207 | + 'separator' => 'before', | |
| 3208 | + 'condition' => [ | |
| 3209 | + 'step_type' => ['number_text', 'icon_text'] | |
| 3210 | + ] | |
| 3211 | + ] | |
| 3212 | + ); | |
| 3213 | + | |
| 3214 | + $this->add_control( | |
| 3215 | + 'step_divider', | |
| 3216 | + [ | |
| 3217 | + 'label' => esc_html__('Divider', 'king-addons'), | |
| 3218 | + 'type' => Controls_Manager::HEADING, | |
| 3219 | + 'separator' => 'before', | |
| 3220 | + 'condition' => [ | |
| 3221 | + 'step_type!' => 'progress_bar' | |
| 3222 | + ] | |
| 3223 | + ] | |
| 3224 | + ); | |
| 3225 | + | |
| 3226 | + $this->add_control( | |
| 3227 | + 'step_progressbar', | |
| 3228 | + [ | |
| 3229 | + 'label' => esc_html__('Progressbar', 'king-addons'), | |
| 3230 | + 'type' => Controls_Manager::HEADING, | |
| 3231 | + 'separator' => 'before', | |
| 3232 | + 'condition' => [ | |
| 3233 | + 'step_type' => 'progress_bar' | |
| 3234 | + ] | |
| 3235 | + ] | |
| 3236 | + ); | |
| 3237 | + | |
| 3238 | + $this->add_control( | |
| 3239 | + 'step_divider_color', | |
| 3240 | + [ | |
| 3241 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 3242 | + 'type' => Controls_Manager::COLOR, | |
| 3243 | + 'default' => '#000000', | |
| 3244 | + 'selectors' => [ | |
| 3245 | + '{{WRAPPER}} .king-addons-fb-step-sep' => 'background-color: {{VALUE}};', | |
| 3246 | + '{{WRAPPER}} .king-addons-fb-step-progress' => 'background-color: {{VALUE}};', | |
| 3247 | + ] | |
| 3248 | + ] | |
| 3249 | + ); | |
| 3250 | + | |
| 3251 | + $this->add_control( | |
| 3252 | + 'step_progress_text_color', | |
| 3253 | + [ | |
| 3254 | + 'label' => esc_html__('Text Color', 'king-addons'), | |
| 3255 | + 'type' => Controls_Manager::COLOR, | |
| 3256 | + 'default' => '#FFF', | |
| 3257 | + 'selectors' => [ | |
| 3258 | + '{{WRAPPER}} .king-addons-fb-step-progress-fill' => 'color: {{VALUE}};', | |
| 3259 | + ], | |
| 3260 | + 'condition' => [ | |
| 3261 | + 'step_type' => 'progress_bar' | |
| 3262 | + ] | |
| 3263 | + ] | |
| 3264 | + ); | |
| 3265 | + | |
| 3266 | + $this->add_control( | |
| 3267 | + 'step_progress_fill_color', | |
| 3268 | + [ | |
| 3269 | + 'label' => esc_html__('Fill Color', 'king-addons'), | |
| 3270 | + 'type' => Controls_Manager::COLOR, | |
| 3271 | + 'default' => '#5B03FF', | |
| 3272 | + 'selectors' => [ | |
| 3273 | + '{{WRAPPER}} .king-addons-fb-step-progress-fill' => 'background-color: {{VALUE}};', | |
| 3274 | + ], | |
| 3275 | + 'condition' => [ | |
| 3276 | + 'step_type' => 'progress_bar' | |
| 3277 | + ] | |
| 3278 | + ] | |
| 3279 | + ); | |
| 3280 | + | |
| 3281 | + $this->add_group_control( | |
| 3282 | + Group_Control_Typography::get_type(), | |
| 3283 | + [ | |
| 3284 | + 'name' => 'step_percent_typo', | |
| 3285 | + 'selector' => '{{WRAPPER}} .king-addons-fb-step-progress-fill', | |
| 3286 | + 'condition' => [ | |
| 3287 | + 'step_type' => 'progress_bar' | |
| 3288 | + ] | |
| 3289 | + ] | |
| 3290 | + ); | |
| 3291 | + | |
| 3292 | + $this->add_responsive_control( | |
| 3293 | + 'step_divider_height', | |
| 3294 | + [ | |
| 3295 | + 'label' => esc_html__('Divider Height', 'king-addons'), | |
| 3296 | + 'type' => Controls_Manager::SLIDER, | |
| 3297 | + 'size_units' => ['px'], | |
| 3298 | + 'range' => [ | |
| 3299 | + 'px' => [ | |
| 3300 | + 'min' => 0, | |
| 3301 | + 'max' => 10, | |
| 3302 | + ], | |
| 3303 | + ], | |
| 3304 | + 'default' => [ | |
| 3305 | + 'unit' => 'px', | |
| 3306 | + 'size' => 2, | |
| 3307 | + ], | |
| 3308 | + 'selectors' => [ | |
| 3309 | + '{{WRAPPER}}' => '--king-addons-fb-steps-divider-width: {{SIZE}}{{UNIT}};' | |
| 3310 | + ], | |
| 3311 | + 'condition' => [ | |
| 3312 | + 'step_type!' => 'progress_bar' | |
| 3313 | + ] | |
| 3314 | + ] | |
| 3315 | + ); | |
| 3316 | + | |
| 3317 | + $this->add_responsive_control( | |
| 3318 | + 'step_progress_text_distance', | |
| 3319 | + [ | |
| 3320 | + 'label' => esc_html__('Text Distance', 'king-addons'), | |
| 3321 | + 'type' => Controls_Manager::SLIDER, | |
| 3322 | + 'size_units' => ['px'], | |
| 3323 | + 'range' => [ | |
| 3324 | + 'px' => [ | |
| 3325 | + 'min' => 0, | |
| 3326 | + 'max' => 50, | |
| 3327 | + ], | |
| 3328 | + ], | |
| 3329 | + 'default' => [ | |
| 3330 | + 'unit' => 'px', | |
| 3331 | + 'size' => 10, | |
| 3332 | + ], | |
| 3333 | + 'selectors' => [ | |
| 3334 | + '{{WRAPPER}} .king-addons-fb-step-progress-fill' => 'padding-right: {{SIZE}}{{UNIT}};' | |
| 3335 | + ], | |
| 3336 | + 'condition' => [ | |
| 3337 | + 'step_type' => 'progress_bar' | |
| 3338 | + ] | |
| 3339 | + ] | |
| 3340 | + ); | |
| 3341 | + | |
| 3342 | + $this->add_responsive_control( | |
| 3343 | + 'step_progress_border_radius', | |
| 3344 | + [ | |
| 3345 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 3346 | + 'type' => Controls_Manager::SLIDER, | |
| 3347 | + 'size_units' => ['px'], | |
| 3348 | + 'range' => [ | |
| 3349 | + 'px' => [ | |
| 3350 | + 'min' => 0, | |
| 3351 | + 'max' => 100, | |
| 3352 | + ], | |
| 3353 | + ], | |
| 3354 | + 'default' => [ | |
| 3355 | + 'unit' => 'px', | |
| 3356 | + 'size' => 0, | |
| 3357 | + ], | |
| 3358 | + 'selectors' => [ | |
| 3359 | + '{{WRAPPER}} .king-addons-fb-step-progress' => 'border-radius: {{SIZE}}{{UNIT}};', | |
| 3360 | + '{{WRAPPER}} .king-addons-fb-step-progress-fill' => 'border-radius: {{SIZE}}{{UNIT}};' | |
| 3361 | + ], | |
| 3362 | + 'condition' => [ | |
| 3363 | + 'step_type' => 'progress_bar' | |
| 3364 | + ] | |
| 3365 | + ] | |
| 3366 | + ); | |
| 3367 | + | |
| 3368 | + $this->add_control( | |
| 3369 | + 'step_main_label', | |
| 3370 | + [ | |
| 3371 | + 'label' => esc_html__('Main Label', 'king-addons'), | |
| 3372 | + 'type' => Controls_Manager::HEADING, | |
| 3373 | + 'separator' => 'before', | |
| 3374 | + ] | |
| 3375 | + ); | |
| 3376 | + | |
| 3377 | + $this->add_group_control( | |
| 3378 | + Group_Control_Typography::get_type(), | |
| 3379 | + [ | |
| 3380 | + 'name' => 'main_label_typography', | |
| 3381 | + 'selector' => '{{WRAPPER}} .king-addons-fb-step-main-label', | |
| 3382 | + 'fields_options' => [ | |
| 3383 | + 'typography' => [ | |
| 3384 | + 'default' => 'custom', | |
| 3385 | + ], | |
| 3386 | + 'font_size' => [ | |
| 3387 | + 'default' => [ | |
| 3388 | + 'size' => '12', | |
| 3389 | + 'unit' => 'px', | |
| 3390 | + ], | |
| 3391 | + ] | |
| 3392 | + ] | |
| 3393 | + ] | |
| 3394 | + ); | |
| 3395 | + | |
| 3396 | + $this->add_control( | |
| 3397 | + 'step_sub_label', | |
| 3398 | + [ | |
| 3399 | + 'label' => esc_html__('Sub Label', 'king-addons'), | |
| 3400 | + 'type' => Controls_Manager::HEADING, | |
| 3401 | + 'separator' => 'before', | |
| 3402 | + ] | |
| 3403 | + ); | |
| 3404 | + | |
| 3405 | + $this->add_group_control( | |
| 3406 | + Group_Control_Typography::get_type(), | |
| 3407 | + [ | |
| 3408 | + 'name' => 'sub_label_typography', | |
| 3409 | + 'selector' => '{{WRAPPER}} .king-addons-fb-step-sub-label', | |
| 3410 | + 'fields_options' => [ | |
| 3411 | + 'typography' => [ | |
| 3412 | + 'default' => 'custom', | |
| 3413 | + ], | |
| 3414 | + 'font_size' => [ | |
| 3415 | + 'default' => [ | |
| 3416 | + 'size' => '12', | |
| 3417 | + 'unit' => 'px', | |
| 3418 | + ], | |
| 3419 | + ] | |
| 3420 | + ] | |
| 3421 | + ] | |
| 3422 | + ); | |
| 3423 | + | |
| 3424 | + $this->add_control( | |
| 3425 | + 'step_number_heading', | |
| 3426 | + [ | |
| 3427 | + 'label' => esc_html__('Number', 'king-addons'), | |
| 3428 | + 'type' => Controls_Manager::HEADING, | |
| 3429 | + 'separator' => 'before', | |
| 3430 | + 'condition' => [ | |
| 3431 | + 'step_type' => ['number', 'number_text'] | |
| 3432 | + ] | |
| 3433 | + ] | |
| 3434 | + ); | |
| 3435 | + | |
| 3436 | + $this->add_group_control( | |
| 3437 | + Group_Control_Typography::get_type(), | |
| 3438 | + [ | |
| 3439 | + 'name' => 'step_number', | |
| 3440 | + 'selector' => '{{WRAPPER}} .king-addons-fb-step-number', | |
| 3441 | + 'fields_options' => [ | |
| 3442 | + 'typography' => [ | |
| 3443 | + 'default' => 'custom', | |
| 3444 | + ], | |
| 3445 | + 'font_size' => [ | |
| 3446 | + 'default' => [ | |
| 3447 | + 'size' => '12', | |
| 3448 | + 'unit' => 'px', | |
| 3449 | + ], | |
| 3450 | + ] | |
| 3451 | + ], | |
| 3452 | + 'condition' => [ | |
| 3453 | + 'step_type' => ['number', 'number_text'] | |
| 3454 | + ] | |
| 3455 | + ] | |
| 3456 | + ); | |
| 3457 | + | |
| 3458 | + $this->end_controls_section(); | |
| 3459 | + | |
| 3460 | + $this->start_controls_section( | |
| 3461 | + 'section_results_style', | |
| 3462 | + [ | |
| 3463 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Results', 'king-addons'), | |
| 3464 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 3465 | + ] | |
| 3466 | + ); | |
| 3467 | + | |
| 3468 | + $this->add_group_control( | |
| 3469 | + Group_Control_Typography::get_type(), | |
| 3470 | + [ | |
| 3471 | + 'name' => 'results_typography', | |
| 3472 | + 'selector' => '{{WRAPPER}} .king-addons-submit-success, {{WRAPPER}} .king-addons-submit-error', | |
| 3473 | + 'fields_options' => [ | |
| 3474 | + 'typography' => [ | |
| 3475 | + 'default' => 'custom', | |
| 3476 | + ], | |
| 3477 | + 'font_size' => [ | |
| 3478 | + 'default' => [ | |
| 3479 | + 'size' => '12', | |
| 3480 | + 'unit' => 'px', | |
| 3481 | + ], | |
| 3482 | + ] | |
| 3483 | + ] | |
| 3484 | + ] | |
| 3485 | + ); | |
| 3486 | + | |
| 3487 | + $this->add_control( | |
| 3488 | + 'success_result_color', | |
| 3489 | + [ | |
| 3490 | + 'label' => esc_html__('Success Color', 'king-addons'), | |
| 3491 | + 'type' => Controls_Manager::COLOR, | |
| 3492 | + 'default' => '#30CBCB', | |
| 3493 | + 'selectors' => [ | |
| 3494 | + '{{WRAPPER}} .king-addons-submit-success' => 'color: {{VALUE}};', | |
| 3495 | + ], | |
| 3496 | + ] | |
| 3497 | + ); | |
| 3498 | + | |
| 3499 | + $this->add_control( | |
| 3500 | + 'error_message_color', | |
| 3501 | + [ | |
| 3502 | + 'label' => esc_html__('Error Color', 'king-addons'), | |
| 3503 | + 'type' => Controls_Manager::COLOR, | |
| 3504 | + 'default' => '#CB3030', | |
| 3505 | + 'selectors' => [ | |
| 3506 | + '{{WRAPPER}} .king-addons-submit-error' => 'color: {{VALUE}};', | |
| 3507 | + ], | |
| 3508 | + ] | |
| 3509 | + ); | |
| 3510 | + | |
| 3511 | + $this->add_responsive_control( | |
| 3512 | + 'finish_message_align', | |
| 3513 | + [ | |
| 3514 | + 'label' => esc_html__('Alignment', 'king-addons'), | |
| 3515 | + 'type' => Controls_Manager::CHOOSE, | |
| 3516 | + 'options' => [ | |
| 3517 | + 'left' => [ | |
| 3518 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 3519 | + 'icon' => 'eicon-text-align-left', | |
| 3520 | + ], | |
| 3521 | + 'center' => [ | |
| 3522 | + 'title' => esc_html__('Center', 'king-addons'), | |
| 3523 | + 'icon' => 'eicon-text-align-center', | |
| 3524 | + ], | |
| 3525 | + 'right' => [ | |
| 3526 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 3527 | + 'icon' => 'eicon-text-align-right', | |
| 3528 | + ], | |
| 3529 | + ], | |
| 3530 | + 'default' => 'center', | |
| 3531 | + 'selectors' => [ | |
| 3532 | + '{{WRAPPER}} .king-addons-submit-success' => 'text-align: {{VALUE}}', | |
| 3533 | + '{{WRAPPER}} .king-addons-submit-error' => 'text-align: {{VALUE}}' | |
| 3534 | + ], | |
| 3535 | + ] | |
| 3536 | + ); | |
| 3537 | + | |
| 3538 | + $this->end_controls_section(); | |
| 3539 | + | |
| 3540 | + | |
| 3541 | + Core::renderProFeaturesSection($this, '', Controls_Manager::RAW_HTML, 'king-addons-form-builder', [ | |
| 3542 | + 'Unlimited number of fields', | |
| 3543 | + 'Submission action', | |
| 3544 | + 'Mailchimp action', | |
| 3545 | + 'Webhook action' | |
| 3546 | + ]); | |
| 3547 | + } | |
| 3548 | + | |
| 3549 | + private function add_required_attribute($element) | |
| 3550 | + { | |
| 3551 | + $this->add_render_attribute($element, 'required', 'required'); | |
| 3552 | + $this->add_render_attribute($element, 'aria-required', 'true'); | |
| 3553 | + } | |
| 3554 | + | |
| 3555 | + public function get_attribute_name($item) | |
| 3556 | + { | |
| 3557 | + return 'form_fields[' . self::resolve_field_key($item) . ']'; | |
| 3558 | + } | |
| 3559 | + | |
| 3560 | + public function get_attribute_id($item) | |
| 3561 | + { | |
| 3562 | + return 'form-field-' . self::resolve_field_key($item); | |
| 3563 | + } | |
| 3564 | + | |
| 3565 | + /** | |
| 3566 | + * Field ID used as the submitted name/key. | |
| 3567 | + * | |
| 3568 | + * An empty Field ID used to produce name="form_fields[]", which PHP cannot | |
| 3569 | + * map back onto the field. Fall back to Elementor's repeater _id so imported | |
| 3570 | + * and programmatic forms still keep their values. | |
| 3571 | + * | |
| 3572 | + * @param array<string,mixed> $item Repeater row. | |
| 3573 | + * | |
| 3574 | + * @return string | |
| 3575 | + */ | |
| 3576 | + public static function resolve_field_key($item): string | |
| 3577 | + { | |
| 3578 | + if (!is_array($item)) { | |
| 3579 | + return ''; | |
| 3580 | + } | |
| 3581 | + | |
| 3582 | + $id = isset($item['field_id']) ? trim((string) $item['field_id']) : ''; | |
| 3583 | + if ('' !== $id) { | |
| 3584 | + return $id; | |
| 3585 | + } | |
| 3586 | + | |
| 3587 | + return isset($item['_id']) ? trim((string) $item['_id']) : ''; | |
| 3588 | + } | |
| 3589 | + | |
| 3590 | + protected function make_textarea_field($item, $item_index) | |
| 3591 | + { | |
| 3592 | + $this->add_render_attribute('textarea' . $item_index, [ | |
| 3593 | + 'class' => [ | |
| 3594 | + 'king-addons-form-field-textual', | |
| 3595 | + 'king-addons-form-field', | |
| 3596 | + esc_attr($item['css_classes']) | |
| 3597 | + ], | |
| 3598 | + 'name' => $this->get_attribute_name($item), | |
| 3599 | + 'id' => $this->get_attribute_id($item), | |
| 3600 | + 'rows' => $item['rows'], | |
| 3601 | + ]); | |
| 3602 | + | |
| 3603 | + if ('true' == $this->get_settings_for_display()['show_placeholders'] && $item['placeholder']) { | |
| 3604 | + $this->add_render_attribute('textarea' . $item_index, 'placeholder', $item['placeholder']); | |
| 3605 | + } | |
| 3606 | + | |
| 3607 | + if ($item['required']) { | |
| 3608 | + $this->add_required_attribute('textarea' . $item_index); | |
| 3609 | + } | |
| 3610 | + | |
| 3611 | + $value = empty($item['field_value']) ? '' : $item['field_value']; | |
| 3612 | + | |
| 3613 | + return '<textarea ' . $this->get_render_attribute_string('textarea' . $item_index) . '>' . esc_textarea($value) . '</textarea>'; | |
| 3614 | + } | |
| 3615 | + | |
| 3616 | + protected function make_select_field($item, $i) | |
| 3617 | + { | |
| 3618 | + $this->add_render_attribute( | |
| 3619 | + [ | |
| 3620 | + 'select-wrapper' . $i => [ | |
| 3621 | + 'class' => [ | |
| 3622 | + 'king-addons-form-field', | |
| 3623 | + 'king-addons-select-wrap', | |
| 3624 | + 'king-addons-fi-svg-' . (Plugin::$instance->experiments->is_feature_active('e_font_icon_svg') ? 'yes' : 'no'), | |
| 3625 | + 'remove-before', | |
| 3626 | + esc_attr($item['css_classes']), | |
| 3627 | + ], | |
| 3628 | + ], | |
| 3629 | + 'select' . $i => [ | |
| 3630 | + 'name' => $this->get_attribute_name($item) . (!empty($item['allow_multiple']) ? '[]' : ''), | |
| 3631 | + 'id' => $this->get_attribute_id($item), | |
| 3632 | + 'class' => [ | |
| 3633 | + 'king-addons-form-field-textual' | |
| 3634 | + ], | |
| 3635 | + ], | |
| 3636 | + ] | |
| 3637 | + ); | |
| 3638 | + | |
| 3639 | + if ($item['required']) { | |
| 3640 | + $this->add_required_attribute('select' . $i); | |
| 3641 | + } | |
| 3642 | + | |
| 3643 | + if ($item['allow_multiple']) { | |
| 3644 | + $this->add_render_attribute('select' . $i, 'multiple'); | |
| 3645 | + if (!empty($item['select_size'])) { | |
| 3646 | + $this->add_render_attribute('select' . $i, 'size', $item['select_size']); | |
| 3647 | + } | |
| 3648 | + } | |
| 3649 | + | |
| 3650 | + $options = preg_split("/\\r\\n|\\r|\\n/", $item['field_options']); | |
| 3651 | + | |
| 3652 | + if (!$options) { | |
| 3653 | + return ''; | |
| 3654 | + } | |
| 3655 | + | |
| 3656 | + ob_start(); | |
| 3657 | + ?> | |
| 3658 | + <div <?php $this->print_render_attribute_string('select-wrapper' . $i); ?>> | |
| 3659 | + | |
| 3660 | + <?php if (Plugin::$instance->experiments->is_feature_active('e_font_icon_svg')) { ?> | |
| 3661 | + <svg class="e-font-icon-svg e-eicon-caret-up" viewBox="0 0 1000 500"> | |
| 3662 | + <path d="M763 279c8-8 8-12 8-25 0-8-4-16-8-25-9-8-13-8-25-8h-459c-8 0-16 4-25 8 0 9-4 17-4 25 0 9 4 17 8 25l230 229c8 5 16 9 25 9 8 0 16-4 25-9l225-229z"/> | |
| 3663 | + </svg> | |
| 3664 | + <?php } ?> | |
| 3665 | + <!--suppress HtmlFormInputWithoutLabel --> | |
| 3666 | + <select <?php $this->print_render_attribute_string('select' . $i); ?>> | |
| 3667 | + <?php | |
| 3668 | + foreach ($options as $key => $option) : | |
| 3669 | + $field_key = self::resolve_field_key($item); | |
| 3670 | + $option_id = $field_key . $key; | |
| 3671 | + $option_value = esc_attr($option); | |
| 3672 | + $option_label = esc_html($option); | |
| 3673 | + | |
| 3674 | + if (false !== strpos($option, '|')) { | |
| 3675 | + list($label, $value) = explode('|', $option); | |
| 3676 | + $option_value = esc_attr($value); | |
| 3677 | + $option_label = esc_html($label); | |
| 3678 | + } | |
| 3679 | + | |
| 3680 | + $this->add_render_attribute($option_id, 'value', $option_value); | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + if (!empty($item['field_value']) && in_array($option_value, explode(',', $item['field_value']))) { | |
| 3684 | + $this->add_render_attribute($option_id, 'selected', 'selected'); | |
| 3685 | + } ?> | |
| 3686 | + <option <?php $this->print_render_attribute_string($option_id); ?>> | |
| 3687 | + <?php | |
| 3688 | + | |
| 3689 | + echo $option_label; | |
| 3690 | + ?> | |
| 3691 | + </option> | |
| 3692 | + <?php endforeach; ?> | |
| 3693 | + </select> | |
| 3694 | + </div> | |
| 3695 | + <?php | |
| 3696 | + | |
| 3697 | + $select = ob_get_clean(); | |
| 3698 | + return $select; | |
| 3699 | + } | |
| 3700 | + | |
| 3701 | + protected function make_radio_checkbox_field($item, $item_index, $type) | |
| 3702 | + { | |
| 3703 | + $options = preg_split("/\\r\\n|\\r|\\n/", $item['field_options']); | |
| 3704 | + $html = ''; | |
| 3705 | + if ($options) { | |
| 3706 | + $html .= '<div class="king-addons-field-sub-group ' . esc_attr($item['css_classes']) . ' ' . esc_attr($item['inline_list']) . '">'; | |
| 3707 | + foreach ($options as $key => $option) { | |
| 3708 | + $field_key = self::resolve_field_key($item); | |
| 3709 | + $element_id = ($field_key ? esc_attr($field_key) : $item['field_type']) . $key; | |
| 3710 | + $html_id = $this->get_attribute_id($item) . '-' . $key; | |
| 3711 | + $option_label = $option; | |
| 3712 | + $option_value = $option; | |
| 3713 | + | |
| 3714 | + if (false !== strpos($option, '|')) { | |
| 3715 | + list($option_label, $option_value) = explode('|', $option); | |
| 3716 | + } | |
| 3717 | + | |
| 3718 | + $this->add_render_attribute( | |
| 3719 | + $element_id, | |
| 3720 | + [ | |
| 3721 | + 'type' => $type, | |
| 3722 | + 'value' => $option_value, | |
| 3723 | + 'id' => $html_id, | |
| 3724 | + 'name' => $this->get_attribute_name($item) . (('checkbox' === $type && count($options) > 1) ? '[]' : ''), | |
| 3725 | + ] | |
| 3726 | + ); | |
| 3727 | + | |
| 3728 | + if (!empty($item['field_value']) && $option_value === $item['field_value']) { | |
| 3729 | + $this->add_render_attribute($element_id, 'checked', 'checked'); | |
| 3730 | + } | |
| 3731 | + | |
| 3732 | + if ($item['required'] && ('radio' === $type || 'checkbox' === $type)) { | |
| 3733 | + $this->add_required_attribute($element_id); | |
| 3734 | + } | |
| 3735 | + | |
| 3736 | + $html .= '<span class="king-addons-form-field-option" data-key="form-field-' . esc_attr(self::resolve_field_key($item)) . '"><input ' . $this->get_render_attribute_string($element_id) . '> <label for="' . esc_attr($html_id) . '">' . esc_html($option_label) . '</label></span>'; | |
| 3737 | + } | |
| 3738 | + $html .= '</div>'; | |
| 3739 | + } | |
| 3740 | + | |
| 3741 | + return $html; | |
| 3742 | + } | |
| 3743 | + | |
| 3744 | + protected function form_fields_render_attributes($i, $instance, $item) | |
| 3745 | + { | |
| 3746 | + $this->add_render_attribute( | |
| 3747 | + [ | |
| 3748 | + 'field-group' . $i => [ | |
| 3749 | + 'class' => [ | |
| 3750 | + 'king-addons-form-field-type-' . $item['field_type'], | |
| 3751 | + 'king-addons-field-group', | |
| 3752 | + 'king-addons-column', | |
| 3753 | + 'king-addons-field-group-' . esc_attr(self::resolve_field_key($item)), | |
| 3754 | + ], | |
| 3755 | + ], | |
| 3756 | + 'input' . $i => [ | |
| 3757 | + 'type' => ('acceptance' === $item['field_type']) ? 'checkbox' : (('upload' === $item['field_type']) ? 'file' : $item['field_type']), | |
| 3758 | + 'name' => $this->get_attribute_name($item), | |
| 3759 | + 'id' => $this->get_attribute_id($item), | |
| 3760 | + 'class' => [ | |
| 3761 | + 'king-addons-form-field', | |
| 3762 | + empty($item['css_classes']) ? '' : esc_attr($item['css_classes']), | |
| 3763 | + ], | |
| 3764 | + ], | |
| 3765 | + 'label' . $i => [ | |
| 3766 | + 'for' => $this->get_attribute_id($item), | |
| 3767 | + 'class' => 'king-addons-form-field-label', | |
| 3768 | + ], | |
| 3769 | + ] | |
| 3770 | + ); | |
| 3771 | + | |
| 3772 | + if (empty($item['width'])) { | |
| 3773 | + $item['width'] = '100'; | |
| 3774 | + } | |
| 3775 | + | |
| 3776 | + | |
| 3777 | + if ($item['allow_multiple']) { | |
| 3778 | + $this->add_render_attribute('field-group' . $i, 'class', 'king-addons-form-field-type-' . $item['field_type'] . '-multiple'); | |
| 3779 | + } | |
| 3780 | + | |
| 3781 | + | |
| 3782 | + $this->add_render_attribute('field-group' . $i, 'class', 'elementor-repeater-item-' . esc_attr($item['_id'])); | |
| 3783 | + | |
| 3784 | + // Conditional logic travels to the browser as one data attribute; the | |
| 3785 | + // script evaluates it on every change in the form. | |
| 3786 | + if (class_exists('King_Addons\\Form_Conditional_Logic')) { | |
| 3787 | + $condition = Form_Conditional_Logic::build($item); | |
| 3788 | + if (null !== $condition) { | |
| 3789 | + $this->add_render_attribute('field-group' . $i, 'data-ka-cond', wp_json_encode($condition)); | |
| 3790 | + } | |
| 3791 | + } | |
| 3792 | + | |
| 3793 | + | |
| 3794 | + if ('true' == $instance['show_placeholders'] && !Utils::is_empty($item['placeholder'])) { | |
| 3795 | + $this->add_render_attribute('input' . $i, 'placeholder', $item['placeholder']); | |
| 3796 | + } | |
| 3797 | + | |
| 3798 | + if (!empty($item['field_value'])) { | |
| 3799 | + $this->add_render_attribute('input' . $i, 'value', $item['field_value']); | |
| 3800 | + } | |
| 3801 | + | |
| 3802 | + if (!$instance['show_labels']) { | |
| 3803 | + $this->add_render_attribute('label' . $i, 'class', 'king-addons-hidden-element'); | |
| 3804 | + } | |
| 3805 | + | |
| 3806 | + if (!empty($item['required'])) { | |
| 3807 | + $class = 'king-addons-form-field-required'; | |
| 3808 | + if (!empty($instance['mark_required'])) { | |
| 3809 | + $class .= ' king-addons-required-mark'; | |
| 3810 | + } | |
| 3811 | + $this->add_render_attribute('field-group' . $i, 'class', $class); | |
| 3812 | + $this->add_required_attribute('input' . $i); | |
| 3813 | + } | |
| 3814 | + } | |
| 3815 | + | |
| 3816 | + private function render_form_icon($settings) | |
| 3817 | + { ?> | |
| 3818 | + <span <?php echo $this->get_render_attribute_string('icon-align'); ?>> | |
| 3819 | + <?php Icons_Manager::render_icon($settings['selected_button_icon'], ['aria-hidden' => 'true']); ?> | |
| 3820 | + <?php if (empty($settings['button_text'])) : ?> | |
| 3821 | + <span class="king-addons-hidden-element"><?php echo esc_html__('Submit', 'king-addons'); ?></span> | |
| 3822 | + <?php endif; ?> | |
| 3823 | + </span> | |
| 3824 | + <?php } | |
| 3825 | + | |
| 3826 | + public function render_submit_button($instance) | |
| 3827 | + { | |
| 3828 | + ?> | |
| 3829 | + <button type="submit" <?php echo $this->get_render_attribute_string('button'); ?>> | |
| 3830 | + <span <?php echo $this->get_render_attribute_string('content-wrapper'); ?>> | |
| 3831 | + <?php if (!empty($instance['selected_button_icon']) && 'left' === $instance['button_icon_align']) : ?> | |
| 3832 | + <?php $this->render_form_icon($instance); ?> | |
| 3833 | + <?php endif; ?> | |
| 3834 | + <?php if (!empty($instance['button_text'])) : ?> | |
| 3835 | + <span><?php $this->print_unescaped_setting('button_text'); ?></span> | |
| 3836 | + <?php endif; ?> | |
| 3837 | + <?php if (!empty($instance['selected_button_icon']) && 'right' === $instance['button_icon_align']) : ?> | |
| 3838 | + <?php $this->render_form_icon($instance); ?> | |
| 3839 | + <?php endif; ?> | |
| 3840 | + </span> | |
| 3841 | + <div class="king-addons-double-bounce king-addons-loader-hidden"> | |
| 3842 | + <div class="king-addons-child king-addons-double-bounce1"></div> | |
| 3843 | + <div class="king-addons-child king-addons-double-bounce2"></div> | |
| 3844 | + </div> | |
| 3845 | + </button> | |
| 3846 | + <?php | |
| 3847 | + } | |
| 3848 | + | |
| 3849 | + protected function render() | |
| 3850 | + { | |
| 3851 | + global $post; | |
| 3852 | + $instance = $this->get_settings_for_display(); | |
| 3853 | + | |
| 3854 | + $form_fields_length = sizeof($instance['form_fields']); | |
| 3855 | + $thisId = $this->get_id(); | |
| 3856 | + | |
| 3857 | + update_option('king_addons_email_content_type_' . $this->get_id(), $instance['email_content_type']); | |
| 3858 | + update_option('king_addons_email_to_' . $this->get_id(), $instance['email_to']); | |
| 3859 | + update_option('king_addons_email_subject_' . $this->get_id(), $instance['email_subject']); | |
| 3860 | + update_option('king_addons_email_fields_' . $this->get_id(), $instance['email_content']); | |
| 3861 | + update_option('king_addons_cc_header_' . $this->get_id(), $instance['email_to_cc']); | |
| 3862 | + update_option('king_addons_bcc_header_' . $this->get_id(), $instance['email_to_bcc']); | |
| 3863 | + update_option('king_addons_email_from_' . $this->get_id(), $instance['email_from']); | |
| 3864 | + update_option('king_addons_email_from_name_' . $this->get_id(), $instance['email_from_name']); | |
| 3865 | + update_option('king_addons_reply_to_' . $this->get_id(), $instance['email_reply_to']); | |
| 3866 | + update_option('king_addons_meta_keys_' . $this->get_id(), $instance['form_metadata']); | |
| 3867 | + update_option('king_addons_referrer_' . $this->get_id(), home_url($_SERVER['REQUEST_URI'])); | |
| 3868 | + update_option('king_addons_referrer_title_' . $this->get_id(), get_the_title($post->ID)); | |
| 3869 | + update_option('king_addons_webhook_url_' . $this->get_id(), $instance['webhook_url']); | |
| 3870 | + | |
| 3871 | + if (class_exists('King_Addons\\Form_Integrations')) { | |
| 3872 | + Form_Integrations::save_settings($this->get_id(), $instance); | |
| 3873 | + } | |
| 3874 | + | |
| 3875 | + if (class_exists('King_Addons\\Form_Payments')) { | |
| 3876 | + Form_Payments::save_settings( | |
| 3877 | + $this->get_id(), | |
| 3878 | + $instance, | |
| 3879 | + isset($post->ID) ? (int) $post->ID : (int) get_the_ID() | |
| 3880 | + ); | |
| 3881 | + } | |
| 3882 | + | |
| 3883 | + $partial_entries = false; | |
| 3884 | + if (class_exists('King_Addons\\Form_Partial_Entries')) { | |
| 3885 | + $partial_entries = 'yes' === ($instance['partial_entries'] ?? '') | |
| 3886 | + && king_addons_freemius()->can_use_premium_code__premium_only(); | |
| 3887 | + Form_Partial_Entries::save_setting($this->get_id(), $partial_entries); | |
| 3888 | + } | |
| 3889 | + | |
| 3890 | + // The submit actions are separate AJAX endpoints, so the challenge has | |
| 3891 | + // to be checked there; they read it back by form id. | |
| 3892 | + $spam_mode = 'none'; | |
| 3893 | + if (class_exists('King_Addons\\Form_Spam_Protection')) { | |
| 3894 | + $spam_mode = (string) ($instance['spam_protection'] ?? 'none'); | |
| 3895 | + Form_Spam_Protection::save_mode($this->get_id(), $spam_mode); | |
| 3896 | + $spam_mode = Form_Spam_Protection::get_mode($this->get_id()); | |
| 3897 | + | |
| 3898 | + $spam_script = Form_Spam_Protection::script($spam_mode); | |
| 3899 | + if (null !== $spam_script) { | |
| 3900 | + wp_enqueue_script($spam_script['handle'], $spam_script['src'], [], null, true); | |
| 3901 | + } | |
| 3902 | + } | |
| 3903 | + | |
| 3904 | + $emailField = isset($instance['email_field']) ? $instance['email_field'] : ''; | |
| 3905 | + $firstNameField = isset($instance['first_name_field']) ? $instance['first_name_field'] : ''; | |
| 3906 | + $lastNameField = isset($instance['last_name_field']) ? $instance['last_name_field'] : ''; | |
| 3907 | + $addressField = isset($instance['address_field']) ? $instance['address_field'] : ''; | |
| 3908 | + $phoneField = isset($instance['phone_field']) ? $instance['phone_field'] : ''; | |
| 3909 | + $birthdayField = isset($instance['birthday_field']) ? $instance['birthday_field'] : ''; | |
| 3910 | + $groupId = isset($instance['mailchimp_groups']) ? $instance['mailchimp_groups'] : ''; | |
| 3911 | + | |
| 3912 | + $fieldsArray = [ | |
| 3913 | + 'email_field' => $emailField, | |
| 3914 | + 'first_name_field' => $firstNameField, | |
| 3915 | + 'last_name_field' => $lastNameField, | |
| 3916 | + 'address_field' => $addressField, | |
| 3917 | + 'phone_field' => $phoneField, | |
| 3918 | + 'birthday_field' => $birthdayField, | |
| 3919 | + 'group_id' => $groupId | |
| 3920 | + ]; | |
| 3921 | + | |
| 3922 | + // The three original Pro actions are placeholders in the free build; | |
| 3923 | + // Integrations is a real action, so it is only dropped when Pro is off. | |
| 3924 | + $stripped_actions = ['pro-sb', 'pro-mch', 'pro-wh']; | |
| 3925 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 3926 | + $stripped_actions[] = 'integrations'; | |
| 3927 | + $stripped_actions[] = 'payment'; | |
| 3928 | + } | |
| 3929 | + | |
| 3930 | + $submit_actions = array_filter($instance['submit_actions'], function ($value) use ($stripped_actions) { | |
| 3931 | + return !in_array($value, $stripped_actions, true); | |
| 3932 | + }); | |
| 3933 | + $submit_actions = array_values($submit_actions); | |
| 3934 | + | |
| 3935 | + $this->add_render_attribute( | |
| 3936 | + [ | |
| 3937 | + 'wrapper' => [ | |
| 3938 | + 'class' => [ | |
| 3939 | + 'king-addons-form-fields-wrap', | |
| 3940 | + 'king-addons-labels-' . $instance['label_position'], | |
| 3941 | + ], | |
| 3942 | + ], | |
| 3943 | + 'submit-group' => [ | |
| 3944 | + 'class' => [ | |
| 3945 | + 'king-addons-field-group', | |
| 3946 | + 'king-addons-step-buttons-wrap', | |
| 3947 | + 'king-addons-column', | |
| 3948 | + 'king-addons-form-field-type-submit', | |
| 3949 | + ], | |
| 3950 | + 'data-actions' => [ | |
| 3951 | + json_encode($submit_actions) | |
| 3952 | + ], | |
| 3953 | + 'data-redirect-url' => [ | |
| 3954 | + in_array('redirect', $submit_actions) ? esc_url($instance['redirect_to']) : '' | |
| 3955 | + ], | |
| 3956 | + 'data-partial-entries' => [ | |
| 3957 | + $partial_entries ? '1' : '' | |
| 3958 | + ], | |
| 3959 | + 'data-mailchimp-fields' => [ | |
| 3960 | + json_encode($fieldsArray) | |
| 3961 | + ], | |
| 3962 | + 'data-list-id' => [ | |
| 3963 | + isset($instance['mailchimp_audience']) ? esc_attr($instance['mailchimp_audience']) : '' | |
| 3964 | + ] | |
| 3965 | + ], | |
| 3966 | + 'button' => [ | |
| 3967 | + 'class' => 'king-addons-button', | |
| 3968 | + ], | |
| 3969 | + 'icon-align' => [ | |
| 3970 | + 'class' => [ | |
| 3971 | + empty($instance['button_icon_align']) ? '' : | |
| 3972 | + 'king-addons-align-icon-' . $instance['button_icon_align'], | |
| 3973 | + 'elementor-button-icon', | |
| 3974 | + ], | |
| 3975 | + ], | |
| 3976 | + ] | |
| 3977 | + ); | |
| 3978 | + | |
| 3979 | + if (!empty($instance['form_id'])) { | |
| 3980 | + $this->add_render_attribute('form', 'id', $instance['form_id']); | |
| 3981 | + } | |
| 3982 | + | |
| 3983 | + if (!empty($instance['form_name'])) { | |
| 3984 | + $this->add_render_attribute('form', 'name', $instance['form_name']); | |
| 3985 | + } | |
| 3986 | + | |
| 3987 | + $this->add_render_attribute('form', 'page', get_post()->post_title); | |
| 3988 | + $this->add_render_attribute('form', 'page_id', get_post()->ID); | |
| 3989 | + | |
| 3990 | + if (!empty($instance['button_css_id'])) { | |
| 3991 | + $this->add_render_attribute('button', 'id', $instance['button_css_id']); | |
| 3992 | + } | |
| 3993 | + | |
| 3994 | + $referer_title = trim(wp_title('', false)); | |
| 3995 | + | |
| 3996 | + if (!$referer_title && is_home()) { | |
| 3997 | + $referer_title = get_option('blogname'); | |
| 3998 | + } | |
| 3999 | + | |
| 4000 | + ?> | |
| 4001 | + <form class="king-addons-form" method="post" <?php echo $this->get_render_attribute_string('form'); ?> | |
| 4002 | + novalidate> | |
| 4003 | + <input type="hidden" name="post_id" value="<?php | |
| 4004 | + echo get_the_ID(); | |
| 4005 | + ?>"/> | |
| 4006 | + <input type="hidden" name="form_id" value="<?php echo esc_attr($this->get_id()); ?>"/> | |
| 4007 | + <input type="hidden" name="referer_title" value="<?php echo esc_attr($referer_title); ?>"/> | |
| 4008 | + | |
| 4009 | + <?php if (is_singular()) { | |
| 4010 | + | |
| 4011 | + ?> | |
| 4012 | + <input type="hidden" name="queried_id" value="<?php echo esc_attr(get_the_ID()); ?>"/> | |
| 4013 | + <?php } | |
| 4014 | + | |
| 4015 | + $step_count1 = 0; | |
| 4016 | + $step_exists = ''; | |
| 4017 | + $step_icon = []; | |
| 4018 | + $step_label = []; | |
| 4019 | + $step_sub_label = []; | |
| 4020 | + $whitelist = ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'doc', 'docx', 'ppt', 'pptx', 'odt', 'avi', 'ogg', 'm4a', 'mov', 'mp3', 'mp4', 'mpg', 'wav', 'wmv', 'txt']; | |
| 4021 | + | |
| 4022 | + foreach ($instance['form_fields'] as $key => $value) { | |
| 4023 | + if ('king-addons-fb-step' === $value['field_type']) { | |
| 4024 | + $step_exists = 'exists'; | |
| 4025 | + $step_count1++; | |
| 4026 | + | |
| 4027 | + ob_start(); | |
| 4028 | + Icons_Manager::render_icon($value['step_icon'], ['aria-hidden' => 'true']); | |
| 4029 | + $step_icon[] = ob_get_clean(); | |
| 4030 | + | |
| 4031 | + $step_label[] = '<span class="king-addons-fb-step-main-label">' . esc_html($value['field_label']) . '</span>'; | |
| 4032 | + | |
| 4033 | + $step_sub_label[] = '<span class="king-addons-fb-step-sub-label">' . esc_html($value['field_sub_label']) . '</span>'; | |
| 4034 | + } | |
| 4035 | + } | |
| 4036 | + | |
| 4037 | + | |
| 4038 | + $step_wrap_class = 'yes' !== $instance['show_separator'] ? 'king-addons-fb-step-wrap king-addons-separator-off' : 'king-addons-fb-step-wrap'; | |
| 4039 | + | |
| 4040 | + echo '<div class="' . esc_attr($step_wrap_class) . '">'; | |
| 4041 | + if ('progress_bar' == $instance['step_type']) { | |
| 4042 | + echo '<div class="king-addons-fb-step-progress">'; | |
| 4043 | + echo '<div class="king-addons-fb-step-progress-fill"></div>'; | |
| 4044 | + echo '</div>'; | |
| 4045 | + } else { | |
| 4046 | + $i = 0; | |
| 4047 | + | |
| 4048 | + while ($i < $step_count1) : | |
| 4049 | + | |
| 4050 | + if ('none' == $instance['step_type']) { | |
| 4051 | + $step_html = '<span class="king-addons-fb-step"></span>'; | |
| 4052 | + } else if ('text' == $instance['step_type']) { | |
| 4053 | + $step_html = '<span class="king-addons-fb-step">' . $step_label[$i] . $step_sub_label[$i] . '</span>'; | |
| 4054 | + } else if ('icon' == $instance['step_type']) { | |
| 4055 | + $step_html = '<span class="king-addons-fb-step"><span class="king-addons-fb-step-content">' . $step_icon[$i] . '</span></span>'; | |
| 4056 | + } else if ('number' == $instance['step_type']) { | |
| 4057 | + $step_html = '<span class="king-addons-fb-step"><span class="king-addons-fb-step-content"><span class="king-addons-fb-step-number">' . ($i + 1) . '</span></span></span>'; | |
| 4058 | + } else if ('number_text' == $instance['step_type']) { | |
| 4059 | + $step_html = '<span class="king-addons-fb-step"><span class="king-addons-fb-step-content"><span class="king-addons-fb-step-number">' . ($i + 1) . '</span></span><span class="king-addons-fb-step-label">' . $step_label[$i] . $step_sub_label[$i] . '</span></span>'; | |
| 4060 | + } else if ('icon_text' == $instance['step_type']) { | |
| 4061 | + $step_html = '<span class="king-addons-fb-step"><span class="king-addons-fb-step-content">' . $step_icon[$i] . '</span><span class="king-addons-fb-step-label">' . $step_label[$i] . $step_sub_label[$i] . '</span></span>'; | |
| 4062 | + } | |
| 4063 | + | |
| 4064 | + echo $step_html; | |
| 4065 | + | |
| 4066 | + | |
| 4067 | + if ('yes' == $instance['show_separator']) { | |
| 4068 | + echo '<span class="king-addons-fb-step-sep"></span>'; | |
| 4069 | + } | |
| 4070 | + | |
| 4071 | + $i++; | |
| 4072 | + endwhile; | |
| 4073 | + } | |
| 4074 | + echo '</div>'; | |
| 4075 | + ?> | |
| 4076 | + | |
| 4077 | + <div <?php echo $this->get_render_attribute_string('wrapper'); ?>> | |
| 4078 | + <?php | |
| 4079 | + | |
| 4080 | + $step_count = 0; | |
| 4081 | + $field_count = 0; | |
| 4082 | + | |
| 4083 | + foreach ($instance['form_fields'] as $item_index => $item) : | |
| 4084 | + if ('king-addons-fb-step' !== $item['field_type']) { | |
| 4085 | + $field_count++; | |
| 4086 | + if (!king_addons_freemius()->can_use_premium_code__premium_only() && 3 < $field_count) { | |
| 4087 | + continue; | |
| 4088 | + } | |
| 4089 | + } | |
| 4090 | + | |
| 4091 | + $this->form_fields_render_attributes($item_index, $instance, $item); | |
| 4092 | + | |
| 4093 | + $print_label = !in_array($item['field_type'], ['hidden', 'html', 'king-addons-fb-step'], true); | |
| 4094 | + | |
| 4095 | + if ('king-addons-fb-step' === $item['field_type']) { | |
| 4096 | + if (0 === $step_count) { | |
| 4097 | + echo '<div class="king-addons-fb-step-tab king-addons-fb-step-tab-hidden">'; | |
| 4098 | + } else { | |
| 4099 | + echo '<div class="king-addons-step-buttons-wrap">'; | |
| 4100 | + echo '<button type="button" class="king-addons-fb-step-prev">' . esc_html((string) $this->last_prev_btn_text) . '</button>'; | |
| 4101 | + echo '<button type="button" class="king-addons-fb-step-next">' . esc_html((string) $this->last_next_btn_text) . '</button>'; | |
| 4102 | + echo '</div>'; | |
| 4103 | + echo '</div>'; | |
| 4104 | + echo '<div class="king-addons-fb-step-tab king-addons-fb-step-tab-hidden">'; | |
| 4105 | + } | |
| 4106 | + $this->last_next_btn_text = (isset($item['next_button_text']) && '' !== $item['next_button_text']) | |
| 4107 | + ? $item['next_button_text'] | |
| 4108 | + : esc_html__('Next', 'king-addons'); | |
| 4109 | + $this->last_prev_btn_text = (isset($item['previous_button_text']) && '' !== $item['previous_button_text']) | |
| 4110 | + ? $item['previous_button_text'] | |
| 4111 | + : esc_html__('Previous', 'king-addons'); | |
| 4112 | + $step_count++; | |
| 4113 | + } | |
| 4114 | + | |
| 4115 | + ?> | |
| 4116 | + <div <?php $this->print_render_attribute_string('field-group' . $item_index); ?>> | |
| 4117 | + <?php | |
| 4118 | + if ($print_label && $item['field_label']) { | |
| 4119 | + ?> | |
| 4120 | + <label <?php echo $this->get_render_attribute_string('label' . $item_index); ?>> | |
| 4121 | + <?php | |
| 4122 | + echo esc_html($item['field_label']); ?> | |
| 4123 | + </label> | |
| 4124 | + <?php | |
| 4125 | + } | |
| 4126 | + | |
| 4127 | + switch ($item['field_type']) : | |
| 4128 | + case 'html': | |
| 4129 | + echo wp_kses_post(do_shortcode($item['field_html'])); | |
| 4130 | + break; | |
| 4131 | + case 'textarea': | |
| 4132 | + | |
| 4133 | + echo $this->make_textarea_field($item, $item_index); | |
| 4134 | + break; | |
| 4135 | + | |
| 4136 | + case 'select': | |
| 4137 | + | |
| 4138 | + echo $this->make_select_field($item, $item_index); | |
| 4139 | + break; | |
| 4140 | + | |
| 4141 | + case 'radio': | |
| 4142 | + case 'checkbox': | |
| 4143 | + | |
| 4144 | + echo $this->make_radio_checkbox_field($item, $item_index, $item['field_type']); | |
| 4145 | + break; | |
| 4146 | + case 'recaptcha-v3': | |
| 4147 | + $recaptcha_v3_site_key = (string) get_option('king_addons_recaptcha_v3_site_key', ''); | |
| 4148 | + if ('' === $recaptcha_v3_site_key) { | |
| 4149 | + if (current_user_can('manage_options')) { | |
| 4150 | + echo '<p class="king-addons-form-captcha-notice">' . sprintf( | |
| 4151 | + /* translators: 1: provider name, 2: settings URL. */ | |
| 4152 | + esc_html__('%1$s is selected but its keys are missing. Add them under %2$s.', 'king-addons'), | |
| 4153 | + esc_html__('reCAPTCHA v3', 'king-addons'), | |
| 4154 | + '<a href="' . esc_url(admin_url('admin.php?page=king-addons-settings')) . '">' | |
| 4155 | + . esc_html__('King Addons settings', 'king-addons') . '</a>' | |
| 4156 | + ) . '</p>'; | |
| 4157 | + } | |
| 4158 | + } else { | |
| 4159 | + echo '<input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response" data-site-key="' . esc_attr($recaptcha_v3_site_key) . '" />'; | |
| 4160 | + } | |
| 4161 | + break; | |
| 4162 | + case 'text': | |
| 4163 | + case 'email': | |
| 4164 | + case 'url': | |
| 4165 | + case 'tel': | |
| 4166 | + case 'password': | |
| 4167 | + case 'hidden': | |
| 4168 | + case 'search': | |
| 4169 | + case 'number': | |
| 4170 | + case 'date': | |
| 4171 | + case 'time': | |
| 4172 | + $this->add_render_attribute('input' . $item_index, 'class', 'king-addons-form-field-textual'); | |
| 4173 | + echo '<input size="1 "' . $this->get_render_attribute_string('input' . $item_index) . '>'; | |
| 4174 | + break; | |
| 4175 | + case 'upload': | |
| 4176 | + if ('yes' === $item['allow_multiple_upload']) { | |
| 4177 | + $this->add_render_attribute('input' . $item_index, 'multiple', 'multiple'); | |
| 4178 | + } | |
| 4179 | + | |
| 4180 | + if (!empty($item['file_size'])) { | |
| 4181 | + $this->add_render_attribute( | |
| 4182 | + 'input' . $item_index, | |
| 4183 | + [ | |
| 4184 | + 'data-maxfs' => $item['file_size'], | |
| 4185 | + 'data-maxfs-notice' => esc_html__('File size is more than allowed.', 'king-addons'), | |
| 4186 | + ] | |
| 4187 | + ); | |
| 4188 | + } | |
| 4189 | + | |
| 4190 | + if (!empty($item['file_types'])) { | |
| 4191 | + | |
| 4192 | + | |
| 4193 | + $file_types = explode(',', $item['file_types']); | |
| 4194 | + | |
| 4195 | + | |
| 4196 | + $non_whitelisted = array_diff($file_types, $whitelist); | |
| 4197 | + | |
| 4198 | + if (!empty($non_whitelisted)) { | |
| 4199 | + $item['file_types'] = 'jpg,jpeg,png,gif,pdf,doc,docx,ppt,pptx,odt,avi,ogg,m4a,mov,mp3,mp4,mpg,wav,wmv,txt'; | |
| 4200 | + if (is_admin()) { | |
| 4201 | + echo '<p class="king-addons-file-type-error">' . esc_html__('Please remove unsupported file type(s):', 'king-addons') . '</p>'; | |
| 4202 | + echo '<ul class="king-addons-file-type-error-list">'; | |
| 4203 | + foreach ($non_whitelisted as $type) { | |
| 4204 | + if (!empty($type)) { | |
| 4205 | + echo '<li>' . esc_html($type) . '</li>'; | |
| 4206 | + } | |
| 4207 | + } | |
| 4208 | + echo '</ul>'; | |
| 4209 | + } | |
| 4210 | + } | |
| 4211 | + | |
| 4212 | + $this->add_render_attribute( | |
| 4213 | + 'input' . $item_index, | |
| 4214 | + [ | |
| 4215 | + 'data-allft' => $item['file_types'] | |
| 4216 | + ] | |
| 4217 | + ); | |
| 4218 | + } | |
| 4219 | + | |
| 4220 | + echo '<input size="1 "' . $this->get_render_attribute_string('input' . $item_index) . '>'; | |
| 4221 | + break; | |
| 4222 | + case 'range': | |
| 4223 | + $this->add_render_attribute('input' . $item_index, [ | |
| 4224 | + 'class' => 'king-addons-form-field-range', | |
| 4225 | + 'min' => isset($item['range_min']) && '' !== $item['range_min'] ? (string) (float) $item['range_min'] : '0', | |
| 4226 | + 'max' => isset($item['range_max']) && '' !== $item['range_max'] ? (string) (float) $item['range_max'] : '100', | |
| 4227 | + 'step' => isset($item['range_step']) && '' !== $item['range_step'] && (float) $item['range_step'] > 0 ? (string) (float) $item['range_step'] : '1', | |
| 4228 | + ]); | |
| 4229 | + echo '<div class="king-addons-form-range">'; | |
| 4230 | + echo '<input ' . $this->get_render_attribute_string('input' . $item_index) . '>'; | |
| 4231 | + if ('yes' === ($item['range_show_value'] ?? 'yes')) { | |
| 4232 | + echo '<output class="king-addons-form-range__value"></output>'; | |
| 4233 | + } | |
| 4234 | + echo '</div>'; | |
| 4235 | + break; | |
| 4236 | + case 'rating': | |
| 4237 | + case 'signature': | |
| 4238 | + case 'acceptance': | |
| 4239 | + case 'calculation': | |
| 4240 | + if (class_exists('King_Addons\\Form_Extra_Fields')) { | |
| 4241 | + echo Form_Extra_Fields::render( | |
| 4242 | + $item, | |
| 4243 | + $this->get_attribute_name($item), | |
| 4244 | + $this->get_attribute_id($item) | |
| 4245 | + ); | |
| 4246 | + } | |
| 4247 | + break; | |
| 4248 | + case 'king-addons-fb-step': | |
| 4249 | + echo '<input type="hidden" class="king-addons-fb-step-input" id="form-field-' . esc_attr(self::resolve_field_key($item)) . '" value="' . esc_attr($item['field_label']) . '">'; | |
| 4250 | + break; | |
| 4251 | + default: | |
| 4252 | + $field_type = $item['field_type']; | |
| 4253 | + endswitch; | |
| 4254 | + ?> | |
| 4255 | + </div> | |
| 4256 | + <?php | |
| 4257 | + endforeach; | |
| 4258 | + | |
| 4259 | + if ('none' !== $spam_mode && class_exists('King_Addons\\Form_Spam_Protection')) { | |
| 4260 | + echo Form_Spam_Protection::render($spam_mode); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 4261 | + } | |
| 4262 | + | |
| 4263 | + echo '<div ' . $this->get_render_attribute_string('submit-group') . '>'; | |
| 4264 | + if ('exists' === $step_exists) { | |
| 4265 | + if (2 <= $step_count) { | |
| 4266 | + echo '<button type="button" class="king-addons-fb-step-prev">' . esc_html((string) $this->last_prev_btn_text) . '</button>'; | |
| 4267 | + } | |
| 4268 | + | |
| 4269 | + $this->render_submit_button($instance); | |
| 4270 | + | |
| 4271 | + echo '</div>'; | |
| 4272 | + } else { | |
| 4273 | + | |
| 4274 | + $this->render_submit_button($instance); | |
| 4275 | + | |
| 4276 | + } | |
| 4277 | + echo '</div>'; ?> | |
| 4278 | + | |
| 4279 | + </div> | |
| 4280 | + </form> | |
| 4281 | + <?php | |
| 4282 | + } | |
| 4283 | +} | |