| 1 |
<?php |
| 2 |
namespace Easyel\EasyElements\Widgets; |
| 3 |
/** |
| 4 |
* Easy Elements Login Register Widget |
| 5 |
* @package EasyElements |
| 6 |
* @since 1.0.0 |
| 7 |
*/ |
| 8 |
use Elementor\Controls_Manager; |
| 9 |
use Elementor\Widget_Base; |
| 10 |
use Elementor\Group_Control_Typography; |
| 11 |
use Elementor\Group_Control_Border; |
| 12 |
use Elementor\Group_Control_Box_Shadow; |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
/** |
| 18 |
* |
| 19 |
* Handles the login register widget functionality for Elementor. |
| 20 |
*/ |
| 21 |
class Easyel_Login_Register_Widget extends \Elementor\Widget_Base { |
| 22 |
|
| 23 |
/** |
| 24 |
* Get widget style dependencies |
| 25 |
* |
| 26 |
* Loads the CSS file for the widget styling |
| 27 |
* |
| 28 |
* @return array Array of style handles |
| 29 |
*/ |
| 30 |
/** |
| 31 |
* Get widget name |
| 32 |
* |
| 33 |
* @return string Widget name |
| 34 |
*/ |
| 35 |
public function get_name() { |
| 36 |
return 'eel-login-register'; |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Get widget title |
| 41 |
* |
| 42 |
* @return string Widget title |
| 43 |
*/ |
| 44 |
public function get_title() { |
| 45 |
return __( 'Login / Register', 'easy-elements' ); |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Get widget icon |
| 50 |
* |
| 51 |
* @return string Widget icon |
| 52 |
*/ |
| 53 |
public function get_icon() { |
| 54 |
return 'easyicon easyelIcon-login'; |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Get widget categories |
| 59 |
* |
| 60 |
* @return array Widget categories |
| 61 |
*/ |
| 62 |
public function get_categories() { |
| 63 |
return [ 'easyelements_category' ]; |
| 64 |
} |
| 65 |
|
| 66 |
public function get_keywords() { |
| 67 |
return [ 'login', 'register', 'from', 'text', 'form' ]; |
| 68 |
} |
| 69 |
|
| 70 |
public function get_style_depends() { |
| 71 |
return [ |
| 72 |
'eel-login-register', |
| 73 |
]; |
| 74 |
} |
| 75 |
|
| 76 |
public function get_script_depends() { |
| 77 |
return [ |
| 78 |
'eel-login-register', |
| 79 |
]; |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
/** |
| 84 |
* Register widget controls |
| 85 |
* |
| 86 |
* Defines all the controls for the widget |
| 87 |
*/ |
| 88 |
protected function register_controls() { |
| 89 |
global $wp_roles; |
| 90 |
$role_options = $wp_roles->get_names(); |
| 91 |
// ======================================== |
| 92 |
// CONTENT SECTION - Form Settings |
| 93 |
// ======================================== |
| 94 |
$this->start_controls_section( |
| 95 |
'content_section', |
| 96 |
[ |
| 97 |
'label' => esc_html__( 'Form', 'easy-elements' ), |
| 98 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 99 |
] |
| 100 |
); |
| 101 |
|
| 102 |
$this->add_control( |
| 103 |
'form_type', |
| 104 |
[ |
| 105 |
'label' => esc_html__( 'Type', 'easy-elements' ), |
| 106 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 107 |
'default' => 'login', |
| 108 |
'options' => [ |
| 109 |
'login' => esc_html__( 'Login', 'easy-elements' ), |
| 110 |
'register' => esc_html__( 'Register', 'easy-elements' ), |
| 111 |
'both' => esc_html__( 'Both', 'easy-elements' ), |
| 112 |
], |
| 113 |
] |
| 114 |
); |
| 115 |
$this->add_control( |
| 116 |
'redirect_link_after_login', |
| 117 |
[ |
| 118 |
'label' => esc_html__( 'Redirect Link After Login', 'easy-elements' ), |
| 119 |
'type' => \Elementor\Controls_Manager::URL, |
| 120 |
'options' => [ 'url', 'is_external', 'nofollow' ], |
| 121 |
'default' => [ |
| 122 |
'url' => home_url(), |
| 123 |
'is_external' => true, |
| 124 |
'nofollow' => true, |
| 125 |
], |
| 126 |
'label_block' => true, |
| 127 |
'condition' => [ |
| 128 |
'form_type' => ['login', 'both'], |
| 129 |
], |
| 130 |
] |
| 131 |
); |
| 132 |
|
| 133 |
|
| 134 |
$this->add_control( |
| 135 |
'role', |
| 136 |
[ |
| 137 |
'label' => 'Role', |
| 138 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 139 |
'options' => $role_options, |
| 140 |
'multiple' => false, |
| 141 |
'default' => 'subscriber' |
| 142 |
] |
| 143 |
); |
| 144 |
|
| 145 |
$this->add_control( |
| 146 |
'auto_login_after_registration', |
| 147 |
[ |
| 148 |
'label' => esc_html__( 'Auto Login After Registration', 'easy-elements' ), |
| 149 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 150 |
'label_on' => esc_html__( 'Yes', 'easy-elements' ), |
| 151 |
'label_off' => esc_html__( 'No', 'easy-elements' ), |
| 152 |
'return_value' => 'yes', |
| 153 |
'default' => 'yes', |
| 154 |
'condition' => [ |
| 155 |
'form_type' => ['register', 'both'], |
| 156 |
], |
| 157 |
] |
| 158 |
); |
| 159 |
$this->add_control( |
| 160 |
'redirect_after_registration', |
| 161 |
[ |
| 162 |
'label' => esc_html__( 'Redirect After Logout', 'easy-elements' ), |
| 163 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 164 |
'label_on' => esc_html__( 'Yes', 'easy-elements' ), |
| 165 |
'label_off' => esc_html__( 'No', 'easy-elements' ), |
| 166 |
'return_value' => 'yes', |
| 167 |
'default' => 'yes', |
| 168 |
'condition' => [ |
| 169 |
'form_type' => ['register', 'both'], |
| 170 |
], |
| 171 |
] |
| 172 |
); |
| 173 |
$this->add_control( |
| 174 |
'redirect_link_after_registration', |
| 175 |
[ |
| 176 |
'label' => esc_html__( 'Redirect Link After Registration', 'easy-elements' ), |
| 177 |
'type' => \Elementor\Controls_Manager::URL, |
| 178 |
'options' => [ 'url', 'is_external', 'nofollow' ], |
| 179 |
'default' => [ |
| 180 |
'url' => home_url(), |
| 181 |
'is_external' => true, |
| 182 |
'nofollow' => true, |
| 183 |
// 'custom_attributes' => '', |
| 184 |
], |
| 185 |
'label_block' => true, |
| 186 |
'condition' => [ |
| 187 |
'form_type' => ['register', 'both'], |
| 188 |
], |
| 189 |
] |
| 190 |
); |
| 191 |
|
| 192 |
$this->add_control( |
| 193 |
'show_password_reset_link', |
| 194 |
[ |
| 195 |
'label' => esc_html__( 'Show Password Reset Link', 'easy-elements' ), |
| 196 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 197 |
'label_on' => esc_html__( 'Show', 'easy-elements' ), |
| 198 |
'label_off' => esc_html__( 'Hide', 'easy-elements' ), |
| 199 |
'return_value' => 'yes', |
| 200 |
'default' => 'yes', |
| 201 |
'condition' => [ |
| 202 |
'form_type' => ['login', 'both'], |
| 203 |
], |
| 204 |
] |
| 205 |
); |
| 206 |
$this->add_control( |
| 207 |
'remember_me', |
| 208 |
[ |
| 209 |
'label' => esc_html__( 'Show Remember Me', 'easy-elements' ), |
| 210 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 211 |
'label_on' => esc_html__( 'Show', 'easy-elements' ), |
| 212 |
'label_off' => esc_html__( 'Hide', 'easy-elements' ), |
| 213 |
'return_value' => 'yes', |
| 214 |
'default' => 'yes', |
| 215 |
'condition' => [ |
| 216 |
'form_type' => ['login', 'both'], |
| 217 |
], |
| 218 |
] |
| 219 |
); |
| 220 |
$this->add_control( |
| 221 |
'show_ajax_loader', |
| 222 |
[ |
| 223 |
'label' => esc_html__( 'Show Ajax Loader', 'easy-elements' ), |
| 224 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 225 |
'label_on' => esc_html__( 'Show', 'easy-elements' ), |
| 226 |
'label_off' => esc_html__( 'Hide', 'easy-elements' ), |
| 227 |
'return_value' => 'yes', |
| 228 |
'default' => 'yes', |
| 229 |
] |
| 230 |
); |
| 231 |
$this->end_controls_section(); |
| 232 |
|
| 233 |
|
| 234 |
// ======================================== |
| 235 |
// CONTENT SECTION - Fields Settings |
| 236 |
// ======================================== |
| 237 |
$this->start_controls_section( |
| 238 |
'fields_section', |
| 239 |
[ |
| 240 |
'label' => esc_html__( 'Fields', 'easy-elements' ), |
| 241 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 242 |
] |
| 243 |
); |
| 244 |
|
| 245 |
$this->add_control( |
| 246 |
'login_fields', |
| 247 |
[ |
| 248 |
'label' => esc_html__( 'Login Fields', 'easy-elements' ), |
| 249 |
'type' => Controls_Manager::REPEATER, |
| 250 |
'fields' => [ |
| 251 |
// Type Field |
| 252 |
[ |
| 253 |
'name' => 'type', |
| 254 |
'label' => esc_html__( 'Type', 'easy-elements' ), |
| 255 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 256 |
'default' => 'username', |
| 257 |
'options' => [ |
| 258 |
'username' => esc_html__( 'Username', 'easy-elements' ), |
| 259 |
'password' => esc_html__( 'Password', 'easy-elements' ), |
| 260 |
'static_text' => esc_html__( 'Static Text', 'easy-elements' ), |
| 261 |
], |
| 262 |
], |
| 263 |
// Label Field |
| 264 |
[ |
| 265 |
'name' => 'label', |
| 266 |
'label' => esc_html__( 'Label', 'easy-elements' ), |
| 267 |
'type' => Controls_Manager::TEXT, |
| 268 |
'condition' => [ |
| 269 |
'type!' => 'static_text', |
| 270 |
], |
| 271 |
], |
| 272 |
// Placeholder Field |
| 273 |
[ |
| 274 |
'name' => 'placeholder', |
| 275 |
'label' => esc_html__( 'Placeholder', 'easy-elements' ), |
| 276 |
'type' => Controls_Manager::TEXT, |
| 277 |
'condition' => [ |
| 278 |
'type!' => 'static_text', |
| 279 |
], |
| 280 |
], |
| 281 |
// Icon Field |
| 282 |
[ |
| 283 |
'name' => 'icon', |
| 284 |
'label' => esc_html__( 'Icon', 'easy-elements' ), |
| 285 |
'type' => Controls_Manager::ICONS, |
| 286 |
'condition' => [ |
| 287 |
'type!' => 'static_text', |
| 288 |
], |
| 289 |
], |
| 290 |
[ |
| 291 |
'name' => 'is_required', |
| 292 |
'label' => esc_html__( 'Is Required', 'easy-elements' ), |
| 293 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 294 |
'label_on' => esc_html__( 'Yes', 'easy-elements' ), |
| 295 |
'label_off' => esc_html__( 'No', 'easy-elements' ), |
| 296 |
'return_value' => 'yes', |
| 297 |
'default' => 'yes', |
| 298 |
'condition' => [ |
| 299 |
'type!' => 'static_text', |
| 300 |
], |
| 301 |
], |
| 302 |
[ |
| 303 |
'name' => 'static_text', |
| 304 |
'label' => esc_html__('Static Text', 'easy-elements'), |
| 305 |
'type' => Controls_Manager::WYSIWYG, |
| 306 |
'label_block' => true, |
| 307 |
'default' => esc_html__("This is static field.", "easy-elements"), |
| 308 |
'dynamic' => [ |
| 309 |
'active' => true, |
| 310 |
], |
| 311 |
'condition' => [ |
| 312 |
'type' => 'static_text', |
| 313 |
], |
| 314 |
] |
| 315 |
], |
| 316 |
|
| 317 |
// Default register fields |
| 318 |
'default' => [ |
| 319 |
[ |
| 320 |
'type' => 'username', |
| 321 |
'label' => esc_html__( 'Username', 'easy-elements' ), |
| 322 |
'placeholder' => esc_html__( 'Username', 'easy-elements' ), |
| 323 |
'is_required' => 'yes', |
| 324 |
], |
| 325 |
[ |
| 326 |
'type' => 'password', |
| 327 |
'label' => esc_html__( 'Password', 'easy-elements' ), |
| 328 |
'placeholder' => esc_html__( 'Password', 'easy-elements' ), |
| 329 |
'is_required' => 'yes', |
| 330 |
], |
| 331 |
], |
| 332 |
'title_field' => '{{{ type }}}', |
| 333 |
'condition' => [ |
| 334 |
'form_type' => ['login', 'both'], |
| 335 |
], |
| 336 |
] |
| 337 |
); |
| 338 |
|
| 339 |
$this->add_control( |
| 340 |
'register_fields', |
| 341 |
[ |
| 342 |
'label' => esc_html__( 'Register Fields', 'easy-elements' ), |
| 343 |
'type' => Controls_Manager::REPEATER, |
| 344 |
'fields' => [ |
| 345 |
// Type Field |
| 346 |
[ |
| 347 |
'name' => 'type', |
| 348 |
'label' => esc_html__( 'Type', 'easy-elements' ), |
| 349 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 350 |
'default' => 'username', |
| 351 |
'options' => [ |
| 352 |
'user_login' => esc_html__( 'Username', 'easy-elements' ), |
| 353 |
'user_email' => esc_html__( 'Email', 'easy-elements' ), |
| 354 |
'user_pass' => esc_html__( 'Password', 'easy-elements' ), |
| 355 |
'confirm_password' => esc_html__( 'Confirm Password', 'easy-elements' ), |
| 356 |
'first_name' => esc_html__( 'First Name', 'easy-elements' ), |
| 357 |
'last_name' => esc_html__( 'Last Name', 'easy-elements' ), |
| 358 |
'display_name' => esc_html__( 'Display Name', 'easy-elements' ), |
| 359 |
'user_nicename' => esc_html__( 'Nice Name', 'easy-elements' ), |
| 360 |
'nickname ' => esc_html__( 'Nice Name', 'easy-elements' ), |
| 361 |
'user_url' => esc_html__( 'Website', 'easy-elements' ), |
| 362 |
'description' => esc_html__( 'Description', 'easy-elements' ), |
| 363 |
'consent' => esc_html__( 'Consent', 'easy-elements' ), |
| 364 |
'custom' => esc_html__( 'Custom', 'easy-elements' ), |
| 365 |
'static_text' => esc_html__( 'Static Text', 'easy-elements' ), |
| 366 |
], |
| 367 |
], |
| 368 |
// Custom User Meta Key Field |
| 369 |
[ |
| 370 |
'name' => 'meta_key', |
| 371 |
'label' => esc_html__( 'Meta Key', 'easy-elements' ), |
| 372 |
'type' => Controls_Manager::TEXT, |
| 373 |
'condition' => [ |
| 374 |
'type' => 'custom', |
| 375 |
], |
| 376 |
], |
| 377 |
// Label Field |
| 378 |
[ |
| 379 |
'name' => 'label', |
| 380 |
'label' => esc_html__( 'Label', 'easy-elements' ), |
| 381 |
'type' => Controls_Manager::TEXT, |
| 382 |
'condition' => [ |
| 383 |
'type!' => 'static_text', |
| 384 |
], |
| 385 |
], |
| 386 |
// Placeholder Field |
| 387 |
[ |
| 388 |
'name' => 'placeholder', |
| 389 |
'label' => esc_html__( 'Placeholder', 'easy-elements' ), |
| 390 |
'type' => Controls_Manager::TEXT, |
| 391 |
'condition' => [ |
| 392 |
'type!' => 'static_text', |
| 393 |
], |
| 394 |
], |
| 395 |
// Icon Field |
| 396 |
[ |
| 397 |
'name' => 'icon', |
| 398 |
'label' => esc_html__( 'Icon', 'easy-elements' ), |
| 399 |
'type' => Controls_Manager::ICONS, |
| 400 |
'condition' => [ |
| 401 |
'type!' => 'static_text', |
| 402 |
], |
| 403 |
], |
| 404 |
[ |
| 405 |
'name' => 'min_length', |
| 406 |
'label' => esc_html__( 'Min Length', 'easy-elements' ), |
| 407 |
'type' => Controls_Manager::NUMBER, |
| 408 |
'condition' => [ |
| 409 |
'type!' => 'static_text', |
| 410 |
], |
| 411 |
], |
| 412 |
[ |
| 413 |
'name' => 'max_length', |
| 414 |
'label' => esc_html__( 'Max Length', 'easy-elements' ), |
| 415 |
'type' => Controls_Manager::NUMBER, |
| 416 |
'condition' => [ |
| 417 |
'type!' => 'static_text', |
| 418 |
], |
| 419 |
], |
| 420 |
[ |
| 421 |
'name' => 'is_required', |
| 422 |
'label' => esc_html__( 'Is Required', 'easy-elements' ), |
| 423 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 424 |
'label_on' => esc_html__( 'Yes', 'easy-elements' ), |
| 425 |
'label_off' => esc_html__( 'No', 'easy-elements' ), |
| 426 |
'return_value' => 'yes', |
| 427 |
'default' => 'yes', |
| 428 |
'condition' => [ |
| 429 |
'type!' => 'static_text', |
| 430 |
], |
| 431 |
], |
| 432 |
[ |
| 433 |
'name' => 'static_text', |
| 434 |
'label' => esc_html__('Static Text', 'easy-elements'), |
| 435 |
'type' => Controls_Manager::WYSIWYG, |
| 436 |
'label_block' => true, |
| 437 |
'default' => esc_html__("Don't have account? Sign Up", "easy-elements"), |
| 438 |
'dynamic' => [ |
| 439 |
'active' => true, |
| 440 |
], |
| 441 |
'condition' => [ |
| 442 |
'type' => 'static_text', |
| 443 |
], |
| 444 |
], |
| 445 |
[ |
| 446 |
'name' => 'width', |
| 447 |
'label' => esc_html__('Width', 'easy-elements'), |
| 448 |
'type' => Controls_Manager::SLIDER, |
| 449 |
'size_units' => ['px', '%', 'em'], |
| 450 |
'range' => [ |
| 451 |
'px' => [ |
| 452 |
'min' => 10, |
| 453 |
'max' => 50, |
| 454 |
], |
| 455 |
'em' => [ |
| 456 |
'min' => 0.5, |
| 457 |
'max' => 10, |
| 458 |
], |
| 459 |
'%' => [ |
| 460 |
'min' => 2, |
| 461 |
'max' => 100, |
| 462 |
], |
| 463 |
], |
| 464 |
'default' => [ |
| 465 |
'unit' => '%', |
| 466 |
], |
| 467 |
] |
| 468 |
], |
| 469 |
|
| 470 |
// Default register fields |
| 471 |
'default' => [ |
| 472 |
[ |
| 473 |
'type' => 'user_login', |
| 474 |
'label' => esc_html__( 'Username', 'easy-elements' ), |
| 475 |
'placeholder' => esc_html__( 'Username', 'easy-elements' ), |
| 476 |
'is_required' => 'yes', |
| 477 |
], |
| 478 |
[ |
| 479 |
'type' => 'user_email', |
| 480 |
'label' => esc_html__( 'Email', 'easy-elements' ), |
| 481 |
'placeholder' => esc_html__( 'Email', 'easy-elements' ), |
| 482 |
'is_required' => 'yes', |
| 483 |
], |
| 484 |
[ |
| 485 |
'type' => 'user_pass', |
| 486 |
'label' => esc_html__( 'Password', 'easy-elements' ), |
| 487 |
'placeholder' => esc_html__( 'Password', 'easy-elements' ), |
| 488 |
'is_required' => 'yes', |
| 489 |
'min_length' => 8, |
| 490 |
], |
| 491 |
], |
| 492 |
'title_field' => '{{{ type }}}', |
| 493 |
'condition' => [ |
| 494 |
'form_type' => ['register', 'both'], |
| 495 |
], |
| 496 |
] |
| 497 |
); |
| 498 |
|
| 499 |
$this->add_control( |
| 500 |
'show_label', |
| 501 |
[ |
| 502 |
'label' => esc_html__( 'Show Label', 'easy-elements' ), |
| 503 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 504 |
'label_on' => esc_html__( 'Show', 'easy-elements' ), |
| 505 |
'label_off' => esc_html__( 'Hide', 'easy-elements' ), |
| 506 |
'return_value' => 'yes', |
| 507 |
'default' => 'yes', |
| 508 |
'condition' => [ |
| 509 |
'show_icon!' => 'yes', |
| 510 |
], |
| 511 |
] |
| 512 |
); |
| 513 |
$this->add_control( |
| 514 |
'show_icon', |
| 515 |
[ |
| 516 |
'label' => esc_html__( 'Show Icon', 'easy-elements' ), |
| 517 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 518 |
'label_on' => esc_html__( 'Show', 'easy-elements' ), |
| 519 |
'label_off' => esc_html__( 'Hide', 'easy-elements' ), |
| 520 |
'return_value' => 'yes', |
| 521 |
'description' => esc_html__( 'Enable this option to display an icon field inside the repeater items.', 'easy-elements' ), |
| 522 |
] |
| 523 |
); |
| 524 |
|
| 525 |
$this->add_control( |
| 526 |
'login_fields_labels', |
| 527 |
[ |
| 528 |
'label' => esc_html__( 'Labels', 'easy-elements' ), |
| 529 |
'type' => \Elementor\Controls_Manager::HEADING, |
| 530 |
'separator' => 'before', |
| 531 |
'condition' => [ |
| 532 |
'form_type' => ['login', 'both'], |
| 533 |
], |
| 534 |
] |
| 535 |
); |
| 536 |
$this->add_control( |
| 537 |
'password_reset_text', |
| 538 |
[ |
| 539 |
'label' => esc_html__( 'Password Reset Text', 'easy-elements' ), |
| 540 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 541 |
'label_block' => true, |
| 542 |
'default' => esc_html__( 'Forgot your password?', 'easy-elements' ), |
| 543 |
'placeholder' => esc_html__( 'Type your text here', 'easy-elements' ), |
| 544 |
'condition' => [ |
| 545 |
'form_type' => ['login', 'both'], |
| 546 |
'show_password_reset_link' => ['yes'], |
| 547 |
], |
| 548 |
] |
| 549 |
); |
| 550 |
$this->add_control( |
| 551 |
'remember_label_text', |
| 552 |
[ |
| 553 |
'label' => esc_html__('Remember', 'easy-elements'), |
| 554 |
'type' => Controls_Manager::TEXT, |
| 555 |
'label_block' => true, |
| 556 |
'default' => esc_html__('Remember Me', 'easy-elements'), |
| 557 |
'placeholder' => esc_html__('Enter text here', 'easy-elements'), |
| 558 |
'dynamic' => [ |
| 559 |
'active' => true, |
| 560 |
], |
| 561 |
'condition' => [ |
| 562 |
'form_type' => ['login', 'both'], |
| 563 |
], |
| 564 |
] |
| 565 |
); |
| 566 |
$this->add_control( |
| 567 |
'cta_text', |
| 568 |
[ |
| 569 |
'label' => esc_html__('Text', 'easy-elements'), |
| 570 |
'type' => Controls_Manager::WYSIWYG, |
| 571 |
'label_block' => true, |
| 572 |
'default' => esc_html__("Don't have account? Sign Up", "easy-elements"), |
| 573 |
'dynamic' => [ |
| 574 |
'active' => true, |
| 575 |
], |
| 576 |
] |
| 577 |
); |
| 578 |
$this->end_controls_section(); |
| 579 |
|
| 580 |
|
| 581 |
// ======================================== |
| 582 |
// CONTENT SECTION - Submit Button |
| 583 |
// ======================================== |
| 584 |
$this->start_controls_section( |
| 585 |
'submit_button_section', |
| 586 |
[ |
| 587 |
'label' => esc_html__( 'Submit', 'easy-elements' ), |
| 588 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 589 |
] |
| 590 |
); |
| 591 |
$this->add_control( |
| 592 |
'submit_button_text', |
| 593 |
[ |
| 594 |
'label' => esc_html__('Text', 'easy-elements'), |
| 595 |
'type' => Controls_Manager::TEXT, |
| 596 |
'label_block' => true, |
| 597 |
'default' => esc_html__('Log In', 'easy-elements'), |
| 598 |
'placeholder' => esc_html__('Enter text here', 'easy-elements'), |
| 599 |
'dynamic' => [ |
| 600 |
'active' => true, |
| 601 |
], |
| 602 |
] |
| 603 |
); |
| 604 |
|
| 605 |
$this->add_control( |
| 606 |
'submit_button_icon', |
| 607 |
[ |
| 608 |
'label' => esc_html__('Icon', 'easy-elements'), |
| 609 |
'type' => Controls_Manager::ICONS, |
| 610 |
'default' => [ |
| 611 |
'value' => '', |
| 612 |
'library' => '', |
| 613 |
], |
| 614 |
] |
| 615 |
); |
| 616 |
|
| 617 |
$this->add_control( |
| 618 |
'submit_button_icon_position', |
| 619 |
[ |
| 620 |
'label' => esc_html__('Icon Position', 'easy-elements'), |
| 621 |
'type' => Controls_Manager::SELECT, |
| 622 |
'default' => 'after', |
| 623 |
'options' => [ |
| 624 |
'before' => esc_html__('Before Text', 'easy-elements'), |
| 625 |
'after' => esc_html__('After Text', 'easy-elements'), |
| 626 |
], |
| 627 |
'condition' => [ |
| 628 |
'submit_button_icon[value]!' => '', |
| 629 |
], |
| 630 |
] |
| 631 |
); |
| 632 |
$this->end_controls_section(); |
| 633 |
|
| 634 |
|
| 635 |
// ======================================== |
| 636 |
// CONTENT SECTION - Message |
| 637 |
// ======================================== |
| 638 |
$this->start_controls_section( |
| 639 |
'message_section', |
| 640 |
[ |
| 641 |
'label' => esc_html__( 'Message', 'easy-elements' ), |
| 642 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 643 |
] |
| 644 |
); |
| 645 |
$this->add_control( |
| 646 |
'show_success_message', |
| 647 |
[ |
| 648 |
'label' => esc_html__( 'Show Success Message', 'easy-elements' ), |
| 649 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 650 |
'label_on' => esc_html__( 'Show', 'easy-elements' ), |
| 651 |
'label_off' => esc_html__( 'Hide', 'easy-elements' ), |
| 652 |
'return_value' => 'yes', |
| 653 |
'default' => 'yes', |
| 654 |
] |
| 655 |
); |
| 656 |
$this->add_control( |
| 657 |
'login_success_message', |
| 658 |
[ |
| 659 |
'label' => esc_html__( 'Login Succeess Message', 'easy-elements' ), |
| 660 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 661 |
'label_block' => true, |
| 662 |
'default' => esc_html__( 'Login Success!', 'easy-elements' ), |
| 663 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 664 |
'condition' => [ |
| 665 |
'form_type' => ['login', 'both'], |
| 666 |
'show_success_message' => ['yes'], |
| 667 |
], |
| 668 |
] |
| 669 |
); |
| 670 |
$this->add_control( |
| 671 |
'register_success_message', |
| 672 |
[ |
| 673 |
'label' => esc_html__( 'Register Succeess Message', 'easy-elements' ), |
| 674 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 675 |
'label_block' => true, |
| 676 |
'default' => esc_html__( 'Registration Success!', 'easy-elements' ), |
| 677 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 678 |
'condition' => [ |
| 679 |
'form_type' => ['register', 'both'], |
| 680 |
'show_success_message' => ['yes'], |
| 681 |
], |
| 682 |
] |
| 683 |
); |
| 684 |
$this->add_control( |
| 685 |
'show_error_message', |
| 686 |
[ |
| 687 |
'label' => esc_html__( 'Show Failed Message', 'easy-elements' ), |
| 688 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 689 |
'label_on' => esc_html__( 'Show', 'easy-elements' ), |
| 690 |
'label_off' => esc_html__( 'Hide', 'easy-elements' ), |
| 691 |
'return_value' => 'yes', |
| 692 |
'default' => 'yes', |
| 693 |
] |
| 694 |
); |
| 695 |
$this->add_control( |
| 696 |
'login_error_message', |
| 697 |
[ |
| 698 |
'label' => esc_html__( 'Login Failed Message', 'easy-elements' ), |
| 699 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 700 |
'label_block' => true, |
| 701 |
'default' => esc_html__( 'Login failed! Enter correct email & password.', 'easy-elements' ), |
| 702 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 703 |
'condition' => [ |
| 704 |
'form_type' => ['login', 'both'], |
| 705 |
'show_error_message' => ['yes'], |
| 706 |
], |
| 707 |
] |
| 708 |
); |
| 709 |
$this->add_control( |
| 710 |
'register_error_message', |
| 711 |
[ |
| 712 |
'label' => esc_html__( 'Register Failed Message', 'easy-elements' ), |
| 713 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 714 |
'label_block' => true, |
| 715 |
'default' => esc_html__( 'Registration Failed!', 'easy-elements' ), |
| 716 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 717 |
'condition' => [ |
| 718 |
'form_type' => ['register', 'both'], |
| 719 |
'show_error_message' => ['yes'], |
| 720 |
], |
| 721 |
] |
| 722 |
); |
| 723 |
$this->add_control( |
| 724 |
'already_logged_in_message', |
| 725 |
[ |
| 726 |
'label' => esc_html__( 'Already logged in Message', 'easy-elements' ), |
| 727 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 728 |
'label_block' => true, |
| 729 |
'default' => esc_html__( 'You are already logged in. Goto Homepage', 'easy-elements' ), |
| 730 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 731 |
] |
| 732 |
); |
| 733 |
$this->add_control( |
| 734 |
'empty_error_message', |
| 735 |
[ |
| 736 |
'label' => esc_html__( 'Empty Message', 'easy-elements' ), |
| 737 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 738 |
'label_block' => true, |
| 739 |
'default' => esc_html__( 'This field is required.', 'easy-elements' ), |
| 740 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 741 |
] |
| 742 |
); |
| 743 |
$this->add_control( |
| 744 |
'confirm_pass_error_message', |
| 745 |
[ |
| 746 |
'label' => esc_html__( 'Confirm Passowrd Error Message', 'easy-elements' ), |
| 747 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 748 |
'label_block' => true, |
| 749 |
'default' => esc_html__( 'Confirm passowrd not matched', 'easy-elements' ), |
| 750 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 751 |
] |
| 752 |
); |
| 753 |
$this->add_control( |
| 754 |
'min_length_error_message', |
| 755 |
[ |
| 756 |
'label' => esc_html__( 'Minimum Characters Error Message', 'easy-elements' ), |
| 757 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 758 |
'label_block' => true, |
| 759 |
'default' => esc_html__( 'Minimum {count} characters required.', 'easy-elements' ), |
| 760 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 761 |
] |
| 762 |
); |
| 763 |
$this->add_control( |
| 764 |
'max_length_error_message', |
| 765 |
[ |
| 766 |
'label' => esc_html__( 'Maximum Characters Error Message', 'easy-elements' ), |
| 767 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 768 |
'label_block' => true, |
| 769 |
'default' => esc_html__( 'Maximum {count} characters required.', 'easy-elements' ), |
| 770 |
'placeholder' => esc_html__( 'Type your message here', 'easy-elements' ), |
| 771 |
] |
| 772 |
); |
| 773 |
$this->end_controls_section(); |
| 774 |
|
| 775 |
// ======================================== |
| 776 |
// STYLE SECTION - Fields Style |
| 777 |
// ======================================== |
| 778 |
$this->start_controls_section( |
| 779 |
'form_fileds_style_section', |
| 780 |
[ |
| 781 |
'label' => esc_html__( 'Fields', 'easy-elements' ), |
| 782 |
'tab' => Controls_Manager::TAB_STYLE, |
| 783 |
] |
| 784 |
); |
| 785 |
|
| 786 |
$this->add_control( |
| 787 |
'field_input_color', |
| 788 |
[ |
| 789 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 790 |
'type' => Controls_Manager::COLOR, |
| 791 |
'selectors' => [ |
| 792 |
'{{WRAPPER}} .eel-form-control' => 'color: {{VALUE}};', |
| 793 |
], |
| 794 |
'separator' => 'before', |
| 795 |
] |
| 796 |
); |
| 797 |
$this->add_control( |
| 798 |
'field_input_color_placeholder', |
| 799 |
[ |
| 800 |
'label' => esc_html__( 'Placeholder Color', 'easy-elements' ), |
| 801 |
'type' => Controls_Manager::COLOR, |
| 802 |
'selectors' => [ |
| 803 |
'{{WRAPPER}} .eel-form-control::placeholder' => 'color: {{VALUE}};', |
| 804 |
], |
| 805 |
] |
| 806 |
); |
| 807 |
|
| 808 |
$this->add_control( |
| 809 |
'field_wrapper_background_color', |
| 810 |
[ |
| 811 |
'label' => esc_html__( 'Background Color', 'easy-elements' ), |
| 812 |
'type' => Controls_Manager::COLOR, |
| 813 |
'selectors' => [ |
| 814 |
'{{WRAPPER}} .eel-form-control, {{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner' => 'background-color: {{VALUE}};', |
| 815 |
], |
| 816 |
] |
| 817 |
); |
| 818 |
|
| 819 |
$this->add_group_control( |
| 820 |
\Elementor\Group_Control_Typography::get_type(), |
| 821 |
[ |
| 822 |
'name' => 'input_text_typography', |
| 823 |
'selector' => '{{WRAPPER}} .eel-authentication-form .eel-form-control', |
| 824 |
] |
| 825 |
); |
| 826 |
|
| 827 |
$this->add_control( |
| 828 |
'field_wrapper_padding', |
| 829 |
[ |
| 830 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 831 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 832 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 833 |
'selectors' => [ |
| 834 |
'{{WRAPPER}} .eel-authentication-form .eel-authentication-form-field-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 835 |
], |
| 836 |
] |
| 837 |
); |
| 838 |
|
| 839 |
$this->add_control( |
| 840 |
'input_margin', |
| 841 |
[ |
| 842 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 843 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 844 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 845 |
'selectors' => [ |
| 846 |
'{{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 847 |
], |
| 848 |
] |
| 849 |
); |
| 850 |
|
| 851 |
$this->add_control( |
| 852 |
'input_border_radius', |
| 853 |
[ |
| 854 |
'label' => esc_html__( 'Border Radius', 'easy-elements' ), |
| 855 |
'type' => Controls_Manager::DIMENSIONS, |
| 856 |
'size_units' => [ 'px', '%' ], |
| 857 |
'selectors' => [ |
| 858 |
'{{WRAPPER}} form:not(.eel-input-has-icon) .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-form-control, {{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 859 |
], |
| 860 |
] |
| 861 |
); |
| 862 |
|
| 863 |
$this->add_group_control( |
| 864 |
\Elementor\Group_Control_Border::get_type(), |
| 865 |
[ |
| 866 |
'name' => 'field_wrapper_border', |
| 867 |
'selector' => '{{WRAPPER}} form:not(.eel-input-has-icon) .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-form-control, {{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner', |
| 868 |
] |
| 869 |
); |
| 870 |
|
| 871 |
$this->add_group_control( |
| 872 |
\Elementor\Group_Control_Box_Shadow::get_type(), |
| 873 |
[ |
| 874 |
'name' => 'field_wrapper_box_shadow', |
| 875 |
'selector' => '{{WRAPPER}} form:not(.eel-input-has-icon) .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-form-control, {{WRAPPER}} .eel-input-has-icon .eel-authentication-form-field:not(.eel-authentication-form-submit-field, {{WRAPPER}} .eel-authentication-form-cta-field) .eel-authentication-form-field-inner', |
| 876 |
] |
| 877 |
); |
| 878 |
|
| 879 |
$this->add_control( |
| 880 |
'field_icon_styles', |
| 881 |
[ |
| 882 |
'label' => esc_html__( 'Icons', 'easy-elements' ), |
| 883 |
'type' => \Elementor\Controls_Manager::HEADING, |
| 884 |
'separator' => 'before', |
| 885 |
'condition' => [ |
| 886 |
'show_icon' => ['yes'], |
| 887 |
], |
| 888 |
] |
| 889 |
); |
| 890 |
|
| 891 |
$this->add_control( |
| 892 |
'icon_color', |
| 893 |
[ |
| 894 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 895 |
'type' => Controls_Manager::COLOR, |
| 896 |
'selectors' => [ |
| 897 |
'{{WRAPPER}} .eel-authentication-form .eel-form-field-icon' => 'color: {{VALUE}};', |
| 898 |
'{{WRAPPER}} .eel-authentication-form .eel-form-field-icon svg' => 'fill: {{VALUE}};', |
| 899 |
], |
| 900 |
'condition' => [ |
| 901 |
'show_icon' => ['yes'], |
| 902 |
], |
| 903 |
] |
| 904 |
); |
| 905 |
$this->add_responsive_control( |
| 906 |
'icon_size', |
| 907 |
[ |
| 908 |
'label' => esc_html__('Icon Size', 'easy-elements'), |
| 909 |
'type' => Controls_Manager::SLIDER, |
| 910 |
'size_units' => ['px'], |
| 911 |
'range' => [ |
| 912 |
'px' => [ |
| 913 |
'min' => 6, |
| 914 |
'max' => 50, |
| 915 |
], |
| 916 |
'em' => [ |
| 917 |
'min' => 0.5, |
| 918 |
'max' => 10, |
| 919 |
], |
| 920 |
], |
| 921 |
'default' => [ |
| 922 |
'unit' => 'px', |
| 923 |
'size' => 18, |
| 924 |
], |
| 925 |
'selectors' => [ |
| 926 |
'{{WRAPPER}} .eel-authentication-form .eel-form-field-icon i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 927 |
'{{WRAPPER}} .eel-authentication-form .eel-form-field-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 928 |
], |
| 929 |
'condition' => [ |
| 930 |
'show_icon' => ['yes'], |
| 931 |
], |
| 932 |
] |
| 933 |
); |
| 934 |
$this->end_controls_section(); |
| 935 |
|
| 936 |
|
| 937 |
// ======================================== |
| 938 |
// STYLE SECTION - Fields Style |
| 939 |
// ======================================== |
| 940 |
$this->start_controls_section( |
| 941 |
'form_label_style_section', |
| 942 |
[ |
| 943 |
'label' => esc_html__( 'Label', 'easy-elements' ), |
| 944 |
'tab' => Controls_Manager::TAB_STYLE, |
| 945 |
'condition' => [ |
| 946 |
'show_label' => ['yes'], |
| 947 |
], |
| 948 |
] |
| 949 |
); |
| 950 |
|
| 951 |
$this->add_control( |
| 952 |
'field_label_color', |
| 953 |
[ |
| 954 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 955 |
'type' => Controls_Manager::COLOR, |
| 956 |
'selectors' => [ |
| 957 |
'{{WRAPPER}} .eel-authentication-form .eel-authentication-form-label' => 'color: {{VALUE}};', |
| 958 |
], |
| 959 |
'condition' => [ |
| 960 |
'show_label' => ['yes'], |
| 961 |
], |
| 962 |
] |
| 963 |
); |
| 964 |
|
| 965 |
$this->add_group_control( |
| 966 |
\Elementor\Group_Control_Typography::get_type(), |
| 967 |
[ |
| 968 |
'name' => 'field_label_typography', |
| 969 |
'selector' => '{{WRAPPER}} .eel-authentication-form .eel-authentication-form-label', |
| 970 |
'separator' => 'before', |
| 971 |
'condition' => [ |
| 972 |
'show_label' => ['yes'], |
| 973 |
], |
| 974 |
] |
| 975 |
); |
| 976 |
|
| 977 |
$this->add_control( |
| 978 |
'field_label_margin', |
| 979 |
[ |
| 980 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 981 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 982 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 983 |
'selectors' => [ |
| 984 |
'{{WRAPPER}} .eel-authentication-form .eel-authentication-form-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 985 |
], |
| 986 |
'condition' => [ |
| 987 |
'show_label' => ['yes'], |
| 988 |
], |
| 989 |
] |
| 990 |
); |
| 991 |
|
| 992 |
$this->end_controls_section(); |
| 993 |
|
| 994 |
// ======================================== |
| 995 |
// STYLE SECTION - Links Style |
| 996 |
// ======================================== |
| 997 |
$this->start_controls_section( |
| 998 |
'links_style_section', |
| 999 |
[ |
| 1000 |
'label' => esc_html__( 'Links', 'easy-elements' ), |
| 1001 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1002 |
] |
| 1003 |
); |
| 1004 |
|
| 1005 |
$this->add_control( |
| 1006 |
'links_color', |
| 1007 |
[ |
| 1008 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 1009 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 1010 |
'selectors' => [ |
| 1011 |
'{{WRAPPER}} .eel-authentication-form a' => 'color: {{VALUE}}', |
| 1012 |
], |
| 1013 |
] |
| 1014 |
); |
| 1015 |
$this->add_control( |
| 1016 |
'links_color_hoevr', |
| 1017 |
[ |
| 1018 |
'label' => esc_html__( 'Hover Color', 'easy-elements' ), |
| 1019 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 1020 |
'selectors' => [ |
| 1021 |
'{{WRAPPER}} .eel-authentication-form a:hover' => 'color: {{VALUE}}', |
| 1022 |
], |
| 1023 |
] |
| 1024 |
); |
| 1025 |
|
| 1026 |
$this->add_group_control( |
| 1027 |
\Elementor\Group_Control_Typography::get_type(), |
| 1028 |
[ |
| 1029 |
'name' => 'links_typography', |
| 1030 |
'selector' => '{{WRAPPER}} .eel-authentication-form a', |
| 1031 |
] |
| 1032 |
); |
| 1033 |
|
| 1034 |
// Border Control |
| 1035 |
$this->add_group_control( |
| 1036 |
Group_Control_Border::get_type(), |
| 1037 |
[ |
| 1038 |
'name' => 'links_border', |
| 1039 |
'selector' => '{{WRAPPER}} .eel-authentication-form .eel-authentication-form-field-inner.eel-authentication-form-links-field', |
| 1040 |
] |
| 1041 |
); |
| 1042 |
$this->end_controls_section(); |
| 1043 |
|
| 1044 |
// ======================================== |
| 1045 |
// STYLE SECTION - Submit Button Style |
| 1046 |
// ======================================== |
| 1047 |
$this->start_controls_section( |
| 1048 |
'submit_button_style_section', |
| 1049 |
[ |
| 1050 |
'label' => esc_html__( 'Submit', 'easy-elements' ), |
| 1051 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1052 |
] |
| 1053 |
); |
| 1054 |
|
| 1055 |
$this->start_controls_tabs('submit_button_style_tabs'); |
| 1056 |
|
| 1057 |
$this->start_controls_tab( |
| 1058 |
'submit_button_normal_tab', |
| 1059 |
[ |
| 1060 |
'label' => esc_html__('Normal', 'easy-elements'), |
| 1061 |
] |
| 1062 |
); |
| 1063 |
|
| 1064 |
$this->add_control( |
| 1065 |
'submit_button_color', |
| 1066 |
[ |
| 1067 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 1068 |
'type' => Controls_Manager::COLOR, |
| 1069 |
'selectors' => [ |
| 1070 |
'{{WRAPPER}} .eel-submit-button' => 'color: {{VALUE}};', |
| 1071 |
'{{WRAPPER}} .eel-form-btn-icon svg path' => 'fill: {{VALUE}};', |
| 1072 |
], |
| 1073 |
] |
| 1074 |
); |
| 1075 |
|
| 1076 |
$this->add_group_control( |
| 1077 |
\Elementor\Group_Control_Background::get_type(), |
| 1078 |
[ |
| 1079 |
'name' => 'submit_button_background_color', |
| 1080 |
'types' => [ 'classic', 'gradient', 'video' ], |
| 1081 |
'selector' => '{{WRAPPER}} .eel-authentication-form .eel-submit-button', |
| 1082 |
] |
| 1083 |
); |
| 1084 |
|
| 1085 |
$this->add_control( |
| 1086 |
'submit_button_wrapper_padding', |
| 1087 |
[ |
| 1088 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 1089 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 1090 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 1091 |
'selectors' => [ |
| 1092 |
'{{WRAPPER}} .eel-authentication-form .eel-submit-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1093 |
], |
| 1094 |
] |
| 1095 |
); |
| 1096 |
|
| 1097 |
$this->add_control( |
| 1098 |
'submit_button_wrapper_margin', |
| 1099 |
[ |
| 1100 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 1101 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 1102 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 1103 |
'selectors' => [ |
| 1104 |
'{{WRAPPER}} .eel-authentication-form .eel-submit-button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1105 |
], |
| 1106 |
] |
| 1107 |
); |
| 1108 |
|
| 1109 |
// Button Size Control |
| 1110 |
$this->add_responsive_control( |
| 1111 |
'submit_button_width', |
| 1112 |
[ |
| 1113 |
'label' => esc_html__('Width', 'easy-elements'), |
| 1114 |
'type' => Controls_Manager::SLIDER, |
| 1115 |
'size_units' => ['px', '%', 'em'], |
| 1116 |
'range' => [ |
| 1117 |
'px' => [ |
| 1118 |
'min' => 10, |
| 1119 |
'max' => 500, |
| 1120 |
], |
| 1121 |
'em' => [ |
| 1122 |
'min' => 0.5, |
| 1123 |
'max' => 10, |
| 1124 |
], |
| 1125 |
'%' => [ |
| 1126 |
'min' => 1, |
| 1127 |
'max' => 100, |
| 1128 |
], |
| 1129 |
], |
| 1130 |
'default' => [ |
| 1131 |
'unit' => '%', |
| 1132 |
'size' => 100, |
| 1133 |
], |
| 1134 |
'selectors' => [ |
| 1135 |
'{{WRAPPER}} .eel-authentication-form-field.eel-authentication-form-submit-field' => 'width: {{SIZE}}{{UNIT}};', |
| 1136 |
], |
| 1137 |
] |
| 1138 |
); |
| 1139 |
|
| 1140 |
// Border Radius Control |
| 1141 |
$this->add_control( |
| 1142 |
'submit_button_border_radius', |
| 1143 |
[ |
| 1144 |
'label' => esc_html__( 'Border Radius', 'easy-elements' ), |
| 1145 |
'type' => Controls_Manager::DIMENSIONS, |
| 1146 |
'size_units' => [ 'px', '%' ], |
| 1147 |
'selectors' => [ |
| 1148 |
'{{WRAPPER}} .eel-authentication-form .eel-submit-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1149 |
], |
| 1150 |
] |
| 1151 |
); |
| 1152 |
|
| 1153 |
// Border Control |
| 1154 |
$this->add_group_control( |
| 1155 |
Group_Control_Border::get_type(), |
| 1156 |
[ |
| 1157 |
'name' => 'submit_button_border', |
| 1158 |
'selector' => '{{WRAPPER}} .eel-authentication-form .eel-submit-button', |
| 1159 |
] |
| 1160 |
); |
| 1161 |
|
| 1162 |
// Box Shadow Control |
| 1163 |
$this->add_group_control( |
| 1164 |
Group_Control_Box_Shadow::get_type(), |
| 1165 |
[ |
| 1166 |
'name' => 'submit_button_box_shadow', |
| 1167 |
'selector' => '{{WRAPPER}} .eel-authentication-form .eel-submit-button', |
| 1168 |
] |
| 1169 |
); |
| 1170 |
|
| 1171 |
// Icon Size Control |
| 1172 |
$this->add_control( |
| 1173 |
'submit_button_icon_size', |
| 1174 |
[ |
| 1175 |
'label' => esc_html__( 'Icon Size', 'easy-elements' ), |
| 1176 |
'type' => Controls_Manager::SLIDER, |
| 1177 |
'size_units' => [ 'px', 'em' ], |
| 1178 |
'range' => [ |
| 1179 |
'px' => [ |
| 1180 |
'min' => 10, |
| 1181 |
'max' => 50, |
| 1182 |
'step' => 1, |
| 1183 |
], |
| 1184 |
'em' => [ |
| 1185 |
'min' => 0.5, |
| 1186 |
'max' => 3, |
| 1187 |
'step' => 0.1, |
| 1188 |
], |
| 1189 |
], |
| 1190 |
'default' => [ |
| 1191 |
'unit' => 'px', |
| 1192 |
'size' => 18, |
| 1193 |
], |
| 1194 |
'selectors' => [ |
| 1195 |
'{{WRAPPER}} .eel-submit-button i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1196 |
'{{WRAPPER}} .eel-submit-button svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 1197 |
], |
| 1198 |
] |
| 1199 |
); |
| 1200 |
|
| 1201 |
// Icon Horizontal Position |
| 1202 |
$this->add_responsive_control( |
| 1203 |
'submit_button_icon_position_x', |
| 1204 |
[ |
| 1205 |
'label' => esc_html__( 'Icon Horizontal Position', 'easy-elements' ), |
| 1206 |
'type' => Controls_Manager::SLIDER, |
| 1207 |
'size_units' => [ 'px', '%', 'em' ], |
| 1208 |
'range' => [ |
| 1209 |
'px' => [ 'min' => -100, 'max' => 100 ], |
| 1210 |
'%' => [ 'min' => -100, 'max' => 100 ], |
| 1211 |
'em' => [ 'min' => -5, 'max' => 5 ], |
| 1212 |
], |
| 1213 |
'selectors' => [ |
| 1214 |
'{{WRAPPER}} .eel-form-btn-icon' => 'left: {{SIZE}}{{UNIT}};', |
| 1215 |
], |
| 1216 |
] |
| 1217 |
); |
| 1218 |
|
| 1219 |
// Icon Vertical Position |
| 1220 |
$this->add_responsive_control( |
| 1221 |
'submit_button_icon_position_y', |
| 1222 |
[ |
| 1223 |
'label' => esc_html__( 'Icon Vertical Position', 'easy-elements' ), |
| 1224 |
'type' => Controls_Manager::SLIDER, |
| 1225 |
'size_units' => [ 'px', '%', 'em' ], |
| 1226 |
'range' => [ |
| 1227 |
'px' => [ 'min' => -100, 'max' => 100 ], |
| 1228 |
'%' => [ 'min' => -100, 'max' => 100 ], |
| 1229 |
'em' => [ 'min' => -5, 'max' => 5 ], |
| 1230 |
], |
| 1231 |
'selectors' => [ |
| 1232 |
'{{WRAPPER}} .eel-form-btn-icon' => 'top: {{SIZE}}{{UNIT}};', |
| 1233 |
], |
| 1234 |
] |
| 1235 |
); |
| 1236 |
|
| 1237 |
|
| 1238 |
$this->end_controls_tab(); |
| 1239 |
|
| 1240 |
$this->start_controls_tab( |
| 1241 |
'submit_button_hover_tab', |
| 1242 |
[ |
| 1243 |
'label' => esc_html__('Hover', 'easy-elements'), |
| 1244 |
] |
| 1245 |
); |
| 1246 |
|
| 1247 |
// Button Hover Color Control |
| 1248 |
$this->add_control( |
| 1249 |
'submit_button_hover_color', |
| 1250 |
[ |
| 1251 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 1252 |
'type' => Controls_Manager::COLOR, |
| 1253 |
'selectors' => [ |
| 1254 |
'{{WRAPPER}} .eel-authentication-form .eel-submit-button:hover' => 'color: {{VALUE}};', |
| 1255 |
'{{WRAPPER}} .eel-authentication-form .eel-submit-button:hover svg path' => 'fill: {{VALUE}};', |
| 1256 |
], |
| 1257 |
] |
| 1258 |
); |
| 1259 |
|
| 1260 |
$this->add_group_control( |
| 1261 |
\Elementor\Group_Control_Background::get_type(), |
| 1262 |
[ |
| 1263 |
'name' => 'submit_button_hover_bg_color', |
| 1264 |
'types' => [ 'classic', 'gradient', 'video' ], |
| 1265 |
'selector' => '{{WRAPPER}} .eel-authentication-form .eel-submit-button:hover', |
| 1266 |
] |
| 1267 |
); |
| 1268 |
|
| 1269 |
$this->end_controls_tab(); |
| 1270 |
$this->end_controls_section(); |
| 1271 |
|
| 1272 |
$this->start_controls_section( |
| 1273 |
'message_style_section', |
| 1274 |
[ |
| 1275 |
'label' => esc_html__( 'Message', 'easy-elements' ), |
| 1276 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1277 |
] |
| 1278 |
); |
| 1279 |
$this->add_group_control( |
| 1280 |
\Elementor\Group_Control_Typography::get_type(), |
| 1281 |
[ |
| 1282 |
'name' => 'message_typography', |
| 1283 |
'selector' => '{{WRAPPER}} .eel-authentication-form .eel-form-status', |
| 1284 |
] |
| 1285 |
); |
| 1286 |
|
| 1287 |
$this->add_control( |
| 1288 |
'msg_padding', |
| 1289 |
[ |
| 1290 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 1291 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 1292 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 1293 |
'selectors' => [ |
| 1294 |
'{{WRAPPER}} .eel-authentication-form .eel-form-status' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1295 |
], |
| 1296 |
] |
| 1297 |
); |
| 1298 |
|
| 1299 |
$this->add_control( |
| 1300 |
'msg_margin', |
| 1301 |
[ |
| 1302 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 1303 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 1304 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 1305 |
'selectors' => [ |
| 1306 |
'{{WRAPPER}} .eel-authentication-form .eel-form-status' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1307 |
], |
| 1308 |
] |
| 1309 |
); |
| 1310 |
|
| 1311 |
$this->add_control( |
| 1312 |
'success_message_styles', |
| 1313 |
[ |
| 1314 |
'label' => esc_html__( 'Success Message', 'easy-elements' ), |
| 1315 |
'type' => \Elementor\Controls_Manager::HEADING, |
| 1316 |
'separator' => 'before', |
| 1317 |
] |
| 1318 |
); |
| 1319 |
|
| 1320 |
$this->add_control( |
| 1321 |
'success_message_color', |
| 1322 |
[ |
| 1323 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 1324 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 1325 |
'selectors' => [ |
| 1326 |
'{{WRAPPER}} .eel-authentication-form .eel-form-status .eel-form-success-msg' => 'color: {{VALUE}}', |
| 1327 |
], |
| 1328 |
] |
| 1329 |
); |
| 1330 |
$this->add_control( |
| 1331 |
'error_message_styles', |
| 1332 |
[ |
| 1333 |
'label' => esc_html__( 'Failed Message', 'easy-elements' ), |
| 1334 |
'type' => \Elementor\Controls_Manager::HEADING, |
| 1335 |
'separator' => 'before', |
| 1336 |
] |
| 1337 |
); |
| 1338 |
$this->add_control( |
| 1339 |
'error_message_color', |
| 1340 |
[ |
| 1341 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 1342 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 1343 |
'selectors' => [ |
| 1344 |
'{{WRAPPER}} .eel-authentication-form .eel-form-status .eel-form-error-msg' => 'color: {{VALUE}}', |
| 1345 |
], |
| 1346 |
] |
| 1347 |
); |
| 1348 |
|
| 1349 |
|
| 1350 |
$this->end_controls_section(); |
| 1351 |
} |
| 1352 |
|
| 1353 |
public function render_login_form($settings = [], $is_toggle = false) { |
| 1354 |
|
| 1355 |
if ( is_user_logged_in() ) { |
| 1356 |
$already_logged_in_message = !empty($settings['already_logged_in_message']) ? $settings['already_logged_in_message'] : 'You are already logged in. Goto Homepage'; |
| 1357 |
echo '<a href="'. esc_url(home_url()) .'">'. esc_html( $already_logged_in_message ) .'</a>'; |
| 1358 |
return; |
| 1359 |
} |
| 1360 |
|
| 1361 |
$show_ajax_loader = !empty($settings['show_ajax_loader']) ? $settings['show_ajax_loader'] : 'yes'; |
| 1362 |
$show_label = !empty($settings['show_label']) ? $settings['show_label'] : ''; |
| 1363 |
$show_icon = !empty($settings['show_icon']) ? $settings['show_icon'] : ''; |
| 1364 |
$show_icons = !empty($settings['show_icon']) ? 'eel-input-has-icon' : ''; |
| 1365 |
$show_success_message = !empty($settings['show_success_message']) ? $settings['show_success_message'] : 'yes'; |
| 1366 |
$show_error_message = !empty($settings['show_error_message']) ? $settings['show_error_message'] : 'yes'; |
| 1367 |
$login_success_message = !empty($settings['login_success_message']) ? $settings['login_success_message'] : 'Login Success'; |
| 1368 |
$login_error_message = !empty($settings['login_error_message']) ? $settings['login_error_message'] : 'Login failed! Enter correct email & password.'; |
| 1369 |
$empty_error_message = !empty($settings['empty_error_message']) ? $settings['empty_error_message'] : 'This field is required.'; |
| 1370 |
|
| 1371 |
$show_password_reset_link = !empty($settings['show_password_reset_link']) ? $settings['show_password_reset_link'] : 'yes'; |
| 1372 |
$password_reset_text = !empty($settings['password_reset_text']) ? $settings['password_reset_text'] : ''; |
| 1373 |
|
| 1374 |
$remember_me = !empty($settings['remember_me']) ? $settings['remember_me'] : ''; |
| 1375 |
$remember_label_text = !empty($settings['remember_label_text']) ? $settings['remember_label_text'] : 'Remember Me'; |
| 1376 |
$submit_button_text = !empty($settings['submit_button_text']) ? $settings['submit_button_text'] : 'Log in'; |
| 1377 |
$submit_button_icon = !empty($settings['submit_button_icon']['value']) ? $settings['submit_button_icon'] : ''; |
| 1378 |
$submit_button_icon_position = !empty($settings['submit_button_icon_position']) ? $settings['submit_button_icon_position'] : ''; |
| 1379 |
|
| 1380 |
$redirect_after_login = !empty($settings['redirect_after_login']) ? $settings['redirect_after_login'] : 'yes'; |
| 1381 |
$redirect_link_after_login = !empty($settings['redirect_link_after_login']['url']) ? $settings['redirect_link_after_login']['url'] : home_url(); |
| 1382 |
|
| 1383 |
|
| 1384 |
$cta_text = !empty($settings['cta_text']) ? $settings['cta_text'] : ''; |
| 1385 |
|
| 1386 |
$login_fields = !empty($settings['login_fields']) ? $settings['login_fields'] : ''; |
| 1387 |
|
| 1388 |
?> |
| 1389 |
<form method="post" class="eel-authentication-form eel-login-form <?php echo esc_attr( $show_icons ); ?>" <?php echo $is_toggle ? 'data-form-name="login"' : ''; ?>> |
| 1390 |
<?php wp_nonce_field( 'easy_elements_nonce', 'eel_login_nonce' ); ?> |
| 1391 |
<input type="hidden" name="login_redirect_link" value="<?php echo esc_url( $redirect_link_after_login )?>"> |
| 1392 |
<input type="hidden" name="empty_error_msg" value="<?php echo esc_attr( $empty_error_message )?>"> |
| 1393 |
<?php |
| 1394 |
if(!empty($login_fields) && is_array($login_fields)) { |
| 1395 |
foreach ($login_fields as $field) { |
| 1396 |
$type = !empty($field['type']) ? $field['type'] : 'username'; |
| 1397 |
$id = 'eel_' . $type; |
| 1398 |
$label = !empty($field['label']) ? $field['label'] : ''; |
| 1399 |
$placeholder = !empty($field['placeholder']) ? $field['placeholder'] : ''; |
| 1400 |
$icon = !empty($field['icon']['value']) ? $field['icon'] : ''; |
| 1401 |
$is_required = !empty($field['is_required']) ? 'required' : ''; |
| 1402 |
$static_text = !empty($field['static_text']) ? $field['static_text'] : ''; |
| 1403 |
|
| 1404 |
|
| 1405 |
if($type =='static_text' && !empty($static_text)) { |
| 1406 |
?> |
| 1407 |
<div class="eel-authentication-form-field eel-authentication-form-static-field"> |
| 1408 |
<div class="eel-authentication-form-field-inner"> |
| 1409 |
<div class="eel-form-control-wrap"> |
| 1410 |
<?php echo wp_kses_post( $static_text ); ?> |
| 1411 |
</div> |
| 1412 |
</div> |
| 1413 |
</div> |
| 1414 |
<?php |
| 1415 |
}else{ |
| 1416 |
?> |
| 1417 |
<div class="eel-authentication-form-field"> |
| 1418 |
<div class="eel-authentication-form-field-inner"> |
| 1419 |
<?php if ($show_icon == 'yes' && !empty($icon['value'])): ?> |
| 1420 |
<span class="eel-form-field-icon"> |
| 1421 |
<?php \Elementor\Icons_Manager::render_icon( $icon, [ 'aria-hidden' => 'true' ] ); ?> |
| 1422 |
</span> |
| 1423 |
<?php endif; ?> |
| 1424 |
<div class="eel-form-control-wrap"> |
| 1425 |
<?php |
| 1426 |
if($show_label == 'yes' && !empty($label)) { |
| 1427 |
?> |
| 1428 |
<label for="<?php echo esc_attr( $id ) ?>" class="eel-authentication-form-label"><?php echo esc_html( $label ); ?></label> |
| 1429 |
<?php |
| 1430 |
} |
| 1431 |
?> |
| 1432 |
<input type="<?php echo esc_attr( $type === 'password' ? 'password' : 'text' ); ?>" name="<?php echo esc_attr( $type ) ?>" class="eel-form-control" id="<?php echo esc_attr( $id ) ?>" placeholder="<?php echo esc_attr( $placeholder ) ?>" <?php echo esc_attr( $is_required ) ?> autocomplete /> |
| 1433 |
</div> |
| 1434 |
</div> |
| 1435 |
<div class="eel-error-msg" data-error-for="<?php echo esc_attr( $id )?>"></div> |
| 1436 |
</div> |
| 1437 |
<?php |
| 1438 |
} |
| 1439 |
|
| 1440 |
|
| 1441 |
} |
| 1442 |
} |
| 1443 |
?> |
| 1444 |
<?php |
| 1445 |
if($remember_me == 'yes' || $show_password_reset_link == 'yes') { ?> |
| 1446 |
<div class="eel-authentication-form-field eel-authentication-form-checkbox-field"> |
| 1447 |
<div class="eel-authentication-form-field-inner"> |
| 1448 |
<div class="eel-form-control-wrap"> |
| 1449 |
<?php if($remember_me == 'yes') { ?> |
| 1450 |
<label class="eel-authentication-form-label"> |
| 1451 |
<input type="checkbox" name="eel_rememberme" id="eel_rememberme" value="forever" /> |
| 1452 |
<?php echo esc_attr( $remember_label_text )?> |
| 1453 |
</label> |
| 1454 |
<?php } ?> |
| 1455 |
<?php |
| 1456 |
if($show_password_reset_link == 'yes') { ?> |
| 1457 |
<a href="<?php echo esc_url( wp_lostpassword_url() )?>" target="_blank"><?php echo esc_html( $password_reset_text ) ?></a> |
| 1458 |
<?php } ?> |
| 1459 |
</div> |
| 1460 |
</div> |
| 1461 |
</div> |
| 1462 |
<?php } ?> |
| 1463 |
|
| 1464 |
|
| 1465 |
<div class="eel-authentication-form-field eel-authentication-form-submit-field"> |
| 1466 |
<div class="eel-authentication-form-field-inner"> |
| 1467 |
<div class="eel-form-control-wrap"> |
| 1468 |
<button type="submit" name="eel_login_submit" class="eel-submit-button"> |
| 1469 |
<?php |
| 1470 |
if(!empty($submit_button_icon) && $submit_button_icon_position == 'before') { |
| 1471 |
?> |
| 1472 |
<span class="eel-form-btn-icon"> |
| 1473 |
<?php \Elementor\Icons_Manager::render_icon( $submit_button_icon, [ 'aria-hidden' => 'true' ] ); ?> |
| 1474 |
</span> |
| 1475 |
<?php |
| 1476 |
} |
| 1477 |
?> |
| 1478 |
<span class="eel-form-btn-text"><?php echo esc_attr( $submit_button_text )?></span> |
| 1479 |
<?php |
| 1480 |
if(!empty($submit_button_icon) && $submit_button_icon_position == 'after') { |
| 1481 |
?> |
| 1482 |
<span class="eel-form-btn-icon"> |
| 1483 |
<?php \Elementor\Icons_Manager::render_icon( $submit_button_icon, [ 'aria-hidden' => 'true' ] ); ?> |
| 1484 |
</span> |
| 1485 |
<?php |
| 1486 |
} |
| 1487 |
?> |
| 1488 |
<?php |
| 1489 |
if($show_ajax_loader == 'yes') { ?> |
| 1490 |
<span class="eel-form-ajax-loader"> |
| 1491 |
<img src="<?php echo esc_url( EASYELEMENTS_DIR_URL . 'widgets/login-register/img/ajax-loader.gif' )?>" alt="ajax loader"> |
| 1492 |
</span> |
| 1493 |
<?php } ?> |
| 1494 |
</button> |
| 1495 |
</div> |
| 1496 |
</div> |
| 1497 |
</div> |
| 1498 |
|
| 1499 |
<?php |
| 1500 |
if(!empty($cta_text)) { ?> |
| 1501 |
<div class="eel-authentication-form-field eel-authentication-form-cta-field"> |
| 1502 |
<div class="eel-authentication-form-field-inner"> |
| 1503 |
<div class="eel-form-control-wrap <?php echo $is_toggle ? 'eel-form-switcher' : ''; ?>" <?php echo $is_toggle ? 'data-switch-to="register"' : ''; ?>> |
| 1504 |
<?php echo wp_kses_post( $cta_text ); ?> |
| 1505 |
</div> |
| 1506 |
</div> |
| 1507 |
</div> |
| 1508 |
<?php } ?> |
| 1509 |
|
| 1510 |
<div class="eel-form-status"> |
| 1511 |
<?php |
| 1512 |
if($show_error_message == 'yes') { |
| 1513 |
?> |
| 1514 |
<p class="eel-form-error-msg"><?php echo esc_html( $login_error_message )?></p> |
| 1515 |
<?php |
| 1516 |
} |
| 1517 |
if($show_success_message == 'yes') { |
| 1518 |
?> |
| 1519 |
<p class="eel-form-success-msg"><?php echo esc_html( $login_success_message )?></p> |
| 1520 |
<?php |
| 1521 |
} |
| 1522 |
?> |
| 1523 |
</div> |
| 1524 |
|
| 1525 |
</form> |
| 1526 |
<?php |
| 1527 |
|
| 1528 |
} |
| 1529 |
|
| 1530 |
public function render_register_form($settings = [], $is_toggle = false) { |
| 1531 |
$show_ajax_loader = !empty($settings['show_ajax_loader']) ? $settings['show_ajax_loader'] : 'yes'; |
| 1532 |
$show_label = !empty($settings['show_label']) ? $settings['show_label'] : ''; |
| 1533 |
$show_icon = !empty($settings['show_icon']) ? $settings['show_icon'] : ''; |
| 1534 |
$show_icons = !empty($settings['show_icon']) ? 'eel-input-has-icon' : ''; |
| 1535 |
|
| 1536 |
$show_success_message = !empty($settings['show_success_message']) ? $settings['show_success_message'] : 'yes'; |
| 1537 |
$show_error_message = !empty($settings['show_error_message']) ? $settings['show_error_message'] : 'yes'; |
| 1538 |
$register_success_message = !empty($settings['register_success_message']) ? $settings['register_success_message'] : 'Register Success'; |
| 1539 |
$register_error_message = !empty($settings['register_error_message']) ? $settings['register_error_message'] : 'Registration Failed'; |
| 1540 |
$empty_error_message = !empty($settings['empty_error_message']) ? $settings['empty_error_message'] : 'This field is required.'; |
| 1541 |
$confirm_pass_error_message = !empty($settings['confirm_pass_error_message']) ? $settings['confirm_pass_error_message'] : 'Confirm passowrd not matched'; |
| 1542 |
$min_length_error_message = !empty($settings['min_length_error_message']) ? $settings['min_length_error_message'] : 'Minimum {count} characters required.'; |
| 1543 |
$max_length_error_message = !empty($settings['max_length_error_message']) ? $settings['max_length_error_message'] : 'Maximum {count} characters required.'; |
| 1544 |
|
| 1545 |
$submit_button_text = !empty($settings['submit_button_text']) ? $settings['submit_button_text'] : 'Register'; |
| 1546 |
$submit_button_icon = !empty($settings['submit_button_icon']) ? $settings['submit_button_icon'] : ''; |
| 1547 |
$submit_button_icon_position = !empty($settings['submit_button_icon_position']) ? $settings['submit_button_icon_position'] : ''; |
| 1548 |
|
| 1549 |
$redirect_after_register = !empty($settings['redirect_after_registration']) ? $settings['redirect_after_registration'] : 'yes'; |
| 1550 |
$redirect_link_after_register = !empty($settings['redirect_link_after_registration']['url']) ? $settings['redirect_link_after_registration']['url'] : home_url(); |
| 1551 |
|
| 1552 |
$cta_text = !empty($settings['cta_text']) ? $settings['cta_text'] : ''; |
| 1553 |
|
| 1554 |
$register_fields = !empty($settings['register_fields']) ? $settings['register_fields'] : ''; |
| 1555 |
$auto_login_after_registration = !empty($settings['auto_login_after_registration']) ? $settings['auto_login_after_registration'] : 'yes'; |
| 1556 |
|
| 1557 |
|
| 1558 |
|
| 1559 |
?> |
| 1560 |
<form method="post" class="eel-authentication-form eel-register-form <?php echo esc_attr( $show_icons ); ?>" <?php echo $is_toggle ? 'data-form-name="register"' : ''; ?>> |
| 1561 |
<?php |
| 1562 |
wp_nonce_field( 'easy_elements_nonce', 'eel_register_nonce' ); |
| 1563 |
$auto_login_value = ( $auto_login_after_registration === 'yes' ) ? 'yes' : 'no'; |
| 1564 |
?> |
| 1565 |
<input type="hidden" name="register_redirect_link" value="<?php echo esc_url( $redirect_link_after_register )?>"> |
| 1566 |
<input type="hidden" name="auto_login_after_registration" value="<?php echo esc_attr( $auto_login_value )?>"> |
| 1567 |
<input type="hidden" name="empty_error_msg" value="<?php echo esc_attr( $empty_error_message )?>"> |
| 1568 |
<input type="hidden" name="min_length_error_msg" value="<?php echo esc_attr( $min_length_error_message )?>"> |
| 1569 |
<input type="hidden" name="max_length_error_msg" value="<?php echo esc_attr( $max_length_error_message )?>"> |
| 1570 |
<input type="hidden" name="confirm_pass_error_msg" value="<?php echo esc_attr( $confirm_pass_error_message )?>"> |
| 1571 |
<?php |
| 1572 |
if(!empty($register_fields) && is_array($register_fields)) { |
| 1573 |
foreach ($register_fields as $field) { |
| 1574 |
|
| 1575 |
$type = !empty($field['type']) ? $field['type'] : 'username'; |
| 1576 |
$input_type = $type == 'custom' && !empty($field['input_type']) ? $field['input_type'] : 'text'; |
| 1577 |
$meta_key = !empty($field['meta_key']) ? $field['meta_key'] : ''; |
| 1578 |
$id = 'eel_' . $type; |
| 1579 |
$label = !empty($field['label']) ? $field['label'] : ''; |
| 1580 |
$placeholder = !empty($field['placeholder']) ? $field['placeholder'] : ''; |
| 1581 |
$icon = !empty($field['icon']['value']) ? $field['icon'] : ''; |
| 1582 |
$is_required = !empty($field['is_required']) ? 'required' : ''; |
| 1583 |
$static_text = !empty($field['static_text']) ? $field['static_text'] : ''; |
| 1584 |
$min_length = !empty($field['min_length']) ? $field['min_length'] : '1'; |
| 1585 |
$max_length = !empty($field['max_length']) ? $field['max_length'] : ''; |
| 1586 |
$width = !empty($field['width']['size']) ? $field['width']['size'] . $field['width']['unit'] : ''; |
| 1587 |
|
| 1588 |
if($type =='custom' && !empty($meta_key)){ |
| 1589 |
$type = 'custom_meta[' . $meta_key . ']'; |
| 1590 |
$id = 'eel_' . $meta_key; |
| 1591 |
} |
| 1592 |
|
| 1593 |
if($type =='consent') { |
| 1594 |
?> |
| 1595 |
<div class="eel-authentication-form-field eel-authentication-form-checkbox-field" <?php echo !empty($width) ? 'style="width: '.esc_attr( $width ).';"' : '' ?>> |
| 1596 |
<div class="eel-authentication-form-field-inner"> |
| 1597 |
<div class="eel-form-control-wrap"> |
| 1598 |
<label class="eel-authentication-form-label"> |
| 1599 |
<input type="checkbox" name="<?php echo esc_attr( $type ) ?>" id="<?php echo esc_attr( $id ) ?>" <?php echo esc_attr( $is_required ) ?>/> |
| 1600 |
<?php echo esc_attr( $label )?> |
| 1601 |
</label> |
| 1602 |
</div> |
| 1603 |
</div> |
| 1604 |
<div class="eel-error-msg" data-error-for="<?php echo esc_attr( $id )?>"></div> |
| 1605 |
</div> |
| 1606 |
<?php |
| 1607 |
}elseif($type =='static_text' && !empty($static_text)) { |
| 1608 |
?> |
| 1609 |
<div class="eel-authentication-form-field eel-authentication-form-static-field" <?php echo !empty($width) ? 'style="width: '.esc_attr( $width ).';"' : '' ?>> |
| 1610 |
<div class="eel-authentication-form-field-inner"> |
| 1611 |
<div class="eel-form-control-wrap"> |
| 1612 |
<?php echo wp_kses_post( $static_text ); ?> |
| 1613 |
</div> |
| 1614 |
</div> |
| 1615 |
</div> |
| 1616 |
<?php |
| 1617 |
}else{ |
| 1618 |
?> |
| 1619 |
<div class="eel-authentication-form-field" <?php echo !empty($width) ? 'style="width: '.esc_attr( $width ).';"' : '' ?>> |
| 1620 |
<div class="eel-authentication-form-field-inner"> |
| 1621 |
<?php if ($show_icon == 'yes' && !empty($icon['value'])): ?> |
| 1622 |
<span class="eel-form-field-icon eel-user-icon"> |
| 1623 |
<?php \Elementor\Icons_Manager::render_icon( $icon, [ 'aria-hidden' => 'true' ] ); ?> |
| 1624 |
</span> |
| 1625 |
<?php endif; ?> |
| 1626 |
<div class="eel-form-control-wrap"> |
| 1627 |
<?php |
| 1628 |
if($show_label == 'yes' && !empty($label)) { |
| 1629 |
?> |
| 1630 |
<label for="<?php echo esc_attr( $id ) ?>" class="eel-authentication-form-label"><?php echo esc_html( $label ); ?></label> |
| 1631 |
<?php |
| 1632 |
} |
| 1633 |
?> |
| 1634 |
<input type="<?php echo esc_attr( in_array( $type, ['user_pass', 'confirm_password'] ) ? 'password' : ( $type === 'user_email' ? 'email' : 'text' ) ); ?>" name="<?php echo esc_attr( $type ) ?>" class="eel-form-control" id="<?php echo esc_attr( $id ) ?>" placeholder="<?php echo esc_attr( $placeholder ) ?>" <?php echo esc_attr( $is_required ) ?> min="<?php echo esc_attr( $min_length )?>" max="<?php echo esc_attr( $max_length )?>"/> |
| 1635 |
</div> |
| 1636 |
</div> |
| 1637 |
<div class="eel-error-msg" data-error-for="<?php echo esc_attr( $id )?>"></div> |
| 1638 |
</div> |
| 1639 |
<?php |
| 1640 |
} |
| 1641 |
|
| 1642 |
|
| 1643 |
} |
| 1644 |
} |
| 1645 |
?> |
| 1646 |
<div class="eel-authentication-form-field eel-authentication-form-submit-field"> |
| 1647 |
<div class="eel-authentication-form-field-inner"> |
| 1648 |
<div class="eel-form-control-wrap"> |
| 1649 |
<button type="submit" name="eel_login_submit" class="eel-submit-button"> |
| 1650 |
<?php |
| 1651 |
if(!empty($submit_button_icon) && $submit_button_icon_position == 'before') { |
| 1652 |
?> |
| 1653 |
<span class="eel-form-btn-icon"> |
| 1654 |
<?php \Elementor\Icons_Manager::render_icon( $submit_button_icon, [ 'aria-hidden' => 'true' ] ); ?> |
| 1655 |
</span> |
| 1656 |
<?php |
| 1657 |
} |
| 1658 |
?> |
| 1659 |
<span class="eel-form-btn-text"><?php echo esc_attr( $submit_button_text )?></span> |
| 1660 |
<?php |
| 1661 |
if(!empty($submit_button_icon) && $submit_button_icon_position == 'after') { |
| 1662 |
?> |
| 1663 |
<span class="eel-form-btn-icon"> |
| 1664 |
<?php \Elementor\Icons_Manager::render_icon( $submit_button_icon, [ 'aria-hidden' => 'true' ] ); ?> |
| 1665 |
</span> |
| 1666 |
<?php |
| 1667 |
} |
| 1668 |
?> |
| 1669 |
<?php |
| 1670 |
if($show_ajax_loader == 'yes') { ?> |
| 1671 |
<span class="eel-form-ajax-loader"> |
| 1672 |
<img src="<?php echo esc_url( EASYELEMENTS_DIR_URL . 'widgets/login-register/img/ajax-loader.gif' )?>" alt="ajax loader"> |
| 1673 |
</span> |
| 1674 |
<?php } ?> |
| 1675 |
</button> |
| 1676 |
</div> |
| 1677 |
</div> |
| 1678 |
</div> |
| 1679 |
<?php |
| 1680 |
$register_cta_text = $is_toggle ? esc_html__( 'Already have an account? Login', 'easy-elements' ) : $cta_text; |
| 1681 |
if(!empty($register_cta_text)) { ?> |
| 1682 |
<div class="eel-authentication-form-field eel-authentication-form-cta-field"> |
| 1683 |
<div class="eel-authentication-form-field-inner"> |
| 1684 |
<div class="eel-form-control-wrap <?php echo $is_toggle ? 'eel-form-switcher' : ''; ?>" <?php echo $is_toggle ? 'data-switch-to="login"' : ''; ?>> |
| 1685 |
<?php echo wp_kses_post( $register_cta_text ); ?> |
| 1686 |
</div> |
| 1687 |
</div> |
| 1688 |
</div> |
| 1689 |
<?php } ?> |
| 1690 |
|
| 1691 |
<div class="eel-form-status"> |
| 1692 |
<?php |
| 1693 |
if($show_error_message == 'yes') { |
| 1694 |
?> |
| 1695 |
<p class="eel-form-error-msg"><?php echo esc_html( $register_error_message )?></p> |
| 1696 |
<?php |
| 1697 |
} |
| 1698 |
if($show_success_message == 'yes') { |
| 1699 |
?> |
| 1700 |
<p class="eel-form-success-msg"><?php echo esc_html( $register_success_message )?></p> |
| 1701 |
<?php |
| 1702 |
} |
| 1703 |
?> |
| 1704 |
|
| 1705 |
|
| 1706 |
</div> |
| 1707 |
|
| 1708 |
</form> |
| 1709 |
<?php |
| 1710 |
|
| 1711 |
} |
| 1712 |
|
| 1713 |
/** |
| 1714 |
* Render widget output on the frontend |
| 1715 |
* |
| 1716 |
* Generates the HTML markup for the login registers |
| 1717 |
*/ |
| 1718 |
protected function render() { |
| 1719 |
$settings = $this->get_settings_for_display(); |
| 1720 |
$form_type = !empty($settings['form_type']) ? $settings['form_type'] : 'login'; |
| 1721 |
|
| 1722 |
if($form_type == 'login') { |
| 1723 |
$this->render_login_form($settings); |
| 1724 |
}elseif($form_type == 'register') { |
| 1725 |
$this->render_register_form($settings); |
| 1726 |
}else{ |
| 1727 |
?> |
| 1728 |
<div class="eel-authentication-toggle-wrap" data-active-form="login"> |
| 1729 |
<?php |
| 1730 |
$this->render_login_form($settings, true); |
| 1731 |
$this->render_register_form($settings, true); |
| 1732 |
?> |
| 1733 |
</div> |
| 1734 |
<?php |
| 1735 |
} |
| 1736 |
|
| 1737 |
} |
| 1738 |
|
| 1739 |
} |