| 1 |
<?php |
| 2 |
/** |
| 3 |
* Opt-in |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
namespace WPFunnels\Widgets\Elementor; |
| 8 |
|
| 9 |
use Elementor\Controls_Manager; |
| 10 |
use Elementor\Widget_Base; |
| 11 |
use Elementor\Group_Control_Border; |
| 12 |
use Elementor\Group_Control_Box_Shadow; |
| 13 |
use Elementor\Group_Control_Typography; |
| 14 |
use Elementor\Icons_Manager; |
| 15 |
use WPFunnels\Widgets\Wpfnl_Widgets_Manager; |
| 16 |
use WPFunnels\Wpfnl; |
| 17 |
use WPFunnels\Wpfnl_functions; |
| 18 |
|
| 19 |
if (! defined('ABSPATH')) { |
| 20 |
exit; |
| 21 |
} // Exit if accessed directly |
| 22 |
|
| 23 |
/** |
| 24 |
* Optin form widget |
| 25 |
* |
| 26 |
* @since 1.0.0 |
| 27 |
*/ |
| 28 |
class OptinForm extends Widget_Base { |
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
* Register the widget controls. |
| 33 |
* |
| 34 |
* Adds different input fields to allow the user to change and Wpvrize the widget settings. |
| 35 |
* |
| 36 |
* @since 1.0.0 |
| 37 |
* |
| 38 |
* @access protected |
| 39 |
*/ |
| 40 |
protected function init_controls() { |
| 41 |
if ( version_compare(ELEMENTOR_VERSION, '3.1.0', '>=') ) { |
| 42 |
$this->register_controls(); |
| 43 |
} else { |
| 44 |
$this->_register_controls(); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
/** |
| 51 |
* Retrieve the widget name. |
| 52 |
* |
| 53 |
* @since 1.0.0 |
| 54 |
* |
| 55 |
* @access public |
| 56 |
* |
| 57 |
* @return string Widget name. |
| 58 |
*/ |
| 59 |
public function get_name() |
| 60 |
{ |
| 61 |
return 'wpfnl-optin-form'; |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
/** |
| 66 |
* Retrieve the widget title. |
| 67 |
* |
| 68 |
* @since 1.0.0 |
| 69 |
* |
| 70 |
* @access public |
| 71 |
* |
| 72 |
* @return string Widget title. |
| 73 |
*/ |
| 74 |
public function get_title() |
| 75 |
{ |
| 76 |
return __('Optin Form', 'wpfnl'); |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
/** |
| 81 |
* Retrieve the widget icon. |
| 82 |
* |
| 83 |
* @since 1.0.0 |
| 84 |
* |
| 85 |
* @access public |
| 86 |
* |
| 87 |
* @return string Widget icon. |
| 88 |
*/ |
| 89 |
public function get_icon() |
| 90 |
{ |
| 91 |
return 'eicon-form-horizontal'; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
/** |
| 96 |
* Retrieve the list of categories the widget belongs to. |
| 97 |
* |
| 98 |
* Used to determine where to display the widget in the editor. |
| 99 |
* |
| 100 |
* Note that currently Elementor supports only one category. |
| 101 |
* When multiple categories passed, Elementor uses the first one. |
| 102 |
* |
| 103 |
* @since 1.0.0 |
| 104 |
* |
| 105 |
* @access public |
| 106 |
* |
| 107 |
* @return array Widget categories. |
| 108 |
*/ |
| 109 |
public function get_categories() |
| 110 |
{ |
| 111 |
return [ 'wp-funnel' ]; |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
/** |
| 116 |
* Retrieve the list of scripts the widget depended on. |
| 117 |
* |
| 118 |
* Used to set scripts dependencies required to run the widget. |
| 119 |
* |
| 120 |
* @since 1.0.0 |
| 121 |
* |
| 122 |
* @access public |
| 123 |
* |
| 124 |
* @return array Widget scripts dependencies. |
| 125 |
*/ |
| 126 |
public function get_script_depends() |
| 127 |
{ |
| 128 |
return [ 'optin-form' ]; |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
/** |
| 133 |
* Get button sizes. |
| 134 |
* |
| 135 |
* Retrieve an array of button sizes. |
| 136 |
* |
| 137 |
* @return array An array containing button sizes. |
| 138 |
* |
| 139 |
* @since 1.0.0 |
| 140 |
* |
| 141 |
* @access public |
| 142 |
*/ |
| 143 |
public function get_button_sizes() |
| 144 |
{ |
| 145 |
return [ |
| 146 |
'xs' => __('Extra Small', 'wpfnl'), |
| 147 |
'sm' => __('Small', 'wpfnl'), |
| 148 |
'md' => __('Medium', 'wpfnl'), |
| 149 |
'lg' => __('Large', 'wpfnl'), |
| 150 |
'xl' => __('Extra Large', 'wpfnl'), |
| 151 |
]; |
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
/** |
| 156 |
* Register the widget controls. |
| 157 |
* |
| 158 |
* @since 1.0.0 |
| 159 |
* |
| 160 |
* @access protected |
| 161 |
*/ |
| 162 |
protected function register_controls() |
| 163 |
{ |
| 164 |
$this->register_form_source_controls(); |
| 165 |
$this->register_form_layout_controls(); |
| 166 |
$this->register_form_field_controls(); |
| 167 |
$this->register_form_button_controls(); |
| 168 |
$this->register_clickto_expand_button_controls(); |
| 169 |
|
| 170 |
|
| 171 |
$this->register_action_after_submit_controls(); |
| 172 |
|
| 173 |
|
| 174 |
//-------style tab-------- |
| 175 |
$this->register_form_style_controls(); |
| 176 |
$this->register_input_fields_style_controls(); |
| 177 |
$this->register_button_style_controls(); |
| 178 |
$this->register_clickto_expand_style_controls(); |
| 179 |
|
| 180 |
} |
| 181 |
|
| 182 |
|
| 183 |
/** |
| 184 |
* Register the widget controls. |
| 185 |
* |
| 186 |
* @since 1.0.0 |
| 187 |
* |
| 188 |
* @access protected |
| 189 |
*/ |
| 190 |
protected function _register_controls() |
| 191 |
{ |
| 192 |
$this->register_form_source_controls(); |
| 193 |
$this->register_form_layout_controls(); |
| 194 |
$this->register_form_field_controls(); |
| 195 |
$this->register_form_button_controls(); |
| 196 |
$this->register_clickto_expand_button_controls(); |
| 197 |
|
| 198 |
$this->register_action_after_submit_controls(); |
| 199 |
|
| 200 |
|
| 201 |
//-------style tab-------- |
| 202 |
$this->register_form_style_controls(); |
| 203 |
$this->register_input_fields_style_controls(); |
| 204 |
$this->register_button_style_controls(); |
| 205 |
$this->register_clickto_expand_style_controls(); |
| 206 |
|
| 207 |
} |
| 208 |
|
| 209 |
/** |
| 210 |
* Registers form source controls in Elementor. |
| 211 |
* This function sets up controls for selecting the source of an opt-in form. |
| 212 |
* |
| 213 |
* @since 2.8.15 |
| 214 |
*/ |
| 215 |
protected function register_form_source_controls() { |
| 216 |
$this->start_controls_section( |
| 217 |
'wpfnl_optin_form_source_controls', array( |
| 218 |
'label' => __( 'Opt-in Form Source', 'wpfnl' ), |
| 219 |
) |
| 220 |
); |
| 221 |
|
| 222 |
$this->add_control( |
| 223 |
'optin_form_source', |
| 224 |
[ |
| 225 |
'label' => __( 'Form Source', 'wpfnl' ), |
| 226 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 227 |
'default' => 'wpfnl_forms', |
| 228 |
'options' => [ |
| 229 |
'wpfnl_forms' => __( 'WPFunnels', 'wpfnl' ), |
| 230 |
'mailmint_forms' => __( 'Mail Mint', 'wpfnl' ), |
| 231 |
], |
| 232 |
] |
| 233 |
); |
| 234 |
|
| 235 |
$mailmint_forms = Wpfnl_Widgets_Manager::get_mailmint_forms(); |
| 236 |
|
| 237 |
$this->add_control( |
| 238 |
'mailmint_form_id', |
| 239 |
[ |
| 240 |
'label' => __( 'Choose form', 'wpfnl' ), |
| 241 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 242 |
'default' => array_key_first( $mailmint_forms ), |
| 243 |
'options' => $mailmint_forms, |
| 244 |
'condition' => [ 'optin_form_source' => 'mailmint_forms' ] |
| 245 |
] |
| 246 |
); |
| 247 |
|
| 248 |
if( \WPFunnels\Integrations\Helper::maybe_enabled() ){ |
| 249 |
$this->add_control( |
| 250 |
'enable_mm_contact', |
| 251 |
[ |
| 252 |
'label' => __('Collect Leads In Mail Mint', 'wpfnl'), |
| 253 |
'type' => Controls_Manager::SWITCHER, |
| 254 |
'label_on' => __( 'Yes', 'wpfnl' ), |
| 255 |
'label_off' => __( 'No', 'wpfnl' ), |
| 256 |
'return_value' => 'yes', |
| 257 |
'default' => '', |
| 258 |
'condition' => [ |
| 259 |
'optin_form_source' => 'wpfnl_forms' |
| 260 |
] |
| 261 |
] |
| 262 |
); |
| 263 |
|
| 264 |
$this->add_control( |
| 265 |
'mm_contact_status', |
| 266 |
[ |
| 267 |
'label' => __( 'Contact Status', 'wpfnl' ), |
| 268 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 269 |
'default' => 'subscribed', |
| 270 |
'options' =>[ |
| 271 |
'pending' => __('Pending', 'wpfnl'), |
| 272 |
'subscribed' => __('Subscribed', 'wpfnl'), |
| 273 |
'unsubscribed' => __('Unsubscribed', 'wpfnl'), |
| 274 |
], |
| 275 |
'condition' => [ |
| 276 |
'enable_mm_contact' => 'yes', |
| 277 |
] |
| 278 |
] |
| 279 |
); |
| 280 |
|
| 281 |
$this->add_control( |
| 282 |
'mm_lists', |
| 283 |
[ |
| 284 |
'label' => __( 'Select List', 'wpfnl' ), |
| 285 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 286 |
'default' => '', |
| 287 |
'options' => \WPFunnels\Integrations\Helper::get_lists(), |
| 288 |
|
| 289 |
'condition' => [ |
| 290 |
'enable_mm_contact' => 'yes', |
| 291 |
] |
| 292 |
] |
| 293 |
); |
| 294 |
|
| 295 |
$this->add_control( |
| 296 |
'mm_tags', |
| 297 |
[ |
| 298 |
'label' => __( 'Select Tag', 'wpfnl' ), |
| 299 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 300 |
'default' => '', |
| 301 |
'options' => \WPFunnels\Integrations\Helper::get_tags(), |
| 302 |
|
| 303 |
'condition' => [ |
| 304 |
'enable_mm_contact' => 'yes', |
| 305 |
] |
| 306 |
] |
| 307 |
); |
| 308 |
}else{ |
| 309 |
$this->add_control( |
| 310 |
'mailmaint_install', |
| 311 |
array( |
| 312 |
'type' => Controls_Manager::RAW_HTML, |
| 313 |
'raw' => sprintf( __( 'Manage your leads easily using Mail Mint. <a href="https://wordpress.org/plugins/mail-mint/" target="_blank" rel="noopener">Try it now</a>.', 'wpfnl' )), |
| 314 |
'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', |
| 315 |
'condition' => [ 'optin_form_source' => 'wpfnl_forms' ] |
| 316 |
) |
| 317 |
); |
| 318 |
} |
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
$this->end_controls_section(); |
| 323 |
} |
| 324 |
|
| 325 |
/** |
| 326 |
* Register Form Layout Controls. |
| 327 |
* |
| 328 |
* @since 1.0.0 |
| 329 |
* @access protected |
| 330 |
*/ |
| 331 |
protected function register_form_layout_controls(){ |
| 332 |
$this->start_controls_section( |
| 333 |
'wpfnl_optin_form_layout_controls', array( |
| 334 |
'label' => __('Form Layout', 'wpfnl'), |
| 335 |
'condition' => [ |
| 336 |
'optin_form_source' => 'wpfnl_forms' |
| 337 |
] |
| 338 |
) |
| 339 |
); |
| 340 |
|
| 341 |
$this->add_control( |
| 342 |
'optin_form_type', |
| 343 |
[ |
| 344 |
'label' => __( 'Opt-in Form Type', 'wpfnl' ), |
| 345 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 346 |
'default' => 'general-optin', |
| 347 |
'options' => [ |
| 348 |
'general-optin' => __( 'General Opt-in', 'wpfnl' ), |
| 349 |
'clickto-expand-optin' => __('Click To Expand', 'wpfnl'), |
| 350 |
], |
| 351 |
] |
| 352 |
); |
| 353 |
|
| 354 |
$this->add_control( |
| 355 |
'optin_form_layout', |
| 356 |
[ |
| 357 |
'label' => __( 'Form Style', 'wpfnl' ), |
| 358 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 359 |
'default' => '', |
| 360 |
'options' => [ |
| 361 |
'' => __( 'Default Style', 'wpfnl' ), |
| 362 |
'form-style1' => __('Form Style-1', 'wpfnl'), |
| 363 |
'form-style2' => __('Form Style-2', 'wpfnl'), |
| 364 |
'form-style3' => __('Form Style-3', 'wpfnl'), |
| 365 |
'form-style4' => __('Form Style-4', 'wpfnl'), |
| 366 |
], |
| 367 |
] |
| 368 |
); |
| 369 |
|
| 370 |
|
| 371 |
$this->end_controls_section(); |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
/** |
| 376 |
* Register Form Controls. |
| 377 |
* |
| 378 |
* @since 1.0.0 |
| 379 |
* @access protected |
| 380 |
*/ |
| 381 |
protected function register_form_field_controls(){ |
| 382 |
$this->start_controls_section( |
| 383 |
'wpfnl_optin_form_field_controls', array( |
| 384 |
'label' => __('Form Fields', 'wpfnl'), |
| 385 |
'condition' => [ |
| 386 |
'optin_form_source' => 'wpfnl_forms' |
| 387 |
] |
| 388 |
) |
| 389 |
); |
| 390 |
|
| 391 |
//------Email------ |
| 392 |
$this->add_control( |
| 393 |
'email_label', |
| 394 |
[ |
| 395 |
'label' => __('Email Label', 'wpfnl'), |
| 396 |
'type' => Controls_Manager::TEXT, |
| 397 |
'default' => __( 'Email', 'wpfnl' ), |
| 398 |
'label_block' => true, |
| 399 |
'condition' => [ |
| 400 |
'field_label' => 'yes', |
| 401 |
], |
| 402 |
] |
| 403 |
); |
| 404 |
|
| 405 |
$this->add_control( |
| 406 |
'email_placeholder', |
| 407 |
[ |
| 408 |
'label' => __('Email Placeholder Text', 'wpfnl'), |
| 409 |
'type' => Controls_Manager::TEXT, |
| 410 |
'default' => __( 'Email', 'wpfnl' ), |
| 411 |
'label_block' => true, |
| 412 |
'separator' => 'after' |
| 413 |
] |
| 414 |
); |
| 415 |
|
| 416 |
//----first name---- |
| 417 |
$this->add_control( |
| 418 |
'first_name', |
| 419 |
[ |
| 420 |
'label' => __('First Name', 'wpfnl'), |
| 421 |
'type' => Controls_Manager::SWITCHER, |
| 422 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 423 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 424 |
'return_value' => 'yes', |
| 425 |
'default' => '', |
| 426 |
] |
| 427 |
); |
| 428 |
$this->add_control( |
| 429 |
'first_name_label', |
| 430 |
[ |
| 431 |
'label' => __('First Name Label', 'wpfnl'), |
| 432 |
'type' => Controls_Manager::TEXT, |
| 433 |
'default' => __( 'First Name', 'wpfnl' ), |
| 434 |
'label_block' => true, |
| 435 |
'condition' => [ |
| 436 |
'first_name' => 'yes', |
| 437 |
'field_label' => 'yes', |
| 438 |
], |
| 439 |
] |
| 440 |
); |
| 441 |
$this->add_control( |
| 442 |
'first_name_placeholder', |
| 443 |
[ |
| 444 |
'label' => __('First Name Placeholder Text', 'wpfnl'), |
| 445 |
'type' => Controls_Manager::TEXT, |
| 446 |
'default' => __( 'First Name', 'wpfnl' ), |
| 447 |
'label_block' => true, |
| 448 |
'condition' => [ |
| 449 |
'first_name' => 'yes', |
| 450 |
], |
| 451 |
] |
| 452 |
); |
| 453 |
$this->add_control( |
| 454 |
'is_required_name', |
| 455 |
[ |
| 456 |
'label' => __('Mark First Name As Required', 'wpfnl'), |
| 457 |
'type' => Controls_Manager::SWITCHER, |
| 458 |
'label_on' => __( 'Yes', 'wpfnl' ), |
| 459 |
'label_off' => __( 'No', 'wpfnl' ), |
| 460 |
'return_value' => 'yes', |
| 461 |
'default' => '', |
| 462 |
'condition' => [ |
| 463 |
'first_name' => 'yes', |
| 464 |
], |
| 465 |
'separator' => 'after' |
| 466 |
] |
| 467 |
); |
| 468 |
|
| 469 |
|
| 470 |
//---last name--- |
| 471 |
$this->add_control( |
| 472 |
'last_name', |
| 473 |
[ |
| 474 |
'label' => __('Last Name', 'wpfnl'), |
| 475 |
'type' => Controls_Manager::SWITCHER, |
| 476 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 477 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 478 |
'return_value' => 'yes', |
| 479 |
'default' => '', |
| 480 |
] |
| 481 |
); |
| 482 |
$this->add_control( |
| 483 |
'last_name_label', |
| 484 |
[ |
| 485 |
'label' => __('Last Name Label', 'wpfnl'), |
| 486 |
'type' => Controls_Manager::TEXT, |
| 487 |
'default' => __( 'Last Name', 'wpfnl' ), |
| 488 |
'label_block' => true, |
| 489 |
'condition' => [ |
| 490 |
'last_name' => 'yes', |
| 491 |
'field_label' => 'yes', |
| 492 |
], |
| 493 |
] |
| 494 |
); |
| 495 |
$this->add_control( |
| 496 |
'last_name_placeholder', |
| 497 |
[ |
| 498 |
'label' => __('Last Name Placeholder Text', 'wpfnl'), |
| 499 |
'type' => Controls_Manager::TEXT, |
| 500 |
'default' => __( 'Last Name', 'wpfnl' ), |
| 501 |
'label_block' => true, |
| 502 |
'condition' => [ |
| 503 |
'last_name' => 'yes', |
| 504 |
], |
| 505 |
] |
| 506 |
); |
| 507 |
$this->add_control( |
| 508 |
'is_required_last_name', |
| 509 |
[ |
| 510 |
'label' => __('Mark Last Name As Required', 'wpfnl'), |
| 511 |
'type' => Controls_Manager::SWITCHER, |
| 512 |
'label_on' => __( 'Yes', 'wpfnl' ), |
| 513 |
'label_off' => __( 'No', 'wpfnl' ), |
| 514 |
'return_value' => 'yes', |
| 515 |
'default' => '', |
| 516 |
'condition' => [ |
| 517 |
'last_name' => 'yes', |
| 518 |
], |
| 519 |
'separator' => 'after' |
| 520 |
] |
| 521 |
); |
| 522 |
|
| 523 |
|
| 524 |
//------phone------ |
| 525 |
$this->add_control( |
| 526 |
'phone', |
| 527 |
[ |
| 528 |
'label' => __('Phone', 'wpfnl'), |
| 529 |
'type' => Controls_Manager::SWITCHER, |
| 530 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 531 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 532 |
'return_value' => 'yes', |
| 533 |
'default' => '', |
| 534 |
] |
| 535 |
); |
| 536 |
$this->add_control( |
| 537 |
'phone_label', |
| 538 |
[ |
| 539 |
'label' => __('Phone Label', 'wpfnl'), |
| 540 |
'type' => Controls_Manager::TEXT, |
| 541 |
'default' => __( 'Phone', 'wpfnl' ), |
| 542 |
'label_block' => true, |
| 543 |
'condition' => [ |
| 544 |
'phone' => 'yes', |
| 545 |
'field_label' => 'yes', |
| 546 |
], |
| 547 |
] |
| 548 |
); |
| 549 |
$this->add_control( |
| 550 |
'phone_placeholder', |
| 551 |
[ |
| 552 |
'label' => __('Phone Placeholder Text', 'wpfnl'), |
| 553 |
'type' => Controls_Manager::TEXT, |
| 554 |
'default' => __( 'Phone', 'wpfnl' ), |
| 555 |
'label_block' => true, |
| 556 |
'condition' => [ |
| 557 |
'phone' => 'yes', |
| 558 |
], |
| 559 |
] |
| 560 |
); |
| 561 |
$this->add_control( |
| 562 |
'is_required_phone', |
| 563 |
[ |
| 564 |
'label' => __('Mark Phone As Required', 'wpfnl'), |
| 565 |
'type' => Controls_Manager::SWITCHER, |
| 566 |
'label_on' => __( 'Yes', 'wpfnl' ), |
| 567 |
'label_off' => __( 'No', 'wpfnl' ), |
| 568 |
'return_value' => 'yes', |
| 569 |
'default' => '', |
| 570 |
'condition' => [ |
| 571 |
'phone' => 'yes', |
| 572 |
], |
| 573 |
'separator' => 'after' |
| 574 |
] |
| 575 |
); |
| 576 |
|
| 577 |
|
| 578 |
//----website url---- |
| 579 |
$this->add_control( |
| 580 |
'website_url', |
| 581 |
[ |
| 582 |
'label' => __('Website Url', 'wpfnl'), |
| 583 |
'type' => Controls_Manager::SWITCHER, |
| 584 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 585 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 586 |
'return_value' => 'yes', |
| 587 |
'default' => '', |
| 588 |
] |
| 589 |
); |
| 590 |
$this->add_control( |
| 591 |
'website_url_label', |
| 592 |
[ |
| 593 |
'label' => __('Website Url Label', 'wpfnl'), |
| 594 |
'type' => Controls_Manager::TEXT, |
| 595 |
'default' => __( 'Website Url', 'wpfnl' ), |
| 596 |
'label_block' => true, |
| 597 |
'condition' => [ |
| 598 |
'website_url' => 'yes', |
| 599 |
'field_label' => 'yes', |
| 600 |
], |
| 601 |
] |
| 602 |
); |
| 603 |
$this->add_control( |
| 604 |
'website_url_placeholder', |
| 605 |
[ |
| 606 |
'label' => __('Website Url Placeholder Text', 'wpfnl'), |
| 607 |
'type' => Controls_Manager::TEXT, |
| 608 |
'default' => __( 'Website Url', 'wpfnl' ), |
| 609 |
'label_block' => true, |
| 610 |
'condition' => [ |
| 611 |
'website_url' => 'yes', |
| 612 |
], |
| 613 |
] |
| 614 |
); |
| 615 |
$this->add_control( |
| 616 |
'is_required_website_url', |
| 617 |
[ |
| 618 |
'label' => __('Mark Website Url As Required', 'wpfnl'), |
| 619 |
'type' => Controls_Manager::SWITCHER, |
| 620 |
'label_on' => __( 'Yes', 'wpfnl' ), |
| 621 |
'label_off' => __( 'No', 'wpfnl' ), |
| 622 |
'return_value' => 'yes', |
| 623 |
'default' => '', |
| 624 |
'condition' => [ |
| 625 |
'website_url' => 'yes', |
| 626 |
], |
| 627 |
'separator' => 'after' |
| 628 |
] |
| 629 |
); |
| 630 |
|
| 631 |
|
| 632 |
//-----message------ |
| 633 |
$this->add_control( |
| 634 |
'message', |
| 635 |
[ |
| 636 |
'label' => __('Message', 'wpfnl'), |
| 637 |
'type' => Controls_Manager::SWITCHER, |
| 638 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 639 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 640 |
'return_value' => 'yes', |
| 641 |
'default' => '', |
| 642 |
] |
| 643 |
); |
| 644 |
$this->add_control( |
| 645 |
'message_label', |
| 646 |
[ |
| 647 |
'label' => __('Message Label', 'wpfnl'), |
| 648 |
'type' => Controls_Manager::TEXT, |
| 649 |
'default' => __( 'Message', 'wpfnl' ), |
| 650 |
'label_block' => true, |
| 651 |
'condition' => [ |
| 652 |
'message' => 'yes', |
| 653 |
'field_label' => 'yes', |
| 654 |
], |
| 655 |
] |
| 656 |
); |
| 657 |
$this->add_control( |
| 658 |
'message_placeholder', |
| 659 |
[ |
| 660 |
'label' => __('Message Placeholder Text', 'wpfnl'), |
| 661 |
'type' => Controls_Manager::TEXT, |
| 662 |
'default' => __( 'Write your message here...', 'wpfnl' ), |
| 663 |
'label_block' => true, |
| 664 |
'condition' => [ |
| 665 |
'message' => 'yes', |
| 666 |
], |
| 667 |
] |
| 668 |
); |
| 669 |
$this->add_control( |
| 670 |
'is_required_message', |
| 671 |
[ |
| 672 |
'label' => __('Mark Message As Required', 'wpfnl'), |
| 673 |
'type' => Controls_Manager::SWITCHER, |
| 674 |
'label_on' => __( 'Yes', 'wpfnl' ), |
| 675 |
'label_off' => __( 'No', 'wpfnl' ), |
| 676 |
'return_value' => 'yes', |
| 677 |
'default' => '', |
| 678 |
'condition' => [ |
| 679 |
'message' => 'yes', |
| 680 |
], |
| 681 |
'separator' => 'after' |
| 682 |
] |
| 683 |
); |
| 684 |
|
| 685 |
|
| 686 |
//-----acceptance checkbox----- |
| 687 |
$this->add_control( |
| 688 |
'acceptance_checkbox', |
| 689 |
[ |
| 690 |
'label' => __('Acceptance Checkbox', 'wpfnl'), |
| 691 |
'type' => Controls_Manager::SWITCHER, |
| 692 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 693 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 694 |
'return_value' => 'yes', |
| 695 |
'default' => '', |
| 696 |
] |
| 697 |
); |
| 698 |
$this->add_control( |
| 699 |
'acceptance_checkbox_text', |
| 700 |
[ |
| 701 |
'label' => __('Acceptance Text', 'wpfnl'), |
| 702 |
'type' => \Elementor\Controls_Manager::WYSIWYG, |
| 703 |
'label_block' => true, |
| 704 |
'default' => __('I have read and agree the Terms & Condition.', 'wpfnl'), |
| 705 |
'condition' => [ |
| 706 |
'acceptance_checkbox' => 'yes', |
| 707 |
], |
| 708 |
] |
| 709 |
); |
| 710 |
$this->add_control( |
| 711 |
'is_required_acceptance', |
| 712 |
[ |
| 713 |
'label' => __('Mark Acceptance As Required', 'wpfnl'), |
| 714 |
'type' => Controls_Manager::SWITCHER, |
| 715 |
'label_on' => __( 'Yes', 'wpfnl' ), |
| 716 |
'label_off' => __( 'No', 'wpfnl' ), |
| 717 |
'return_value' => 'yes', |
| 718 |
'default' => '', |
| 719 |
'condition' => [ |
| 720 |
'acceptance_checkbox' => 'yes', |
| 721 |
], |
| 722 |
'separator' => 'after' |
| 723 |
] |
| 724 |
); |
| 725 |
|
| 726 |
$this->add_control( |
| 727 |
'input_fields_icon', |
| 728 |
[ |
| 729 |
'label' => __('Show Input Field Icon(s)', 'wpfnl'), |
| 730 |
'type' => Controls_Manager::SWITCHER, |
| 731 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 732 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 733 |
'return_value' => 'yes', |
| 734 |
'default' => 'yes', |
| 735 |
] |
| 736 |
); |
| 737 |
|
| 738 |
$this->add_control( |
| 739 |
'field_label', |
| 740 |
[ |
| 741 |
'label' => __('Show Field Label(s)', 'wpfnl'), |
| 742 |
'type' => Controls_Manager::SWITCHER, |
| 743 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 744 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 745 |
'return_value' => 'yes', |
| 746 |
'default' => '', |
| 747 |
'separator' => 'before', |
| 748 |
] |
| 749 |
); |
| 750 |
|
| 751 |
$this->add_control( |
| 752 |
'required_mark', |
| 753 |
[ |
| 754 |
'label' => __('Show Required Mark', 'wpfnl'), |
| 755 |
'type' => Controls_Manager::SWITCHER, |
| 756 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 757 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 758 |
'return_value' => 'yes', |
| 759 |
'default' => 'yes', |
| 760 |
'condition' => [ |
| 761 |
'field_label' => 'yes', |
| 762 |
], |
| 763 |
] |
| 764 |
); |
| 765 |
|
| 766 |
$this->end_controls_section(); |
| 767 |
} |
| 768 |
|
| 769 |
|
| 770 |
/** |
| 771 |
* Register Button Controls. |
| 772 |
* |
| 773 |
* @since 1.0.0 |
| 774 |
* @access protected |
| 775 |
*/ |
| 776 |
protected function register_form_button_controls(){ |
| 777 |
$this->start_controls_section( |
| 778 |
'wpfnl_optin_form_button_controls', array( |
| 779 |
'label' => __('Submit Button', 'wpfnl'), |
| 780 |
'condition' => [ |
| 781 |
'optin_form_source' => 'wpfnl_forms' |
| 782 |
] |
| 783 |
) |
| 784 |
); |
| 785 |
|
| 786 |
$this->add_control( |
| 787 |
'btn_text', |
| 788 |
[ |
| 789 |
'label' => __('Text', 'wpfnl'), |
| 790 |
'type' => Controls_Manager::TEXT, |
| 791 |
'default' => __('Submit', 'wpfnl'), |
| 792 |
'placeholder' => __('Submit', 'wpfnl'), |
| 793 |
] |
| 794 |
); |
| 795 |
|
| 796 |
$this->add_responsive_control( |
| 797 |
'btn_align', |
| 798 |
[ |
| 799 |
'label' => __('Alignment', 'wpfnl'), |
| 800 |
'type' => Controls_Manager::CHOOSE, |
| 801 |
'options' => [ |
| 802 |
'left' => [ |
| 803 |
'title' => __('Left', 'wpfnl'), |
| 804 |
'icon' => 'fa fa-align-left', |
| 805 |
], |
| 806 |
'center' => [ |
| 807 |
'title' => __('Center', 'wpfnl'), |
| 808 |
'icon' => 'fa fa-align-center', |
| 809 |
], |
| 810 |
'right' => [ |
| 811 |
'title' => __('Right', 'wpfnl'), |
| 812 |
'icon' => 'fa fa-align-right', |
| 813 |
], |
| 814 |
'justify' => [ |
| 815 |
'title' => __('Justified', 'wpfnl'), |
| 816 |
'icon' => 'fa fa-align-justify', |
| 817 |
], |
| 818 |
], |
| 819 |
'default' => '', |
| 820 |
'condition' => [ |
| 821 |
'optin_form_layout[value]!' => 'form-style1', |
| 822 |
], |
| 823 |
] |
| 824 |
); |
| 825 |
|
| 826 |
$this->add_control( |
| 827 |
'btn_icon', |
| 828 |
[ |
| 829 |
'label' => __('Icon', 'wpfnl'), |
| 830 |
'type' => Controls_Manager::ICONS, |
| 831 |
'fa4compatibility' => 'icon', |
| 832 |
] |
| 833 |
); |
| 834 |
|
| 835 |
$this->add_control( |
| 836 |
'btn_icon_align', |
| 837 |
[ |
| 838 |
'label' => __('Icon Position', 'wpfnl'), |
| 839 |
'type' => Controls_Manager::SELECT, |
| 840 |
'default' => 'left', |
| 841 |
'options' => [ |
| 842 |
'left' => __('Before Text', 'wpfnl'), |
| 843 |
'right' => __('After Text', 'wpfnl'), |
| 844 |
], |
| 845 |
'condition' => [ |
| 846 |
'btn_icon[value]!' => '', |
| 847 |
], |
| 848 |
] |
| 849 |
); |
| 850 |
|
| 851 |
$this->add_control( |
| 852 |
'btn_icon_indent', |
| 853 |
[ |
| 854 |
'label' => __('Icon Spacing', 'wpfnl'), |
| 855 |
'type' => Controls_Manager::SLIDER, |
| 856 |
'range' => [ |
| 857 |
'px' => [ |
| 858 |
'max' => 50, |
| 859 |
], |
| 860 |
], |
| 861 |
'condition' => [ |
| 862 |
'btn_icon!' => '', |
| 863 |
], |
| 864 |
'selectors' => [ |
| 865 |
'{{WRAPPER}} .elementor-button .elementor-align-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};', |
| 866 |
'{{WRAPPER}} .elementor-button .elementor-align-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 867 |
], |
| 868 |
] |
| 869 |
); |
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
$this->end_controls_section(); |
| 874 |
} |
| 875 |
|
| 876 |
|
| 877 |
/** |
| 878 |
* Register Click to Expand Button Controls. |
| 879 |
* |
| 880 |
* @since 1.0.0 |
| 881 |
* @access protected |
| 882 |
*/ |
| 883 |
protected function register_clickto_expand_button_controls(){ |
| 884 |
$this->start_controls_section( |
| 885 |
'wpfnl_optin_clickto_expand_control', array( |
| 886 |
'label' => __('Click to Expand Button', 'wpfnl'), |
| 887 |
'condition' => [ |
| 888 |
'optin_form_type' => 'clickto-expand-optin', |
| 889 |
'optin_form_source' => 'wpfnl_forms' |
| 890 |
], |
| 891 |
) |
| 892 |
); |
| 893 |
|
| 894 |
$this->add_control( |
| 895 |
'clickto_expand_btn_text', |
| 896 |
[ |
| 897 |
'label' => __('Text', 'wpfnl'), |
| 898 |
'type' => Controls_Manager::TEXT, |
| 899 |
'default' => __('Click to Expand', 'wpfnl'), |
| 900 |
'placeholder' => __('Write the button title', 'wpfnl'), |
| 901 |
] |
| 902 |
); |
| 903 |
|
| 904 |
$this->add_responsive_control( |
| 905 |
'clickto_expand_btn_align', |
| 906 |
[ |
| 907 |
'label' => __('Alignment', 'wpfnl'), |
| 908 |
'type' => Controls_Manager::CHOOSE, |
| 909 |
'options' => [ |
| 910 |
'left' => [ |
| 911 |
'title' => __('Left', 'wpfnl'), |
| 912 |
'icon' => 'fa fa-align-left', |
| 913 |
], |
| 914 |
'center' => [ |
| 915 |
'title' => __('Center', 'wpfnl'), |
| 916 |
'icon' => 'fa fa-align-center', |
| 917 |
], |
| 918 |
'right' => [ |
| 919 |
'title' => __('Right', 'wpfnl'), |
| 920 |
'icon' => 'fa fa-align-right', |
| 921 |
], |
| 922 |
'justify' => [ |
| 923 |
'title' => __('Justified', 'wpfnl'), |
| 924 |
'icon' => 'fa fa-align-justify', |
| 925 |
], |
| 926 |
], |
| 927 |
'default' => '', |
| 928 |
] |
| 929 |
); |
| 930 |
|
| 931 |
$this->add_control( |
| 932 |
'clickto_expand_btn_icon', |
| 933 |
[ |
| 934 |
'label' => __('Icon', 'wpfnl'), |
| 935 |
'type' => Controls_Manager::ICONS, |
| 936 |
'fa4compatibility' => 'icon', |
| 937 |
] |
| 938 |
); |
| 939 |
|
| 940 |
$this->add_control( |
| 941 |
'clickto_expand_btn_icon_align', |
| 942 |
[ |
| 943 |
'label' => __('Icon Position', 'wpfnl'), |
| 944 |
'type' => Controls_Manager::SELECT, |
| 945 |
'default' => 'left', |
| 946 |
'options' => [ |
| 947 |
'left' => __('Before Text', 'wpfnl'), |
| 948 |
'right' => __('After Text', 'wpfnl'), |
| 949 |
], |
| 950 |
'condition' => [ |
| 951 |
'clickto_expand_btn_icon[value]!' => '', |
| 952 |
], |
| 953 |
] |
| 954 |
); |
| 955 |
|
| 956 |
$this->add_control( |
| 957 |
'clickto_expand_btn_icon_indent', |
| 958 |
[ |
| 959 |
'label' => __('Icon Spacing', 'wpfnl'), |
| 960 |
'type' => Controls_Manager::SLIDER, |
| 961 |
'range' => [ |
| 962 |
'px' => [ |
| 963 |
'max' => 50, |
| 964 |
], |
| 965 |
], |
| 966 |
'condition' => [ |
| 967 |
'clickto_expand_btn_icon!' => '', |
| 968 |
], |
| 969 |
'selectors' => [ |
| 970 |
'{{WRAPPER}} .clickto-expand-btn.elementor-button .elementor-align-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};', |
| 971 |
'{{WRAPPER}} .clickto-expand-btn.elementor-button .elementor-align-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 972 |
], |
| 973 |
] |
| 974 |
); |
| 975 |
|
| 976 |
|
| 977 |
$this->end_controls_section(); |
| 978 |
} |
| 979 |
|
| 980 |
|
| 981 |
/** |
| 982 |
* Register Action After Submit Controls. |
| 983 |
* |
| 984 |
* @since 1.0.0 |
| 985 |
* @access protected |
| 986 |
*/ |
| 987 |
protected function register_action_after_submit_controls(){ |
| 988 |
$this->start_controls_section( |
| 989 |
'wpfnl_action_after_submit_controls', array( |
| 990 |
'label' => __('Action After Submission', 'wpfnl'), |
| 991 |
'condition' => [ |
| 992 |
'optin_form_source' => 'wpfnl_forms' |
| 993 |
] |
| 994 |
) |
| 995 |
); |
| 996 |
|
| 997 |
$this->add_control( |
| 998 |
'admin_email', |
| 999 |
[ |
| 1000 |
'label' => __('Admin Email', 'wpfnl'), |
| 1001 |
'type' => Controls_Manager::TEXT, |
| 1002 |
'label_block' => true, |
| 1003 |
'default' => Wpfnl_functions::get_optin_settings('sender_email'), |
| 1004 |
'separator' => 'before', |
| 1005 |
'optin_form_source' => 'wpfnl_forms' |
| 1006 |
] |
| 1007 |
); |
| 1008 |
|
| 1009 |
$this->add_control( |
| 1010 |
'admin_email_subject', |
| 1011 |
[ |
| 1012 |
'label' => __('Admin Email Subject', 'wpfnl'), |
| 1013 |
'type' => Controls_Manager::TEXT, |
| 1014 |
'default' => Wpfnl_functions::get_optin_settings('email_subject'), |
| 1015 |
'label_block' => true, |
| 1016 |
'optin_form_source' => 'wpfnl_forms' |
| 1017 |
] |
| 1018 |
); |
| 1019 |
|
| 1020 |
$this->add_control( |
| 1021 |
'notification_text', |
| 1022 |
[ |
| 1023 |
'label' => __( 'Confirmation Text', 'wpfnl' ), |
| 1024 |
'type' => Controls_Manager::TEXTAREA, |
| 1025 |
'rows' => 5, |
| 1026 |
'default' => 'Thank you! Your form was submitted successfully!', |
| 1027 |
'placeholder' => __( 'Type notification texts here', 'wpfnl' ), |
| 1028 |
'optin_form_source' => 'wpfnl_forms' |
| 1029 |
] |
| 1030 |
); |
| 1031 |
|
| 1032 |
$this->add_control( |
| 1033 |
'post_action', |
| 1034 |
[ |
| 1035 |
'label' => __( 'Other action', 'wpfnl' ), |
| 1036 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 1037 |
'default' => 'notification', |
| 1038 |
'options' => [ |
| 1039 |
'notification' => __( 'None', 'wpfnl' ), |
| 1040 |
'redirect_to' => __( 'Redirect to url', 'wpfnl' ), |
| 1041 |
'next_step' => __( 'Next Step', 'wpfnl' ), |
| 1042 |
], |
| 1043 |
'optin_form_source' => 'wpfnl_forms' |
| 1044 |
] |
| 1045 |
); |
| 1046 |
|
| 1047 |
$this->add_control( |
| 1048 |
'redirect_url', |
| 1049 |
[ |
| 1050 |
'label' => __( 'Redirect url', 'wpfnl' ), |
| 1051 |
'type' => Controls_Manager::URL, |
| 1052 |
'placeholder' => __( 'https://your-link.com', 'wpfnl' ), |
| 1053 |
'show_external' => true, |
| 1054 |
'default' => [ |
| 1055 |
'url' => '', |
| 1056 |
'is_external' => false, |
| 1057 |
'nofollow' => true, |
| 1058 |
], |
| 1059 |
'condition' => [ |
| 1060 |
'post_action' => 'redirect_to', |
| 1061 |
] |
| 1062 |
] |
| 1063 |
); |
| 1064 |
|
| 1065 |
$this->add_control( |
| 1066 |
'data_to_checkout', |
| 1067 |
[ |
| 1068 |
'label' => __('Carry data to the Next Form', 'wpfnl'), |
| 1069 |
'type' => Controls_Manager::SWITCHER, |
| 1070 |
'label_on' => __( 'Yes', 'wpfnl' ), |
| 1071 |
'label_off' => __( 'No', 'wpfnl' ), |
| 1072 |
'return_value' => 'yes', |
| 1073 |
'default' => '', |
| 1074 |
'optin_form_source' => 'wpfnl_forms' |
| 1075 |
] |
| 1076 |
); |
| 1077 |
|
| 1078 |
$this->add_control( |
| 1079 |
'allow_registration', |
| 1080 |
[ |
| 1081 |
'label' => __('Register User As Subscriber', 'wpfnl'), |
| 1082 |
'type' => Controls_Manager::SWITCHER, |
| 1083 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 1084 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 1085 |
'return_value' => 'yes', |
| 1086 |
'default' => '', |
| 1087 |
'optin_form_source' => 'wpfnl_forms' |
| 1088 |
] |
| 1089 |
); |
| 1090 |
$this->add_control( |
| 1091 |
'allow_user_permission', |
| 1092 |
[ |
| 1093 |
'label' => __('Registration Permission', 'wpfnl'), |
| 1094 |
'type' => Controls_Manager::SWITCHER, |
| 1095 |
'label_on' => __( 'Show', 'wpfnl' ), |
| 1096 |
'label_off' => __( 'Hide', 'wpfnl' ), |
| 1097 |
'return_value' => 'yes', |
| 1098 |
'default' => '', |
| 1099 |
'condition' => [ |
| 1100 |
'allow_registration' => 'yes', |
| 1101 |
], |
| 1102 |
] |
| 1103 |
); |
| 1104 |
$this->add_control( |
| 1105 |
'allow_user_registration_permission_text', |
| 1106 |
[ |
| 1107 |
'label' => __('Registration Permission Text', 'wpfnl'), |
| 1108 |
'type' => \Elementor\Controls_Manager::WYSIWYG, |
| 1109 |
'label_block' => true, |
| 1110 |
'default' => __('I agree to be registered as a subscriber.', 'wpfnl'), |
| 1111 |
'condition' => [ |
| 1112 |
'allow_user_permission' => 'yes', |
| 1113 |
'allow_registration' => 'yes', |
| 1114 |
], |
| 1115 |
] |
| 1116 |
); |
| 1117 |
|
| 1118 |
|
| 1119 |
$this->end_controls_section(); |
| 1120 |
} |
| 1121 |
|
| 1122 |
/** |
| 1123 |
* Register Label Style Controls. |
| 1124 |
* |
| 1125 |
* @since 1.0.0 |
| 1126 |
* @access protected |
| 1127 |
*/ |
| 1128 |
protected function register_form_style_controls(){ |
| 1129 |
$this->start_controls_section( |
| 1130 |
'form_section_style', [ |
| 1131 |
'label' => __( 'Form', 'wpfnl' ), |
| 1132 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1133 |
'condition' => [ |
| 1134 |
'optin_form_source' => 'wpfnl_forms' |
| 1135 |
] |
| 1136 |
] |
| 1137 |
); |
| 1138 |
|
| 1139 |
$this->add_control( |
| 1140 |
'row_spacing', |
| 1141 |
[ |
| 1142 |
'label' => __('Row Spacing', 'wpfnl'), |
| 1143 |
'type' => Controls_Manager::SLIDER, |
| 1144 |
'range' => [ |
| 1145 |
'px' => [ |
| 1146 |
'max' => 50, |
| 1147 |
], |
| 1148 |
], |
| 1149 |
'selectors' => [ |
| 1150 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 1151 |
], |
| 1152 |
] |
| 1153 |
); |
| 1154 |
|
| 1155 |
//--------start label style------ |
| 1156 |
$this->add_control( |
| 1157 |
'label_style', |
| 1158 |
[ |
| 1159 |
'label' => __('Label', 'wpfnl'), |
| 1160 |
'type' => Controls_Manager::HEADING, |
| 1161 |
'label_block' => true, |
| 1162 |
'separator' => 'before', |
| 1163 |
] |
| 1164 |
); |
| 1165 |
$this->add_group_control( |
| 1166 |
Group_Control_Typography::get_type(), |
| 1167 |
[ |
| 1168 |
'name' => 'label_typography', |
| 1169 |
'label' => 'Typography', |
| 1170 |
'selector' => '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group > label', |
| 1171 |
] |
| 1172 |
); |
| 1173 |
|
| 1174 |
$this->add_control( |
| 1175 |
'label_color', |
| 1176 |
[ |
| 1177 |
'label' => __('Color', 'wpfnl'), |
| 1178 |
'type' => Controls_Manager::COLOR, |
| 1179 |
'default' => '', |
| 1180 |
'selectors' => [ |
| 1181 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group > label' => 'color: {{VALUE}};', |
| 1182 |
], |
| 1183 |
] |
| 1184 |
); |
| 1185 |
|
| 1186 |
$this->add_control( |
| 1187 |
'label_spacing', |
| 1188 |
[ |
| 1189 |
'label' => __('Spacing', 'wpfnl'), |
| 1190 |
'type' => Controls_Manager::SLIDER, |
| 1191 |
'range' => [ |
| 1192 |
'px' => [ |
| 1193 |
'max' => 50, |
| 1194 |
], |
| 1195 |
], |
| 1196 |
'selectors' => [ |
| 1197 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group:not(.acceptance-checkbox):not(.user-registration-checkbox) > label' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 1198 |
], |
| 1199 |
] |
| 1200 |
); |
| 1201 |
//--------end label style------ |
| 1202 |
|
| 1203 |
|
| 1204 |
$this->add_control( |
| 1205 |
'tnc_link_color', |
| 1206 |
[ |
| 1207 |
'label' => __('Link Color', 'wpfnl'), |
| 1208 |
'type' => Controls_Manager::COLOR, |
| 1209 |
'default' => '', |
| 1210 |
'selectors' => [ |
| 1211 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group > label a' => 'color: {{VALUE}};', |
| 1212 |
], |
| 1213 |
] |
| 1214 |
); |
| 1215 |
|
| 1216 |
$this->add_control( |
| 1217 |
'checkbox_active_color', |
| 1218 |
[ |
| 1219 |
'label' => __('Checkbox Active Color', 'wpfnl'), |
| 1220 |
'type' => Controls_Manager::COLOR, |
| 1221 |
'default' => '', |
| 1222 |
'selectors' => [ |
| 1223 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type="checkbox"]:checked + label .check-box' => 'background-color: {{VALUE}}; border-color: {{VALUE}};', |
| 1224 |
], |
| 1225 |
] |
| 1226 |
); |
| 1227 |
|
| 1228 |
$this->add_control( |
| 1229 |
'checkbox_size', |
| 1230 |
[ |
| 1231 |
'label' => __('Checkbox Size', 'wpfnl'), |
| 1232 |
'type' => Controls_Manager::SLIDER, |
| 1233 |
'range' => [ |
| 1234 |
'px' => [ |
| 1235 |
'min' => 18, |
| 1236 |
'max' => 40, |
| 1237 |
], |
| 1238 |
], |
| 1239 |
'selectors' => [ |
| 1240 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group > label .check-box' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 1241 |
], |
| 1242 |
] |
| 1243 |
); |
| 1244 |
|
| 1245 |
$this->add_control( |
| 1246 |
'checkbox_spacing', |
| 1247 |
[ |
| 1248 |
'label' => __('Checkbox Spacing', 'wpfnl'), |
| 1249 |
'type' => Controls_Manager::SLIDER, |
| 1250 |
'range' => [ |
| 1251 |
'px' => [ |
| 1252 |
'max' => 60, |
| 1253 |
], |
| 1254 |
], |
| 1255 |
'selectors' => [ |
| 1256 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group.acceptance-checkbox > label, |
| 1257 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group.user-registration-checkbox > label' => 'padding-left: {{SIZE}}{{UNIT}};', |
| 1258 |
], |
| 1259 |
] |
| 1260 |
); |
| 1261 |
//--------end terms and condition style------ |
| 1262 |
|
| 1263 |
$this->end_controls_section(); |
| 1264 |
} |
| 1265 |
|
| 1266 |
|
| 1267 |
/** |
| 1268 |
* Register Input field Style Controls. |
| 1269 |
* |
| 1270 |
* @since 1.0.0 |
| 1271 |
* @access protected |
| 1272 |
*/ |
| 1273 |
protected function register_input_fields_style_controls(){ |
| 1274 |
$this->start_controls_section( |
| 1275 |
'inputs_section_style', [ |
| 1276 |
'label' => __('Input Fields', 'wpfnl'), |
| 1277 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1278 |
'condition' => [ |
| 1279 |
'optin_form_source' => 'wpfnl_forms' |
| 1280 |
] |
| 1281 |
] |
| 1282 |
); |
| 1283 |
|
| 1284 |
$this->add_group_control( |
| 1285 |
Group_Control_Typography::get_type(), |
| 1286 |
[ |
| 1287 |
'name' => 'inputs_typography', |
| 1288 |
'label' => 'Typography', |
| 1289 |
'selector' => '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text], |
| 1290 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email], |
| 1291 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea', |
| 1292 |
] |
| 1293 |
); |
| 1294 |
|
| 1295 |
$this->add_control( |
| 1296 |
'input_text_color', |
| 1297 |
[ |
| 1298 |
'label' => __('Text Color', 'wpfnl'), |
| 1299 |
'type' => Controls_Manager::COLOR, |
| 1300 |
'default' => '', |
| 1301 |
'selectors' => [ |
| 1302 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text], |
| 1303 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email], |
| 1304 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea' => 'color: {{VALUE}};', |
| 1305 |
], |
| 1306 |
] |
| 1307 |
); |
| 1308 |
|
| 1309 |
$this->add_control( |
| 1310 |
'input_bg_color', |
| 1311 |
[ |
| 1312 |
'label' => __('Background Color', 'wpfnl'), |
| 1313 |
'type' => Controls_Manager::COLOR, |
| 1314 |
'default' => '', |
| 1315 |
'selectors' => [ |
| 1316 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text], |
| 1317 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email], |
| 1318 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea' => 'background-color: {{VALUE}};', |
| 1319 |
], |
| 1320 |
] |
| 1321 |
); |
| 1322 |
|
| 1323 |
$this->add_group_control( |
| 1324 |
Group_Control_Box_Shadow::get_type(), |
| 1325 |
[ |
| 1326 |
'name' => 'input_box_shadow', |
| 1327 |
'selector' => '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text], |
| 1328 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email], |
| 1329 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea', |
| 1330 |
] |
| 1331 |
); |
| 1332 |
|
| 1333 |
$this->add_group_control( |
| 1334 |
Group_Control_Border::get_type(), |
| 1335 |
[ |
| 1336 |
'name' => 'input_border', |
| 1337 |
'label' => __('Border', 'wpfnl'), |
| 1338 |
'placeholder' => '1px', |
| 1339 |
'default' => '1px', |
| 1340 |
'selector' => '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text], |
| 1341 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email], |
| 1342 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea', |
| 1343 |
'separator' => 'before', |
| 1344 |
] |
| 1345 |
); |
| 1346 |
|
| 1347 |
$this->add_responsive_control( |
| 1348 |
'input_border_radius', |
| 1349 |
[ |
| 1350 |
'label' => __('Border Radius', 'wpfnl'), |
| 1351 |
'type' => Controls_Manager::DIMENSIONS, |
| 1352 |
'size_units' => ['px', '%'], |
| 1353 |
'selectors' => [ |
| 1354 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text], |
| 1355 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email], |
| 1356 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1357 |
], |
| 1358 |
] |
| 1359 |
); |
| 1360 |
|
| 1361 |
$this->add_responsive_control( |
| 1362 |
'input_padding', |
| 1363 |
[ |
| 1364 |
'label' => __('Padding', 'wpfnl'), |
| 1365 |
'type' => Controls_Manager::DIMENSIONS, |
| 1366 |
'size_units' => ['px', 'em', '%'], |
| 1367 |
'selectors' => [ |
| 1368 |
'{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text], |
| 1369 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email], |
| 1370 |
{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1371 |
], |
| 1372 |
'separator' => 'before', |
| 1373 |
] |
| 1374 |
); |
| 1375 |
|
| 1376 |
$this->end_controls_section(); |
| 1377 |
} |
| 1378 |
|
| 1379 |
|
| 1380 |
/** |
| 1381 |
* Register Button Style Controls. |
| 1382 |
* |
| 1383 |
* @since 1.0.0 |
| 1384 |
* @access protected |
| 1385 |
*/ |
| 1386 |
protected function register_button_style_controls(){ |
| 1387 |
$this->start_controls_section( |
| 1388 |
'btn_section_style', [ |
| 1389 |
'label' => __('Submit Button', 'wpfnl'), |
| 1390 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1391 |
'condition' => [ |
| 1392 |
'optin_form_source' => 'wpfnl_forms' |
| 1393 |
] |
| 1394 |
] |
| 1395 |
); |
| 1396 |
|
| 1397 |
$this->add_group_control( |
| 1398 |
Group_Control_Typography::get_type(), |
| 1399 |
[ |
| 1400 |
'name' => 'btn_typography', |
| 1401 |
'label' => 'Typography', |
| 1402 |
'selector' => '{{WRAPPER}} button.elementor-button', |
| 1403 |
] |
| 1404 |
); |
| 1405 |
|
| 1406 |
$this->start_controls_tabs('btn_color_style'); |
| 1407 |
$this->start_controls_tab( |
| 1408 |
'tab_button_normal', |
| 1409 |
[ |
| 1410 |
'label' => __('Normal', 'wpfnl'), |
| 1411 |
] |
| 1412 |
); |
| 1413 |
|
| 1414 |
$this->add_control( |
| 1415 |
'btn_text_color', |
| 1416 |
[ |
| 1417 |
'label' => __('Text Color', 'wpfnl'), |
| 1418 |
'type' => Controls_Manager::COLOR, |
| 1419 |
'default' => '', |
| 1420 |
'selectors' => [ |
| 1421 |
'{{WRAPPER}} button.elementor-button, {{WRAPPER}} .elementor-button' => 'color: {{VALUE}}!important;', |
| 1422 |
], |
| 1423 |
] |
| 1424 |
); |
| 1425 |
|
| 1426 |
$this->add_control( |
| 1427 |
'btn_bg_color', |
| 1428 |
[ |
| 1429 |
'label' => __('Background Color', 'wpfnl'), |
| 1430 |
'type' => Controls_Manager::COLOR, |
| 1431 |
'default' => '', |
| 1432 |
'selectors' => [ |
| 1433 |
'{{WRAPPER}} button.elementor-button, {{WRAPPER}} .elementor-button' => 'background-color: {{VALUE}}!important;', |
| 1434 |
], |
| 1435 |
] |
| 1436 |
); |
| 1437 |
|
| 1438 |
$this->add_group_control( |
| 1439 |
Group_Control_Box_Shadow::get_type(), |
| 1440 |
[ |
| 1441 |
'name' => 'btn_box_shadow', |
| 1442 |
'selector' => '{{WRAPPER}} button.elementor-button', |
| 1443 |
] |
| 1444 |
); |
| 1445 |
|
| 1446 |
$this->end_controls_tab(); |
| 1447 |
//---end normal style---- |
| 1448 |
|
| 1449 |
$this->start_controls_tab( |
| 1450 |
'tab_button_hover', |
| 1451 |
[ |
| 1452 |
'label' => __('Hover', 'wpfnl'), |
| 1453 |
] |
| 1454 |
); |
| 1455 |
|
| 1456 |
$this->add_control( |
| 1457 |
'btn_hover_text_color', |
| 1458 |
[ |
| 1459 |
'label' => __('Text Color', 'wpfnl'), |
| 1460 |
'type' => Controls_Manager::COLOR, |
| 1461 |
'default' => '', |
| 1462 |
'selectors' => [ |
| 1463 |
'{{WRAPPER}} button.elementor-button:hover, {{WRAPPER}} .elementor-button:hover' => 'color: {{VALUE}}!important;', |
| 1464 |
], |
| 1465 |
] |
| 1466 |
); |
| 1467 |
|
| 1468 |
$this->add_control( |
| 1469 |
'btn_hover_bg_color', |
| 1470 |
[ |
| 1471 |
'label' => __('Background Color', 'wpfnl'), |
| 1472 |
'type' => Controls_Manager::COLOR, |
| 1473 |
'default' => '', |
| 1474 |
'selectors' => [ |
| 1475 |
'{{WRAPPER}} button.elementor-button:hover, {{WRAPPER}} .elementor-button:hover' => 'background-color: {{VALUE}}!important;', |
| 1476 |
], |
| 1477 |
] |
| 1478 |
); |
| 1479 |
|
| 1480 |
$this->add_group_control( |
| 1481 |
Group_Control_Box_Shadow::get_type(), |
| 1482 |
[ |
| 1483 |
'name' => 'btn_hover_box_shadow', |
| 1484 |
'selector' => '{{WRAPPER}} button.elementor-button:hover', |
| 1485 |
] |
| 1486 |
); |
| 1487 |
|
| 1488 |
$this->end_controls_tab(); |
| 1489 |
//---end hover style---- |
| 1490 |
|
| 1491 |
$this->end_controls_tabs(); |
| 1492 |
//---end butotn color style tab---- |
| 1493 |
|
| 1494 |
$this->add_group_control( |
| 1495 |
Group_Control_Border::get_type(), |
| 1496 |
[ |
| 1497 |
'name' => 'btn_border', |
| 1498 |
'label' => __('Border', 'wpfnl'), |
| 1499 |
'placeholder' => '1px', |
| 1500 |
'default' => '1px', |
| 1501 |
'selector' => '{{WRAPPER}} button.elementor-button', |
| 1502 |
'separator' => 'before', |
| 1503 |
] |
| 1504 |
); |
| 1505 |
|
| 1506 |
$this->add_responsive_control( |
| 1507 |
'border_radius', |
| 1508 |
[ |
| 1509 |
'label' => __('Border Radius', 'wpfnl'), |
| 1510 |
'type' => Controls_Manager::DIMENSIONS, |
| 1511 |
'size_units' => ['px', '%'], |
| 1512 |
'selectors' => [ |
| 1513 |
'{{WRAPPER}} button.elementor-button, {{WRAPPER}} .elementor-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1514 |
], |
| 1515 |
] |
| 1516 |
); |
| 1517 |
|
| 1518 |
$this->add_responsive_control( |
| 1519 |
'btn_padding', |
| 1520 |
[ |
| 1521 |
'label' => __('Padding', 'wpfnl'), |
| 1522 |
'type' => Controls_Manager::DIMENSIONS, |
| 1523 |
'size_units' => ['px', 'em', '%'], |
| 1524 |
'selectors' => [ |
| 1525 |
'{{WRAPPER}} button.elementor-button, {{WRAPPER}} .elementor-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1526 |
], |
| 1527 |
'separator' => 'before', |
| 1528 |
] |
| 1529 |
); |
| 1530 |
|
| 1531 |
$this->end_controls_section(); |
| 1532 |
} |
| 1533 |
|
| 1534 |
|
| 1535 |
/** |
| 1536 |
* Register click to expand Button Style Controls. |
| 1537 |
* |
| 1538 |
* @since 1.0.0 |
| 1539 |
* @access protected |
| 1540 |
*/ |
| 1541 |
protected function register_clickto_expand_style_controls(){ |
| 1542 |
$this->start_controls_section( |
| 1543 |
'clickto_expand_btn_section_style', |
| 1544 |
[ |
| 1545 |
'label' => __('Click to Expand Button', 'wpfnl'), |
| 1546 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1547 |
'condition' => [ |
| 1548 |
'optin_form_type' => 'clickto-expand-optin', |
| 1549 |
'optin_form_source' => 'wpfnl_forms' |
| 1550 |
], |
| 1551 |
] |
| 1552 |
); |
| 1553 |
|
| 1554 |
$this->add_group_control( |
| 1555 |
Group_Control_Typography::get_type(), |
| 1556 |
[ |
| 1557 |
'name' => 'clickto_expand_btn_typography', |
| 1558 |
'label' => 'Typography', |
| 1559 |
'selector' => '{{WRAPPER}} button.elementor-button.clickto-expand-btn', |
| 1560 |
] |
| 1561 |
); |
| 1562 |
|
| 1563 |
$this->start_controls_tabs('clickto_expand_btn_color_style'); |
| 1564 |
$this->start_controls_tab( |
| 1565 |
'clickto_expand_tab_button_normal', |
| 1566 |
[ |
| 1567 |
'label' => __('Normal', 'wpfnl'), |
| 1568 |
] |
| 1569 |
); |
| 1570 |
|
| 1571 |
$this->add_control( |
| 1572 |
'clickto_expand_btn_text_color', |
| 1573 |
[ |
| 1574 |
'label' => __('Text Color', 'wpfnl'), |
| 1575 |
'type' => Controls_Manager::COLOR, |
| 1576 |
'default' => '', |
| 1577 |
'selectors' => [ |
| 1578 |
'{{WRAPPER}} button.elementor-button.clickto-expand-btn, |
| 1579 |
{{WRAPPER}} .elementor-button.clickto-expand-btn' => 'color: {{VALUE}}!important;', |
| 1580 |
], |
| 1581 |
] |
| 1582 |
); |
| 1583 |
|
| 1584 |
$this->add_control( |
| 1585 |
'clickto_expand_btn_bg_color', |
| 1586 |
[ |
| 1587 |
'label' => __('Background Color', 'wpfnl'), |
| 1588 |
'type' => Controls_Manager::COLOR, |
| 1589 |
'default' => '', |
| 1590 |
'selectors' => [ |
| 1591 |
'{{WRAPPER}} button.elementor-button.clickto-expand-btn, |
| 1592 |
{{WRAPPER}} .elementor-button.clickto-expand-btn' => 'background-color: {{VALUE}}!important;', |
| 1593 |
], |
| 1594 |
] |
| 1595 |
); |
| 1596 |
|
| 1597 |
$this->add_group_control( |
| 1598 |
Group_Control_Box_Shadow::get_type(), |
| 1599 |
[ |
| 1600 |
'name' => 'clickto_expand_btn_box_shadow', |
| 1601 |
'selector' => '{{WRAPPER}} button.elementor-button.clickto-expand-btn', |
| 1602 |
] |
| 1603 |
); |
| 1604 |
|
| 1605 |
$this->end_controls_tab(); |
| 1606 |
//---end normal style---- |
| 1607 |
|
| 1608 |
$this->start_controls_tab( |
| 1609 |
'clickto_expand_tab_button_hover', |
| 1610 |
[ |
| 1611 |
'label' => __('Hover', 'wpfnl'), |
| 1612 |
] |
| 1613 |
); |
| 1614 |
|
| 1615 |
$this->add_control( |
| 1616 |
'clickto_expand_btn_hover_text_color', |
| 1617 |
[ |
| 1618 |
'label' => __('Text Color', 'wpfnl'), |
| 1619 |
'type' => Controls_Manager::COLOR, |
| 1620 |
'default' => '', |
| 1621 |
'selectors' => [ |
| 1622 |
'{{WRAPPER}} button.elementor-button.clickto-expand-btn:hover, |
| 1623 |
{{WRAPPER}} .elementor-button.clickto-expand-btn:hover' => 'color: {{VALUE}}!important;', |
| 1624 |
], |
| 1625 |
] |
| 1626 |
); |
| 1627 |
|
| 1628 |
$this->add_control( |
| 1629 |
'clickto_expand_btn_hover_bg_color', |
| 1630 |
[ |
| 1631 |
'label' => __('Background Color', 'wpfnl'), |
| 1632 |
'type' => Controls_Manager::COLOR, |
| 1633 |
'default' => '', |
| 1634 |
'selectors' => [ |
| 1635 |
'{{WRAPPER}} button.elementor-button.clickto-expand-btn:hover, |
| 1636 |
{{WRAPPER}} .elementor-button.clickto-expand-btn:hover' => 'background-color: {{VALUE}}!important;', |
| 1637 |
], |
| 1638 |
] |
| 1639 |
); |
| 1640 |
|
| 1641 |
$this->add_group_control( |
| 1642 |
Group_Control_Box_Shadow::get_type(), |
| 1643 |
[ |
| 1644 |
'name' => 'clickto_expand_btn_hover_box_shadow', |
| 1645 |
'selector' => '{{WRAPPER}} button.elementor-button.clickto-expand-btn:hover', |
| 1646 |
] |
| 1647 |
); |
| 1648 |
|
| 1649 |
$this->end_controls_tab(); |
| 1650 |
//---end hover style---- |
| 1651 |
|
| 1652 |
$this->end_controls_tabs(); |
| 1653 |
//---end butotn color style tab---- |
| 1654 |
|
| 1655 |
$this->add_group_control( |
| 1656 |
Group_Control_Border::get_type(), |
| 1657 |
[ |
| 1658 |
'name' => 'clickto_expand_btn_border', |
| 1659 |
'label' => __('Border', 'wpfnl'), |
| 1660 |
'placeholder' => '1px', |
| 1661 |
'default' => '1px', |
| 1662 |
'selector' => '{{WRAPPER}} button.elementor-button.clickto-expand-btn', |
| 1663 |
'separator' => 'before', |
| 1664 |
] |
| 1665 |
); |
| 1666 |
|
| 1667 |
$this->add_responsive_control( |
| 1668 |
'clickto_expand_border_radius', |
| 1669 |
[ |
| 1670 |
'label' => __('Border Radius', 'wpfnl'), |
| 1671 |
'type' => Controls_Manager::DIMENSIONS, |
| 1672 |
'size_units' => ['px', '%'], |
| 1673 |
'selectors' => [ |
| 1674 |
'{{WRAPPER}} button.elementor-button.clickto-expand-btn, |
| 1675 |
{{WRAPPER}} .elementor-button.clickto-expand-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1676 |
], |
| 1677 |
] |
| 1678 |
); |
| 1679 |
|
| 1680 |
$this->add_responsive_control( |
| 1681 |
'clickto_expand_btn_padding', |
| 1682 |
[ |
| 1683 |
'label' => __('Padding', 'wpfnl'), |
| 1684 |
'type' => Controls_Manager::DIMENSIONS, |
| 1685 |
'size_units' => ['px', 'em', '%'], |
| 1686 |
'selectors' => [ |
| 1687 |
'{{WRAPPER}} button.elementor-button.clickto-expand-btn, |
| 1688 |
{{WRAPPER}} .elementor-button.clickto-expand-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1689 |
], |
| 1690 |
'separator' => 'before', |
| 1691 |
] |
| 1692 |
); |
| 1693 |
|
| 1694 |
$this->end_controls_section(); |
| 1695 |
} |
| 1696 |
|
| 1697 |
|
| 1698 |
/** |
| 1699 |
* Get wrapper classes |
| 1700 |
* |
| 1701 |
* @return array |
| 1702 |
*/ |
| 1703 |
protected function get_wrapper_classes() { |
| 1704 |
$settings = $this->get_settings_for_display(); |
| 1705 |
|
| 1706 |
if( 'clickto-expand-optin' == $settings['optin_form_type'] ) { |
| 1707 |
return array( 'wpfnl', 'wpfnl-optin-form', 'wpfnl-elementor-optin-form-wrapper', 'clickto-expand-optin'); |
| 1708 |
|
| 1709 |
}else { |
| 1710 |
return array( 'wpfnl', 'wpfnl-optin-form', 'wpfnl-elementor-optin-form-wrapper'); |
| 1711 |
|
| 1712 |
} |
| 1713 |
} |
| 1714 |
|
| 1715 |
|
| 1716 |
/** |
| 1717 |
* Render the widget output on the frontend. |
| 1718 |
* |
| 1719 |
* Written in PHP and used to generate the final HTML. |
| 1720 |
* |
| 1721 |
* @since 2.1.8 |
| 1722 |
* |
| 1723 |
* @access protected |
| 1724 |
*/ |
| 1725 |
protected function render() |
| 1726 |
{ |
| 1727 |
$settings = $this->get_settings_for_display(); |
| 1728 |
$classes = $this->get_wrapper_classes(); |
| 1729 |
$this->add_render_attribute( |
| 1730 |
[ |
| 1731 |
'wrapper' => [ |
| 1732 |
'class' => [ |
| 1733 |
'elementor-form-fields-wrapper', |
| 1734 |
], |
| 1735 |
], |
| 1736 |
] |
| 1737 |
); |
| 1738 |
|
| 1739 |
if ( !isset( $settings[ 'optin_form_source' ] ) || ( !empty( $settings[ 'optin_form_source' ] ) && 'mailmint_forms' !== $settings[ 'optin_form_source' ] ) ) { |
| 1740 |
$this->render_wpfnl_form( $settings, $classes ); |
| 1741 |
} |
| 1742 |
elseif ( !empty( $settings[ 'optin_form_source' ] ) && !empty( $settings[ 'mailmint_form_id' ] ) ) { |
| 1743 |
ob_start(); |
| 1744 |
Wpfnl_Widgets_Manager::render_mailmint_form( $settings[ 'mailmint_form_id' ] ); |
| 1745 |
$mailmint_form = ob_get_clean(); |
| 1746 |
$replace = 'id="mrm-form">'; |
| 1747 |
$replace .= '<input type="hidden" name="widget_id" value="'.$this->get_id().'"/>'; |
| 1748 |
if ( !empty( $settings[ 'data_to_checkout' ] ) && 'yes' == $settings[ 'data_to_checkout' ] ) { |
| 1749 |
$replace .= '<input type="hidden" name="data_to_checkout" value="yes"/>'; |
| 1750 |
} |
| 1751 |
if ( !empty( $settings[ 'allow_registration' ] ) && 'yes' == $settings[ 'allow_registration' ] ) { |
| 1752 |
$replace .= '<input type="hidden" name="optin_allow_registration" value="yes"/>'; |
| 1753 |
} |
| 1754 |
echo str_replace( 'id="mrm-form">', $replace, $mailmint_form ); |
| 1755 |
} |
| 1756 |
} |
| 1757 |
|
| 1758 |
/** |
| 1759 |
* Render the widget output on the frontend for WPFunnels' default forms. |
| 1760 |
* |
| 1761 |
* Written in PHP and used to generate the final HTML. |
| 1762 |
* |
| 1763 |
* @since 2.8.15 |
| 1764 |
* |
| 1765 |
* @access protected |
| 1766 |
*/ |
| 1767 |
protected function render_wpfnl_form( $settings, $classes ) { |
| 1768 |
$this->add_render_attribute('button', 'class', 'btn-optin elementor-button'); |
| 1769 |
$this->add_render_attribute('click-to-expand-button', 'class', 'elementor-button'); |
| 1770 |
|
| 1771 |
$recaptcha_setting = Wpfnl_functions::get_recaptcha_settings(); |
| 1772 |
$is_recaptch = isset($recaptcha_setting['enable_recaptcha']) ? $recaptcha_setting['enable_recaptcha'] : ''; |
| 1773 |
$site_key = isset($recaptcha_setting['recaptcha_site_key']) ? $recaptcha_setting['recaptcha_site_key'] : ''; |
| 1774 |
$site_secret_key = isset($recaptcha_setting['recaptcha_site_secret']) ? $recaptcha_setting['recaptcha_site_secret'] : ''; |
| 1775 |
$token_input = ''; |
| 1776 |
$recaptch_script = ''; |
| 1777 |
$is_recaptch_input = ''; |
| 1778 |
$token_secret_key = ''; |
| 1779 |
if('on' == $is_recaptch && '' != $site_key && '' != $site_secret_key){ |
| 1780 |
$is_recaptch_input = '<input type="hidden" id="wpf-is-recapcha" name="wpf-is-recapcha" value="'.$is_recaptch.'"/>'; |
| 1781 |
$token_input = '<input type="hidden" id="wpf-optin-g-token" name="wpf-optin-g-token" />'; |
| 1782 |
$token_secret_key = '<input type="hidden" id="wpf-optin-g-secret-key" name="wpf-optin-g-secret-key" value="'.$site_secret_key.'" />'; |
| 1783 |
$recaptch_script = '<script src="https://www.google.com/recaptcha/api.js?render='.$site_key.'"></script>'; |
| 1784 |
} |
| 1785 |
?> |
| 1786 |
<style> |
| 1787 |
<?php if( '' == $settings['input_fields_icon'] ){ ?> |
| 1788 |
.wpfnl-optin-form .wpfnl-optin-form-group input[type=text], |
| 1789 |
.wpfnl-optin-form .wpfnl-optin-form-group input[type=email] { |
| 1790 |
padding-right: 14px; |
| 1791 |
} |
| 1792 |
<?php } ?> |
| 1793 |
</style> |
| 1794 |
<?php echo $recaptch_script; ?> |
| 1795 |
|
| 1796 |
<?php |
| 1797 |
if( 'clickto-expand-optin' == $settings['optin_form_type'] ) { |
| 1798 |
?> |
| 1799 |
<div class="wpfnl-optin-clickto-expand align-<?php echo $settings['clickto_expand_btn_align'] ?>"> |
| 1800 |
<button class="btn-default clickto-expand-btn elementor-button" type="button" <?php echo $this->get_render_attribute_string('click-to-expand-button'); ?> > |
| 1801 |
<?php $this->render_clickto_expand_text(); ?> |
| 1802 |
</button> |
| 1803 |
</div> |
| 1804 |
<?php |
| 1805 |
} |
| 1806 |
?> |
| 1807 |
|
| 1808 |
<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>" <?php $this->print_render_attribute_string( 'wrapper' ); ?> > |
| 1809 |
<form method="post" <?php $this->print_render_attribute_string( 'form' ); ?>> |
| 1810 |
<input type="hidden" name="post_id" value="<?php echo get_the_ID(); ?>" /> |
| 1811 |
<input type="hidden" name="form_id" value="<?php echo esc_attr( $this->get_id() ); ?>"/> |
| 1812 |
<?php |
| 1813 |
echo $is_recaptch_input; |
| 1814 |
echo $token_input; |
| 1815 |
echo $token_secret_key; |
| 1816 |
?> |
| 1817 |
<div class="wpfnl-optin-form-wrapper <?php echo $settings['optin_form_layout']; ?>" > |
| 1818 |
<?php if( 'yes' == $settings['first_name'] ){ ?> |
| 1819 |
<div class="wpfnl-optin-form-group first-name"> |
| 1820 |
|
| 1821 |
<?php if( 'yes' == $settings['field_label'] ){ ?> |
| 1822 |
<label for="wpfnl-first-name"> |
| 1823 |
<?php |
| 1824 |
echo $settings['first_name_label'] ? $settings['first_name_label'] : __('First Name','wpfnl'); |
| 1825 |
|
| 1826 |
if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_name'] ){ ?> |
| 1827 |
<span class="required-mark">*</span> |
| 1828 |
<?php } ?> |
| 1829 |
</label> |
| 1830 |
<?php } ?> |
| 1831 |
|
| 1832 |
<span class="input-wrapper"> |
| 1833 |
<?php if( 'yes' == $settings['input_fields_icon'] ){ ?> |
| 1834 |
<span class="field-icon"> |
| 1835 |
<img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/user-icon.svg'; ?>" alt="icon"> |
| 1836 |
</span> |
| 1837 |
<?php } |
| 1838 |
$f_name_placeholder = isset($settings['first_name_placeholder']) ? $settings['first_name_placeholder'] : ''; |
| 1839 |
?> |
| 1840 |
<input type="text" name="first_name" class="wpfnl-first-name" id="wpfnl-first-name" placeholder="<?php echo $f_name_placeholder; ?>" <?php echo 'yes' == $settings['is_required_name'] ? 'required' : ''; ?>/> |
| 1841 |
</span> |
| 1842 |
|
| 1843 |
</div> |
| 1844 |
<?php } ?> |
| 1845 |
|
| 1846 |
<?php if( 'yes' == $settings['last_name'] ){ ?> |
| 1847 |
<div class="wpfnl-optin-form-group last-name"> |
| 1848 |
|
| 1849 |
<?php if( 'yes' == $settings['field_label'] ){ ?> |
| 1850 |
<label for="wpfnl-last-name"> |
| 1851 |
<?php |
| 1852 |
echo $settings['last_name_label'] ? $settings['last_name_label'] : __('Last Name','wpfnl'); |
| 1853 |
|
| 1854 |
if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_last_name'] ){ ?> |
| 1855 |
<span class="required-mark">*</span> |
| 1856 |
<?php } ?> |
| 1857 |
</label> |
| 1858 |
<?php } ?> |
| 1859 |
|
| 1860 |
<span class="input-wrapper"> |
| 1861 |
<?php if( 'yes' == $settings['input_fields_icon'] ){ ?> |
| 1862 |
<span class="field-icon"> |
| 1863 |
<img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/user-icon.svg'; ?>" alt="icon"> |
| 1864 |
</span> |
| 1865 |
<?php } |
| 1866 |
$l_name_placeholder = isset($settings['last_name_placeholder']) ? $settings['last_name_placeholder'] : ''; |
| 1867 |
?> |
| 1868 |
<input type="text" name="last_name" class="wpfnl-last-name" id="wpfnl-last-name" placeholder="<?php echo $l_name_placeholder;?>" <?php echo 'yes' == $settings['is_required_last_name'] ? 'required' : ''; ?>/> |
| 1869 |
</span> |
| 1870 |
</div> |
| 1871 |
<?php } ?> |
| 1872 |
|
| 1873 |
<div class="wpfnl-optin-form-group email"> |
| 1874 |
<?php if( 'yes' == $settings['field_label'] ){ ?> |
| 1875 |
<label for="wpfnl-email"> |
| 1876 |
<?php |
| 1877 |
echo $settings['email_label'] ? $settings['email_label'] : __('Email','wpfnl'); |
| 1878 |
|
| 1879 |
if( 'yes' == $settings['required_mark'] ){ ?> |
| 1880 |
<span class="required-mark">*</span> |
| 1881 |
<?php } ?> |
| 1882 |
</label> |
| 1883 |
<?php } ?> |
| 1884 |
<span class="input-wrapper"> |
| 1885 |
<?php if( 'yes' == $settings['input_fields_icon'] ){ ?> |
| 1886 |
<span class="field-icon"> |
| 1887 |
<img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/email-open-icon.svg'; ?>" alt="icon"> |
| 1888 |
</span> |
| 1889 |
<?php } |
| 1890 |
$email_placeholder = isset($settings['email_placeholder']) ? $settings['email_placeholder'] : ''; |
| 1891 |
?> |
| 1892 |
<input type="email" name="email" class="wpfnl-email" id="wpfnl-email" placeholder="<?php echo $email_placeholder; ?>" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" required /> |
| 1893 |
</span> |
| 1894 |
</div> |
| 1895 |
|
| 1896 |
<?php if( 'yes' == $settings['phone'] ){ ?> |
| 1897 |
<div class="wpfnl-optin-form-group phone"> |
| 1898 |
|
| 1899 |
<?php if( 'yes' == $settings['field_label'] ){ ?> |
| 1900 |
<label for="wpfnl-phone"> |
| 1901 |
<?php |
| 1902 |
echo $settings['phone_label'] ? $settings['phone_label'] : __('Phone','wpfnl'); |
| 1903 |
|
| 1904 |
if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_phone'] ){ ?> |
| 1905 |
<span class="required-mark">*</span> |
| 1906 |
<?php } ?> |
| 1907 |
</label> |
| 1908 |
<?php } ?> |
| 1909 |
|
| 1910 |
<span class="input-wrapper"> |
| 1911 |
<?php if( 'yes' == $settings['input_fields_icon'] ){ ?> |
| 1912 |
<span class="field-icon"> |
| 1913 |
<img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/phone.svg'; ?>" alt="icon"> |
| 1914 |
</span> |
| 1915 |
<?php } |
| 1916 |
$phone_placeholder = isset($settings['phone_placeholder']) ? $settings['phone_placeholder'] : ''; |
| 1917 |
?> |
| 1918 |
<input type="text" name="phone" class="wpfnl-phone" id="wpfnl-phone" placeholder="<?php echo $phone_placeholder; ?>" <?php echo 'yes' == $settings['is_required_phone'] ? 'required' : ''; ?>/> |
| 1919 |
</span> |
| 1920 |
</div> |
| 1921 |
<?php } ?> |
| 1922 |
|
| 1923 |
<?php if( 'yes' == $settings['website_url'] ){ ?> |
| 1924 |
<div class="wpfnl-optin-form-group website-url"> |
| 1925 |
|
| 1926 |
<?php if( 'yes' == $settings['field_label'] ){ ?> |
| 1927 |
<label for="wpfnl-web-url"> |
| 1928 |
<?php |
| 1929 |
echo $settings['website_url_label'] ? $settings['website_url_label'] : __('Website Url','wpfnl'); |
| 1930 |
|
| 1931 |
if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_website_url'] ){ ?> |
| 1932 |
<span class="required-mark">*</span> |
| 1933 |
<?php } ?> |
| 1934 |
</label> |
| 1935 |
<?php } ?> |
| 1936 |
|
| 1937 |
<span class="input-wrapper"> |
| 1938 |
<?php if( 'yes' == $settings['input_fields_icon'] ){ ?> |
| 1939 |
<span class="field-icon"> |
| 1940 |
<img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/web-url.svg'; ?>" alt="icon"> |
| 1941 |
</span> |
| 1942 |
<?php } |
| 1943 |
$weburl_placeholder = isset($settings['website_url_placeholder']) ? $settings['website_url_placeholder'] : ''; |
| 1944 |
?> |
| 1945 |
<input type="text" name="web-url" class="wpfnl-web-url" id="wpfnl-web-url" pattern="(https?://)?.+" size="30" placeholder="<?php echo $weburl_placeholder; ?>" <?php echo 'yes' == $settings['is_required_website_url'] ? 'required' : ''; ?>/> |
| 1946 |
</span> |
| 1947 |
</div> |
| 1948 |
<?php } ?> |
| 1949 |
|
| 1950 |
<?php if( 'yes' == $settings['message'] ){ ?> |
| 1951 |
<div class="wpfnl-optin-form-group message"> |
| 1952 |
|
| 1953 |
<?php if( 'yes' == $settings['field_label'] ){ ?> |
| 1954 |
<label for="wpfnl-message"> |
| 1955 |
<?php |
| 1956 |
echo $settings['message_label'] ? $settings['message_label'] : __('Message','wpfnl'); |
| 1957 |
|
| 1958 |
if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_message'] ){ ?> |
| 1959 |
<span class="required-mark">*</span> |
| 1960 |
<?php } ?> |
| 1961 |
</label> |
| 1962 |
<?php } |
| 1963 |
|
| 1964 |
$message_placeholder = isset($settings['message_placeholder']) ? $settings['message_placeholder'] : ''; |
| 1965 |
?> |
| 1966 |
|
| 1967 |
<span class="input-wrapper"> |
| 1968 |
<textarea name="message" class="wpfnl-message" id="wpfnl-message" cols="30" rows="3" placeholder="<?php echo $message_placeholder; ?>" <?php echo 'yes' == $settings['is_required_message'] ? 'required' : ''; ?> ></textarea> |
| 1969 |
</span> |
| 1970 |
</div> |
| 1971 |
<?php } ?> |
| 1972 |
|
| 1973 |
<?php |
| 1974 |
if( 'yes' == $settings['acceptance_checkbox'] ){ |
| 1975 |
?> |
| 1976 |
<div class="wpfnl-optin-form-group acceptance-checkbox"> |
| 1977 |
<input type="checkbox" name="acceptance_checkbox" class="wpfnl-acceptance_checkbox" id="wpfnl-acceptance_checkbox-<?php echo esc_attr( $this->get_id() ); ?>" <?php echo 'yes' == $settings['is_required_acceptance'] ? 'required' : ''; ?> /> |
| 1978 |
<label for="wpfnl-acceptance_checkbox-<?php echo esc_attr( $this->get_id() ); ?>"> |
| 1979 |
<span class="check-box"></span> |
| 1980 |
<?php |
| 1981 |
echo $settings['acceptance_checkbox_text'] ? $settings['acceptance_checkbox_text'] : ''; |
| 1982 |
|
| 1983 |
if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_acceptance'] ){ |
| 1984 |
echo '<span class="required-mark">*</span>'; |
| 1985 |
} |
| 1986 |
?> |
| 1987 |
</label> |
| 1988 |
</div> |
| 1989 |
<?php |
| 1990 |
} |
| 1991 |
?> |
| 1992 |
|
| 1993 |
<?php |
| 1994 |
if( 'yes' == $settings['allow_registration']){ |
| 1995 |
?> |
| 1996 |
<input type="hidden" name="optin_allow_registration" value="<?php echo esc_attr( 'yes' ); ?>"/> |
| 1997 |
<?php |
| 1998 |
if('yes' == $settings['allow_user_permission']){ |
| 1999 |
?> |
| 2000 |
<div class="wpfnl-optin-form-group user-registration-checkbox"> |
| 2001 |
<input type="checkbox" name="user_registration_checkbox" class="wpfnl-registration_checkbox" id="wpfnl-registration_checkbox-<?php echo esc_attr( $this->get_id() ); ?>" required/> |
| 2002 |
<label for="wpfnl-registration_checkbox-<?php echo esc_attr( $this->get_id() ); ?>"> |
| 2003 |
<span class="check-box"></span> |
| 2004 |
<?php |
| 2005 |
echo $settings['allow_user_registration_permission_text'] ? $settings['allow_user_registration_permission_text'] : ''; |
| 2006 |
?> |
| 2007 |
<span class="required-mark">*</span> |
| 2008 |
</label> |
| 2009 |
</div> |
| 2010 |
<?php |
| 2011 |
} |
| 2012 |
} |
| 2013 |
?> |
| 2014 |
<?php |
| 2015 |
if( 'yes' == $settings['data_to_checkout']){ |
| 2016 |
?> |
| 2017 |
<input type="hidden" name="data_to_checkout" value="<?php echo esc_attr( 'yes' ); ?>"/> |
| 2018 |
<?php |
| 2019 |
} |
| 2020 |
?> |
| 2021 |
|
| 2022 |
<div class="wpfnl-optin-form-group submit align-<?php echo $settings['btn_align'] ?>"> |
| 2023 |
<button type="submit" <?php echo $this->get_render_attribute_string('button'); ?>> |
| 2024 |
<?php $this->render_text(); ?> |
| 2025 |
<span class="wpfnl-loader"></span> |
| 2026 |
</button> |
| 2027 |
</div> |
| 2028 |
</div> |
| 2029 |
</form> |
| 2030 |
|
| 2031 |
<?php |
| 2032 |
if('on' == $is_recaptch && '' != $site_key && '' != $site_secret_key){?> |
| 2033 |
<script> |
| 2034 |
grecaptcha.ready(function() { |
| 2035 |
grecaptcha.execute('<?php echo $site_key ?>', {action: 'homepage'}).then(function(token) { |
| 2036 |
document.getElementById("wpf-optin-g-token").value = token; |
| 2037 |
}); |
| 2038 |
}); |
| 2039 |
</script> |
| 2040 |
<?php |
| 2041 |
} |
| 2042 |
?> |
| 2043 |
<div class="response"></div> |
| 2044 |
</div> |
| 2045 |
<?php |
| 2046 |
} |
| 2047 |
|
| 2048 |
/** |
| 2049 |
* Render button text. |
| 2050 |
* |
| 2051 |
* @since 1.0.0 |
| 2052 |
* @access protected |
| 2053 |
*/ |
| 2054 |
protected function render_text() |
| 2055 |
{ |
| 2056 |
$settings = $this->get_settings(); |
| 2057 |
$migrated = isset($settings['__fa4_migrated']['btn_icon']); |
| 2058 |
$is_new = empty($settings['icon']) && Icons_Manager::is_migration_allowed(); |
| 2059 |
|
| 2060 |
if (!$is_new && empty($settings['btn_icon_align'])) { |
| 2061 |
$settings['btn_icon_align'] = $this->get_settings('btn_icon_align'); |
| 2062 |
} |
| 2063 |
|
| 2064 |
$this->add_render_attribute([ |
| 2065 |
'content-wrapper' => [ |
| 2066 |
'class' => 'elementor-button-content-wrapper', |
| 2067 |
], |
| 2068 |
'icon-align' => [ |
| 2069 |
'class' => [ |
| 2070 |
'elementor-button-icon', |
| 2071 |
'elementor-align-icon-' . $settings['btn_icon_align'], |
| 2072 |
], |
| 2073 |
], |
| 2074 |
'text' => [ |
| 2075 |
'class' => 'elementor-button-text', |
| 2076 |
], |
| 2077 |
]); |
| 2078 |
|
| 2079 |
// $this->add_render_attribute('content-wrapper', 'class', 'elementor-button-content-wrapper'); |
| 2080 |
//$this->add_render_attribute('text', 'class', 'elementor-button-text'); |
| 2081 |
|
| 2082 |
$this->add_inline_editing_attributes('text', 'none'); |
| 2083 |
?> |
| 2084 |
<span <?php echo $this->get_render_attribute_string('content-wrapper'); ?>> |
| 2085 |
|
| 2086 |
<?php if (!empty($settings['icon']) || !empty($settings['btn_icon']['value'])) : ?> |
| 2087 |
<span <?php echo $this->get_render_attribute_string('icon-align'); ?>> |
| 2088 |
<?php if ($is_new || $migrated) : |
| 2089 |
Icons_Manager::render_icon($settings['btn_icon'], ['aria-hidden' => 'true']); |
| 2090 |
else : ?> |
| 2091 |
<i class="<?php echo esc_attr($settings['icon']); ?>" aria-hidden="true"></i> |
| 2092 |
<?php endif; ?> |
| 2093 |
</span> |
| 2094 |
<?php endif; ?> |
| 2095 |
|
| 2096 |
<span <?php echo $this->get_render_attribute_string('text'); ?>><?php echo $settings['btn_text']; ?></span> |
| 2097 |
</span> |
| 2098 |
<?php |
| 2099 |
} |
| 2100 |
|
| 2101 |
/** |
| 2102 |
* Render click to expand button text. |
| 2103 |
* |
| 2104 |
* @since 1.0.0 |
| 2105 |
* @access protected |
| 2106 |
*/ |
| 2107 |
protected function render_clickto_expand_text() |
| 2108 |
{ |
| 2109 |
$settings = $this->get_settings(); |
| 2110 |
$migrated = isset($settings['__fa4_migrated']['clickto_expand_btn_icon']); |
| 2111 |
$is_new = empty($settings['icon']) && Icons_Manager::is_migration_allowed(); |
| 2112 |
|
| 2113 |
if (!$is_new && empty($settings['clickto_expand_btn_icon_align'])) { |
| 2114 |
$settings['clickto_expand_btn_icon_align'] = $this->get_settings('clickto_expand_btn_icon_align'); |
| 2115 |
} |
| 2116 |
|
| 2117 |
$this->add_render_attribute([ |
| 2118 |
'expand-btn-content-wrapper' => [ |
| 2119 |
'class' => 'elementor-button-content-wrapper', |
| 2120 |
], |
| 2121 |
'expand-btn-icon-align' => [ |
| 2122 |
'class' => [ |
| 2123 |
'elementor-button-icon', |
| 2124 |
'elementor-align-icon-' . $settings['clickto_expand_btn_icon_align'], |
| 2125 |
], |
| 2126 |
], |
| 2127 |
'expand-btn-text' => [ |
| 2128 |
'class' => 'elementor-button-text', |
| 2129 |
], |
| 2130 |
]); |
| 2131 |
|
| 2132 |
//$this->add_render_attribute('text', 'class', 'elementor-button-text'); |
| 2133 |
|
| 2134 |
$this->add_inline_editing_attributes('text', 'none'); |
| 2135 |
?> |
| 2136 |
<span <?php echo $this->get_render_attribute_string('expand-btn-content-wrapper'); ?>> |
| 2137 |
|
| 2138 |
<?php if (!empty($settings['icon']) || !empty($settings['clickto_expand_btn_icon']['value'])) : ?> |
| 2139 |
<span <?php echo $this->get_render_attribute_string('expand-btn-icon-align'); ?>> |
| 2140 |
<?php if ($is_new || $migrated) : |
| 2141 |
Icons_Manager::render_icon($settings['clickto_expand_btn_icon'], ['aria-hidden' => 'true']); |
| 2142 |
else : ?> |
| 2143 |
<i class="<?php echo esc_attr($settings['icon']); ?>" aria-hidden="true"></i> |
| 2144 |
<?php endif; ?> |
| 2145 |
</span> |
| 2146 |
<?php endif; ?> |
| 2147 |
|
| 2148 |
<span <?php echo $this->get_render_attribute_string('expand-btn-text'); ?>><?php echo $settings['clickto_expand_btn_text']; ?></span> |
| 2149 |
</span> |
| 2150 |
<?php |
| 2151 |
} |
| 2152 |
} |
| 2153 |
|