Adv_Accordion.php
4 years ago
Adv_Tabs.php
4 years ago
Advanced_Data_Table.php
4 years ago
Better_Payment.php
4 years ago
Betterdocs_Category_Box.php
4 years ago
Betterdocs_Category_Grid.php
4 years ago
Betterdocs_Search_Form.php
4 years ago
Caldera_Forms.php
4 years ago
Career_Page.php
4 years ago
Contact_Form_7.php
4 years ago
Content_Ticker.php
4 years ago
Countdown.php
4 years ago
Creative_Button.php
4 years ago
Crowdfundly_All_Campaign.php
4 years ago
Crowdfundly_Organization.php
4 years ago
Crowdfundly_Single_Campaign.php
4 years ago
Cta_Box.php
4 years ago
Data_Table.php
4 years ago
Dual_Color_Header.php
4 years ago
EmbedPress.php
4 years ago
Event_Calendar.php
4 years ago
Facebook_Feed.php
4 years ago
Fancy_Text.php
4 years ago
Feature_List.php
4 years ago
Filterable_Gallery.php
4 years ago
Flip_Box.php
4 years ago
FluentForm.php
4 years ago
Formstack.php
4 years ago
GravityForms.php
4 years ago
Image_Accordion.php
4 years ago
Info_Box.php
4 years ago
Interactive_Circle.php
4 years ago
Login_Register.php
4 years ago
NinjaForms.php
4 years ago
Post_Grid.php
4 years ago
Post_Timeline.php
4 years ago
Pricing_Table.php
4 years ago
Product_Grid.php
4 years ago
Progress_Bar.php
4 years ago
Simple_Menu.php
4 years ago
Sticky_Video.php
4 years ago
Team_Member.php
4 years ago
Testimonial.php
4 years ago
Tooltip.php
4 years ago
Twitter_Feed.php
4 years ago
TypeForm.php
4 years ago
WeForms.php
4 years ago
Woo_Cart.php
4 years ago
Woo_Checkout.php
4 years ago
Woo_Product_Carousel.php
4 years ago
Woo_Product_Compare.php
4 years ago
Woo_Product_Gallery.php
4 years ago
Woocommerce_Review.php
4 years ago
WpForms.php
4 years ago
Login_Register.php
4529 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Essential_Addons_Elementor\Elements; |
| 4 | |
| 5 | use Elementor\Controls_Manager; |
| 6 | use Elementor\Group_Control_Background; |
| 7 | use Elementor\Group_Control_Border; |
| 8 | use Elementor\Group_Control_Box_Shadow; |
| 9 | use Elementor\Group_Control_Image_Size; |
| 10 | use Elementor\Group_Control_Typography; |
| 11 | use Elementor\Icons_Manager; |
| 12 | use Elementor\Plugin; |
| 13 | use Elementor\Repeater; |
| 14 | use Elementor\Utils; |
| 15 | use Elementor\Widget_Base; |
| 16 | use Essential_Addons_Elementor\Classes\Helper as HelperCLass; |
| 17 | use Essential_Addons_Elementor\Traits\Login_Registration; |
| 18 | |
| 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | exit; |
| 21 | } // Exit if accessed directly |
| 22 | |
| 23 | /** |
| 24 | * Class Login_Register |
| 25 | * @package Essential_Addons_Elementor\Elements |
| 26 | */ |
| 27 | class Login_Register extends Widget_Base { |
| 28 | |
| 29 | use Login_Registration; |
| 30 | |
| 31 | /** |
| 32 | * Does the site allows new user registration? |
| 33 | * @var bool |
| 34 | */ |
| 35 | protected $user_can_register; |
| 36 | /** |
| 37 | * Are you currently in Elementor Editor Screen? |
| 38 | * @var bool |
| 39 | */ |
| 40 | protected $in_editor; |
| 41 | /** |
| 42 | * Should login form be printed? |
| 43 | * @var bool |
| 44 | */ |
| 45 | protected $should_print_login_form; |
| 46 | /** |
| 47 | * Should registration form be printed? |
| 48 | * @var bool |
| 49 | */ |
| 50 | protected $should_print_register_form; |
| 51 | /** |
| 52 | * It contains an array of settings for the display |
| 53 | * @var array |
| 54 | */ |
| 55 | protected $ds; |
| 56 | /** |
| 57 | * @var bool|false|int |
| 58 | */ |
| 59 | protected $page_id; |
| 60 | /** |
| 61 | * @var bool|string |
| 62 | */ |
| 63 | protected $form_illustration_url; |
| 64 | /** |
| 65 | * @var bool|string |
| 66 | */ |
| 67 | protected $form_logo; |
| 68 | /** |
| 69 | * What form to show by default on initial page load. login or register ? |
| 70 | * @var string |
| 71 | */ |
| 72 | protected $default_form; |
| 73 | /** |
| 74 | * Form illustration position |
| 75 | * @var mixed|string |
| 76 | */ |
| 77 | protected $form_illustration_pos; |
| 78 | /** |
| 79 | * Form logo position |
| 80 | * @var mixed|string |
| 81 | */ |
| 82 | protected $form_logo_pos; |
| 83 | /** |
| 84 | * Google reCAPTCHA Site key |
| 85 | * @var string|false |
| 86 | */ |
| 87 | protected $recaptcha_sitekey; |
| 88 | /** |
| 89 | * @var mixed|void |
| 90 | */ |
| 91 | protected $pro_enabled; |
| 92 | |
| 93 | /** |
| 94 | * Login_Register constructor. |
| 95 | * Initializing the Login_Register widget class. |
| 96 | * @inheritDoc |
| 97 | */ |
| 98 | public function __construct( $data = [], $args = null ) { |
| 99 | parent::__construct( $data, $args ); |
| 100 | $this->user_can_register = get_option( 'users_can_register' ); |
| 101 | $this->recaptcha_sitekey = get_option( 'eael_recaptcha_sitekey' ); |
| 102 | $this->in_editor = Plugin::instance()->editor->is_edit_mode(); |
| 103 | $this->pro_enabled = apply_filters( 'eael/pro_enabled', false ); |
| 104 | |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @inheritDoc |
| 109 | */ |
| 110 | public function get_name() { |
| 111 | return 'eael-login-register'; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * @inheritDoc |
| 116 | */ |
| 117 | public function get_title() { |
| 118 | return esc_html__( 'Login | Register Form', 'essential-addons-for-elementor-lite' ); |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * @inheritDoc |
| 123 | */ |
| 124 | public function get_icon() { |
| 125 | return 'eaicon-login'; |
| 126 | } |
| 127 | |
| 128 | public function get_script_depends() { |
| 129 | $scripts = parent::get_script_depends(); |
| 130 | $scripts[] = 'eael-recaptcha'; |
| 131 | |
| 132 | return apply_filters( 'eael/login-register/scripts', $scripts ); |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * @inheritDoc |
| 137 | */ |
| 138 | public function get_style_depends() { |
| 139 | $styles = parent::get_style_depends(); |
| 140 | $styles[] = 'dashicons'; |
| 141 | |
| 142 | return apply_filters( 'eael/login-register/styles', $styles ); |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * @inheritDoc |
| 147 | */ |
| 148 | public function get_keywords() { |
| 149 | return [ |
| 150 | 'ea login register', |
| 151 | 'ea register login', |
| 152 | 'signin form', |
| 153 | 'signup form', |
| 154 | 'sign in form', |
| 155 | 'sign up form', |
| 156 | 'authentication', |
| 157 | 'google', |
| 158 | 'facebook', |
| 159 | 'ea', |
| 160 | 'essential addons', |
| 161 | ]; |
| 162 | } |
| 163 | |
| 164 | public function get_custom_help_url() { |
| 165 | return 'https://essential-addons.com/elementor/docs/login-register-form/'; |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * @inheritDoc |
| 170 | */ |
| 171 | public function get_categories() { |
| 172 | return [ 'essential-addons-elementor' ]; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Get an array of form field types. |
| 177 | * @return array |
| 178 | */ |
| 179 | protected function get_form_field_types() { |
| 180 | return apply_filters( 'eael/registration-form-fields', [ |
| 181 | 'user_name' => __( 'Username', 'essential-addons-for-elementor-lite' ), |
| 182 | 'email' => __( 'Email', 'essential-addons-for-elementor-lite' ), |
| 183 | 'password' => __( 'Password', 'essential-addons-for-elementor-lite' ), |
| 184 | 'confirm_pass' => __( 'Confirm Password', 'essential-addons-for-elementor-lite' ), |
| 185 | 'first_name' => __( 'First Name', 'essential-addons-for-elementor-lite' ), |
| 186 | 'last_name' => __( 'Last Name', 'essential-addons-for-elementor-lite' ), |
| 187 | 'website' => __( 'Website', 'essential-addons-for-elementor-lite' ), |
| 188 | ] ); |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * @inheritDoc |
| 193 | */ |
| 194 | protected function register_controls() { |
| 195 | /*----Content Tab----*/ |
| 196 | do_action( 'eael/login-register/before-content-controls', $this ); |
| 197 | $this->init_content_general_controls(); |
| 198 | $this->init_form_header_controls(); |
| 199 | // Login Form Related--- |
| 200 | $this->init_content_login_fields_controls(); |
| 201 | $this->init_content_login_options_controls(); |
| 202 | |
| 203 | if(!$this->pro_enabled){ |
| 204 | $this->social_login_promo(); |
| 205 | } |
| 206 | |
| 207 | do_action( 'eael/login-register/after-login-controls-section', $this ); |
| 208 | // Registration For Related--- |
| 209 | $this->init_content_register_fields_controls(); |
| 210 | $this->init_content_register_options_controls(); |
| 211 | $this->init_content_register_user_email_controls(); |
| 212 | $this->init_content_register_admin_email_controls(); |
| 213 | //Terms & Conditions |
| 214 | $this->init_content_terms_controls(); |
| 215 | // Error Messages |
| 216 | $this->init_content_validation_messages_controls(); |
| 217 | do_action( 'eael/login-register/after-content-controls', $this ); |
| 218 | |
| 219 | if(!$this->pro_enabled){ |
| 220 | $this->show_pro_promotion(); |
| 221 | } |
| 222 | |
| 223 | /*----Style Tab----*/ |
| 224 | do_action( 'eael/login-register/before-style-controls', $this ); |
| 225 | $this->init_style_general_controls(); |
| 226 | $this->init_style_header_content_controls( 'login' ); |
| 227 | $this->init_style_header_content_controls( 'register' ); |
| 228 | $this->init_style_input_fields_controls(); |
| 229 | $this->init_style_input_labels_controls(); |
| 230 | $this->init_style_login_button_controls(); |
| 231 | $this->init_style_register_button_controls(); |
| 232 | $this->init_style_login_link_controls(); |
| 233 | $this->init_style_register_link_controls(); |
| 234 | $this->init_style_login_recaptcha_controls(); |
| 235 | $this->init_style_register_recaptcha_controls(); |
| 236 | do_action( 'eael/login-register/after-style-controls', $this ); |
| 237 | |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * It adds controls related to Login Form Types section to the Widget Content Tab |
| 242 | */ |
| 243 | protected function init_content_general_controls() { |
| 244 | $this->start_controls_section( 'section_content_general', [ |
| 245 | 'label' => __( 'General', 'essential-addons-for-elementor-lite' ), |
| 246 | ] ); |
| 247 | $this->add_control( 'default_form_type_notice', [ |
| 248 | 'type' => Controls_Manager::RAW_HTML, |
| 249 | 'raw' => __( 'Choose the type of form you want to show by default. Note: you can show both forms in a single page even if you select only login or registration from below.', 'essential-addons-for-elementor-lite' ), |
| 250 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 251 | ] ); |
| 252 | $this->add_control( 'default_form_type', [ |
| 253 | 'label' => __( 'Default Form Type', 'essential-addons-for-elementor-lite' ), |
| 254 | 'type' => Controls_Manager::SELECT, |
| 255 | 'options' => [ |
| 256 | 'login' => __( 'Login', 'essential-addons-for-elementor-lite' ), |
| 257 | 'register' => __( 'Registration', 'essential-addons-for-elementor-lite' ), |
| 258 | ], |
| 259 | 'default' => 'login', |
| 260 | ] ); |
| 261 | if ( ! $this->user_can_register ) { |
| 262 | $this->add_control( 'registration_off_notice', [ |
| 263 | 'type' => Controls_Manager::RAW_HTML, |
| 264 | /* translators: %1$s is settings page link open tag, %2$s is link closing tag */ |
| 265 | 'raw' => sprintf( __( 'Registration is disabled on your site. Please enable it to use registration form. You can enable it from Dashboard » Settings » General » %1$sMembership%2$s.', 'essential-addons-for-elementor-lite' ), '<a href="' . esc_attr( esc_url( admin_url( 'options-general.php' ) ) ) . '" target="_blank">', '</a>' ), |
| 266 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', |
| 267 | 'condition' => [ |
| 268 | 'default_form_type' => 'register', |
| 269 | ], |
| 270 | ] ); |
| 271 | } |
| 272 | $this->add_control( 'hide_for_logged_in_user', [ |
| 273 | 'label' => __( 'Hide all Forms from Logged-in Users', 'essential-addons-for-elementor-lite' ), |
| 274 | 'type' => Controls_Manager::SWITCHER, |
| 275 | 'default' => 'yes', |
| 276 | ] ); |
| 277 | $this->add_control( 'redirect_for_logged_in_user', [ |
| 278 | 'label' => __( 'Redirect for Logged-in Users', 'essential-addons-for-elementor-lite' ), |
| 279 | 'type' => Controls_Manager::SWITCHER, |
| 280 | 'default' => 'no', |
| 281 | ] ); |
| 282 | $this->add_control( 'redirect_url_for_logged_in_user', [ |
| 283 | 'type' => Controls_Manager::URL, |
| 284 | 'show_label' => false, |
| 285 | 'show_external' => false, |
| 286 | 'placeholder' => site_url(), |
| 287 | 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'essential-addons-for-elementor-lite' ), |
| 288 | 'condition' => [ |
| 289 | 'redirect_for_logged_in_user' => 'yes', |
| 290 | ], |
| 291 | 'default' => [ |
| 292 | 'url' => site_url(), |
| 293 | 'is_external' => false, |
| 294 | 'nofollow' => true, |
| 295 | ], |
| 296 | ] ); |
| 297 | $this->add_control( 'gen_lgn_content_po_toggle', [ |
| 298 | 'label' => __( 'Login Form General', 'essential-addons-for-elementor-lite' ), |
| 299 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 300 | 'label_off' => __( 'Controls', 'essential-addons-for-elementor-lite' ), |
| 301 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 302 | 'return_value' => 'yes', |
| 303 | 'default' => 'yes', |
| 304 | ] ); |
| 305 | $this->start_popover(); |
| 306 | $this->add_control( 'show_log_out_message', [ |
| 307 | 'label' => __( 'Show Logout Link', 'essential-addons-for-elementor-lite' ), |
| 308 | 'type' => Controls_Manager::SWITCHER, |
| 309 | 'default' => 'yes', |
| 310 | ] ); |
| 311 | $this->add_control( 'show_lost_password', [ |
| 312 | 'label' => __( 'Show Lost your password?', 'essential-addons-for-elementor-lite' ), |
| 313 | 'type' => Controls_Manager::SWITCHER, |
| 314 | 'default' => 'yes', |
| 315 | ] ); |
| 316 | |
| 317 | $this->add_control( 'lost_password_text', [ |
| 318 | 'label' => __( 'Lost Password Text', 'essential-addons-for-elementor-lite' ), |
| 319 | 'label_block' => true, |
| 320 | 'type' => Controls_Manager::TEXT, |
| 321 | 'dynamic' => [ |
| 322 | 'active' => true, |
| 323 | ], |
| 324 | 'default' => __( 'Forgot password?', 'essential-addons-for-elementor-lite' ), |
| 325 | 'condition' => [ |
| 326 | 'show_lost_password' => 'yes', |
| 327 | ], |
| 328 | ] ); |
| 329 | $this->add_control( 'lost_password_link_type', [ |
| 330 | 'label' => __( 'Lost Password Link to', 'essential-addons-for-elementor-lite' ), |
| 331 | 'label_block' => true, |
| 332 | 'type' => Controls_Manager::SELECT, |
| 333 | 'options' => [ |
| 334 | 'default' => __( 'Default WordPress Page', 'essential-addons-for-elementor-lite' ), |
| 335 | 'custom' => __( 'Custom URL', 'essential-addons-for-elementor-lite' ), |
| 336 | ], |
| 337 | 'default' => 'default', |
| 338 | 'condition' => [ |
| 339 | 'show_lost_password' => 'yes', |
| 340 | ], |
| 341 | ] ); |
| 342 | $this->add_control( 'lost_password_url', [ |
| 343 | 'label' => __( 'Custom Lost Password URL', 'essential-addons-for-elementor-lite' ), |
| 344 | 'label_block' => true, |
| 345 | 'type' => Controls_Manager::URL, |
| 346 | 'show_external' => false, |
| 347 | 'dynamic' => [ |
| 348 | 'active' => true, |
| 349 | ], |
| 350 | 'condition' => [ |
| 351 | 'lost_password_link_type' => 'custom', |
| 352 | 'show_lost_password' => 'yes', |
| 353 | ], |
| 354 | ] ); |
| 355 | $this->add_control( 'login_show_remember_me', [ |
| 356 | 'label' => __( 'Remember Me Field', 'essential-addons-for-elementor-lite' ), |
| 357 | 'type' => Controls_Manager::SWITCHER, |
| 358 | 'default' => 'yes', |
| 359 | 'label_off' => __( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 360 | 'label_on' => __( 'Show', 'essential-addons-for-elementor-lite' ), |
| 361 | ] ); |
| 362 | $this->add_control( 'remember_text', [ |
| 363 | 'label' => __( 'Remember Me Field Text', 'essential-addons-for-elementor-lite' ), |
| 364 | 'label_block' => true, |
| 365 | 'type' => Controls_Manager::TEXT, |
| 366 | 'dynamic' => [ |
| 367 | 'active' => true, |
| 368 | ], |
| 369 | 'default' => __( 'Remember Me', 'essential-addons-for-elementor-lite' ), |
| 370 | 'condition' => [ |
| 371 | 'login_show_remember_me' => 'yes', |
| 372 | ], |
| 373 | ] ); |
| 374 | if ( $this->user_can_register ) { |
| 375 | $this->add_control( 'reg_hr', [ |
| 376 | 'type' => Controls_Manager::DIVIDER, |
| 377 | ] ); |
| 378 | $this->add_control( 'show_register_link', [ |
| 379 | 'label' => __( 'Show Register Link', 'essential-addons-for-elementor-lite' ), |
| 380 | 'type' => Controls_Manager::SWITCHER, |
| 381 | 'default' => 'yes', |
| 382 | 'separator' => 'before', |
| 383 | |
| 384 | ] ); |
| 385 | $this->add_control( 'registration_link_text', [ |
| 386 | 'label' => __( 'Register Link Text', 'essential-addons-for-elementor-lite' ), |
| 387 | 'label_block' => true, |
| 388 | 'description' => __( 'You can put text in two lines to make the last line linkable. Pro Tip: You can keep the first line empty and put the text only in the second line to get a link only.', 'essential-addons-for-elementor-lite' ), |
| 389 | 'type' => Controls_Manager::TEXTAREA, |
| 390 | 'rows' => 2, |
| 391 | 'dynamic' => [ |
| 392 | 'active' => true, |
| 393 | ], |
| 394 | 'default' => __( " \nRegister Now", 'essential-addons-for-elementor-lite' ), |
| 395 | 'condition' => [ |
| 396 | 'show_register_link' => 'yes', |
| 397 | ], |
| 398 | ] ); |
| 399 | $this->add_control( 'registration_link_action', [ |
| 400 | 'label' => __( 'Registration Link Action', 'essential-addons-for-elementor-lite' ), |
| 401 | 'label_block' => true, |
| 402 | 'type' => Controls_Manager::SELECT, |
| 403 | 'options' => [ |
| 404 | 'default' => __( 'WordPress Registration Page', 'essential-addons-for-elementor-lite' ), |
| 405 | 'custom' => __( 'Custom URL', 'essential-addons-for-elementor-lite' ), |
| 406 | 'form' => __( 'Show Register Form', 'essential-addons-for-elementor-lite' ), |
| 407 | ], |
| 408 | 'default' => 'form', |
| 409 | 'condition' => [ |
| 410 | 'show_register_link' => 'yes', |
| 411 | ], |
| 412 | ] ); |
| 413 | $this->add_control( 'custom_register_url', [ |
| 414 | 'label' => __( 'Custom Register URL', 'essential-addons-for-elementor-lite' ), |
| 415 | 'label_block' => true, |
| 416 | 'type' => Controls_Manager::URL, |
| 417 | 'show_external' => false, |
| 418 | 'dynamic' => [ |
| 419 | 'active' => true, |
| 420 | ], |
| 421 | 'condition' => [ |
| 422 | 'registration_link_action' => 'custom', |
| 423 | 'show_register_link' => 'yes', |
| 424 | ], |
| 425 | ] ); |
| 426 | } else { |
| 427 | $this->add_control( 'show_register_link', [ |
| 428 | 'label' => __( 'Show Register Link', 'essential-addons-for-elementor-lite' ), |
| 429 | 'type' => Controls_Manager::HIDDEN, |
| 430 | 'default' => 'no', |
| 431 | 'separator' => 'before', |
| 432 | ] ); |
| 433 | } |
| 434 | $this->add_control( 'enable_login_recaptcha', [ |
| 435 | 'label' => __( 'Enable Google reCAPTCHA', 'essential-addons-for-elementor-lite' ), |
| 436 | 'description' => __( 'reCAPTCHA will prevent spam login from bots.', 'essential-addons-for-elementor-lite' ), |
| 437 | 'type' => Controls_Manager::SWITCHER, |
| 438 | 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ), |
| 439 | 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ), |
| 440 | 'return_value' => 'yes', |
| 441 | ] ); |
| 442 | if ( empty( $this->recaptcha_sitekey ) ) { |
| 443 | $this->add_control( 'eael_login_recaptcha_keys_missing', [ |
| 444 | 'type' => Controls_Manager::RAW_HTML, |
| 445 | 'raw' => sprintf( __( 'reCAPTCHA API keys are missing. Please add them from %sDashboard >> Essential Addons >> Elements >> Login | Register Form %sSettings', 'essential-addons-for-elementor-lite' ), '<strong>', '</strong>' ), |
| 446 | 'content_classes' => 'eael-warning', |
| 447 | 'condition' => [ |
| 448 | 'enable_login_recaptcha' => 'yes', |
| 449 | ], |
| 450 | ] ); |
| 451 | } |
| 452 | $this->end_popover(); |
| 453 | |
| 454 | |
| 455 | /*--show registration related control only if registration is enable on the site--*/ |
| 456 | if ( $this->user_can_register ) { |
| 457 | $this->add_control( 'gen_reg_content_po_toggle', [ |
| 458 | 'label' => __( 'Register Form General', 'essential-addons-for-elementor-lite' ), |
| 459 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 460 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 461 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 462 | 'return_value' => 'yes', |
| 463 | 'default' => 'yes', |
| 464 | ] ); |
| 465 | $this->start_popover(); |
| 466 | $this->add_control( 'show_login_link', [ |
| 467 | 'label' => __( 'Show Login Link', 'essential-addons-for-elementor-lite' ), |
| 468 | 'type' => Controls_Manager::SWITCHER, |
| 469 | 'default' => 'yes', |
| 470 | ] ); |
| 471 | $this->add_control( 'login_link_text', [ |
| 472 | 'label' => __( 'Login Link Text', 'essential-addons-for-elementor-lite' ), |
| 473 | 'label_block' => true, |
| 474 | 'description' => __( 'You can put text in two lines to make the last line linkable. Pro Tip: You can keep the first line empty and put the text only in the second line to get a link only.', 'essential-addons-for-elementor-lite' ), |
| 475 | 'type' => Controls_Manager::TEXTAREA, |
| 476 | 'rows' => 2, |
| 477 | 'dynamic' => [ |
| 478 | 'active' => true, |
| 479 | ], |
| 480 | 'default' => __( " \nSign In", 'essential-addons-for-elementor-lite' ), |
| 481 | 'condition' => [ |
| 482 | 'show_login_link' => 'yes', |
| 483 | ], |
| 484 | ] ); |
| 485 | $this->add_control( 'login_link_action', [ |
| 486 | 'label' => __( 'Login Link Action', 'essential-addons-for-elementor-lite' ), |
| 487 | 'label_block' => true, |
| 488 | 'type' => Controls_Manager::SELECT, |
| 489 | 'options' => [ |
| 490 | 'default' => __( 'Default WordPress Page', 'essential-addons-for-elementor-lite' ), |
| 491 | 'custom' => __( 'Custom URL', 'essential-addons-for-elementor-lite' ), |
| 492 | 'form' => __( 'Show Login Form', 'essential-addons-for-elementor-lite' ), |
| 493 | ], |
| 494 | 'default' => 'form', |
| 495 | 'condition' => [ |
| 496 | 'show_login_link' => 'yes', |
| 497 | ], |
| 498 | ] ); |
| 499 | $this->add_control( 'custom_login_url', [ |
| 500 | 'label' => __( 'Custom Login URL', 'essential-addons-for-elementor-lite' ), |
| 501 | 'label_block' => true, |
| 502 | 'show_external' => false, |
| 503 | 'type' => Controls_Manager::URL, |
| 504 | 'dynamic' => [ |
| 505 | 'active' => true, |
| 506 | ], |
| 507 | 'condition' => [ |
| 508 | 'login_link_action' => 'custom', |
| 509 | 'show_login_link' => 'yes', |
| 510 | ], |
| 511 | ] ); |
| 512 | $this->add_control( 'enable_register_recaptcha', [ |
| 513 | 'label' => __( 'Enable Google reCAPTCHA', 'essential-addons-for-elementor-lite' ), |
| 514 | 'description' => __( 'reCAPTCHA will prevent spam registration from bots.', 'essential-addons-for-elementor-lite' ), |
| 515 | 'type' => Controls_Manager::SWITCHER, |
| 516 | 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ), |
| 517 | 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ), |
| 518 | 'return_value' => 'yes', |
| 519 | ] ); |
| 520 | if ( empty( $this->recaptcha_sitekey ) ) { |
| 521 | $this->add_control( 'eael_recaptcha_keys_missing', [ |
| 522 | 'type' => Controls_Manager::RAW_HTML, |
| 523 | 'raw' => sprintf( __( 'reCAPTCHA API keys are missing. Please add them from %sDashboard >> Essential Addons >> Elements >> Login | Register Form %sSettings', 'essential-addons-for-elementor-lite' ), '<strong>', '</strong>' ), |
| 524 | 'content_classes' => 'eael-warning', |
| 525 | 'condition' => [ |
| 526 | 'enable_register_recaptcha' => 'yes', |
| 527 | ], |
| 528 | ] ); |
| 529 | } |
| 530 | $this->end_popover(); |
| 531 | |
| 532 | } else { |
| 533 | $this->add_control( 'show_login_link', [ |
| 534 | 'label' => __( 'Show Login Link', 'essential-addons-for-elementor-lite' ), |
| 535 | 'type' => Controls_Manager::HIDDEN, |
| 536 | 'default' => 'no', |
| 537 | ] ); |
| 538 | } |
| 539 | |
| 540 | do_action( 'eael/login-register/after-general-controls', $this ); |
| 541 | |
| 542 | if ( !$this->pro_enabled ) { |
| 543 | $this->add_control( 'enable_ajax', [ |
| 544 | 'label' => sprintf( __( 'Submit Form via AJAX %s', 'essential-addons-for-elementor-lite' ), '<i class="eael-pro-labe eicon-pro-icon"></i>' ), |
| 545 | 'type' => Controls_Manager::SWITCHER, |
| 546 | 'classes' => 'eael-pro-control', |
| 547 | ] ); |
| 548 | } |
| 549 | |
| 550 | $this->end_controls_section(); |
| 551 | } |
| 552 | |
| 553 | /** |
| 554 | * It adds controls related to Login Form Fields section to the Widget Content Tab |
| 555 | */ |
| 556 | protected function init_content_login_fields_controls() { |
| 557 | $this->start_controls_section( 'section_content_login_fields', [ |
| 558 | 'label' => __( 'Login Form Fields', 'essential-addons-for-elementor-lite' ), |
| 559 | 'conditions' => $this->get_form_controls_display_condition( 'login' ), |
| 560 | ] ); |
| 561 | |
| 562 | $this->add_control( 'login_label_types', [ |
| 563 | 'label' => __( 'Labels & Placeholders', 'essential-addons-for-elementor-lite' ), |
| 564 | 'type' => Controls_Manager::SELECT, |
| 565 | 'options' => [ |
| 566 | 'default' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 567 | 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 568 | 'none' => __( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 569 | ], |
| 570 | 'default' => 'default', |
| 571 | ] ); |
| 572 | |
| 573 | $this->add_control( 'login_labels_heading', [ |
| 574 | 'label' => __( 'Labels', 'essential-addons-for-elementor-lite' ), |
| 575 | 'type' => Controls_Manager::HEADING, |
| 576 | 'separator' => 'before', |
| 577 | 'condition' => [ 'login_label_types' => 'custom', ], |
| 578 | ] ); |
| 579 | |
| 580 | |
| 581 | $this->add_control( 'login_user_label', [ |
| 582 | 'label' => __( 'Username Label', 'essential-addons-for-elementor-lite' ), |
| 583 | 'placeholder' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ), |
| 584 | 'default' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ), |
| 585 | 'type' => Controls_Manager::TEXT, |
| 586 | 'dynamic' => [ 'active' => true, ], |
| 587 | 'label_block' => true, |
| 588 | 'condition' => [ 'login_label_types' => 'custom', ], |
| 589 | ] ); |
| 590 | |
| 591 | $this->add_control( 'login_password_label', [ |
| 592 | 'label' => __( 'Password Label', 'essential-addons-for-elementor-lite' ), |
| 593 | 'placeholder' => __( 'Password', 'essential-addons-for-elementor-lite' ), |
| 594 | 'default' => __( 'Password', 'essential-addons-for-elementor-lite' ), |
| 595 | 'type' => Controls_Manager::TEXT, |
| 596 | 'dynamic' => [ 'active' => true, ], |
| 597 | 'label_block' => true, |
| 598 | 'condition' => [ 'login_label_types' => 'custom', ], |
| 599 | ] ); |
| 600 | |
| 601 | $this->add_control( 'login_placeholders_heading', [ |
| 602 | 'label' => esc_html__( 'Placeholders', 'essential-addons-for-elementor-lite' ), |
| 603 | 'type' => Controls_Manager::HEADING, |
| 604 | 'condition' => [ 'login_label_types' => 'custom', ], |
| 605 | 'separator' => 'before', |
| 606 | ] ); |
| 607 | |
| 608 | $this->add_control( 'login_user_placeholder', [ |
| 609 | 'label' => __( 'Username Placeholder', 'essential-addons-for-elementor-lite' ), |
| 610 | 'placeholder' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ), |
| 611 | 'default' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ), |
| 612 | 'type' => Controls_Manager::TEXT, |
| 613 | 'dynamic' => [ 'active' => true, ], |
| 614 | 'label_block' => true, |
| 615 | 'condition' => [ 'login_label_types' => 'custom', ], |
| 616 | ] ); |
| 617 | |
| 618 | $this->add_control( 'login_password_placeholder', [ |
| 619 | 'label' => __( 'Password Placeholder', 'essential-addons-for-elementor-lite' ), |
| 620 | 'placeholder' => __( 'Password', 'essential-addons-for-elementor-lite' ), |
| 621 | 'default' => __( 'Password', 'essential-addons-for-elementor-lite' ), |
| 622 | 'type' => Controls_Manager::TEXT, |
| 623 | 'dynamic' => [ 'active' => true, ], |
| 624 | 'label_block' => true, |
| 625 | 'condition' => [ 'login_label_types' => 'custom', ], |
| 626 | ] ); |
| 627 | |
| 628 | $this->add_responsive_control( 'login_field_width', [ |
| 629 | 'label' => esc_html__( 'Input Fields width', 'essential-addons-for-elementor-lite' ), |
| 630 | 'type' => Controls_Manager::SLIDER, |
| 631 | 'size_units' => [ |
| 632 | 'px', |
| 633 | '%', |
| 634 | ], |
| 635 | 'range' => [ |
| 636 | 'px' => [ |
| 637 | 'min' => 0, |
| 638 | 'max' => 500, |
| 639 | 'step' => 5, |
| 640 | ], |
| 641 | '%' => [ |
| 642 | 'min' => 0, |
| 643 | 'max' => 100, |
| 644 | ], |
| 645 | ], |
| 646 | 'default' => [ |
| 647 | 'unit' => '%', |
| 648 | 'size' => 100, |
| 649 | ], |
| 650 | 'selectors' => [ |
| 651 | '{{WRAPPER}} .eael-login-form input:not(.eael-lr-btn)' => 'width: {{SIZE}}{{UNIT}};', |
| 652 | ], |
| 653 | 'separator' => 'before', |
| 654 | ] ); |
| 655 | |
| 656 | $this->add_control( 'password_toggle', [ |
| 657 | 'label' => __( 'Password Visibility Icon', 'essential-addons-for-elementor-lite' ), |
| 658 | 'type' => Controls_Manager::SWITCHER, |
| 659 | 'label_off' => __( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 660 | 'label_on' => __( 'Show', 'essential-addons-for-elementor-lite' ), |
| 661 | 'default' => 'yes', |
| 662 | ] ); |
| 663 | do_action( 'eael/login-register/after-pass-visibility-controls', $this ); |
| 664 | |
| 665 | |
| 666 | /*--Login Fields Button--*/ |
| 667 | $this->add_control( 'login_button_heading', [ |
| 668 | 'label' => esc_html__( 'Login Button', 'essential-addons-for-elementor-lite' ), |
| 669 | 'type' => Controls_Manager::HEADING, |
| 670 | 'separator' => 'before', |
| 671 | ] ); |
| 672 | |
| 673 | $this->add_control( 'login_button_text', [ |
| 674 | 'label' => __( 'Button Text', 'essential-addons-for-elementor-lite' ), |
| 675 | 'type' => Controls_Manager::TEXT, |
| 676 | 'dynamic' => [ 'active' => true, ], |
| 677 | 'default' => __( 'Log In', 'essential-addons-for-elementor-lite' ), |
| 678 | 'placeholder' => __( 'Log In', 'essential-addons-for-elementor-lite' ), |
| 679 | ] ); |
| 680 | |
| 681 | $this->end_controls_section(); |
| 682 | } |
| 683 | |
| 684 | protected function init_form_header_controls() { |
| 685 | $this->start_controls_section( 'section_content_lr_form_header', [ |
| 686 | 'label' => __( 'Form Header Content', 'essential-addons-for-elementor-lite' ), |
| 687 | ] ); |
| 688 | |
| 689 | $this->add_control( 'lr_form_image', [ |
| 690 | 'label' => __( 'Form Header Image', 'essential-addons-for-elementor-lite' ), |
| 691 | 'type' => Controls_Manager::MEDIA, |
| 692 | 'dynamic' => [ |
| 693 | 'active' => true, |
| 694 | ], |
| 695 | 'default' => [ |
| 696 | 'url' => Utils::get_placeholder_image_src(), |
| 697 | ], |
| 698 | ] ); |
| 699 | |
| 700 | $this->add_group_control( Group_Control_Image_Size::get_type(), [ |
| 701 | 'name' => 'lr_form_image', |
| 702 | // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_size` and `image_custom_dimension`. |
| 703 | 'default' => 'full', |
| 704 | 'separator' => 'none', |
| 705 | ] ); |
| 706 | |
| 707 | $this->add_control( "lr_form_image_position", [ |
| 708 | 'label' => __( 'Header Image Position', 'essential-addons-for-elementor-lite' ), |
| 709 | 'type' => Controls_Manager::CHOOSE, |
| 710 | 'options' => [ |
| 711 | 'left' => [ |
| 712 | 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ), |
| 713 | 'icon' => 'eicon-arrow-left', |
| 714 | ], |
| 715 | 'right' => [ |
| 716 | 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ), |
| 717 | 'icon' => 'eicon-arrow-right', |
| 718 | ], |
| 719 | ], |
| 720 | 'default' => 'left', |
| 721 | 'separator' => 'after', |
| 722 | ] ); |
| 723 | |
| 724 | $this->add_control( 'lr_form_logo', [ |
| 725 | 'label' => __( 'Form Header Logo', 'essential-addons-for-elementor-lite' ), |
| 726 | 'type' => Controls_Manager::MEDIA, |
| 727 | 'dynamic' => [ |
| 728 | 'active' => true, |
| 729 | ], |
| 730 | 'default' => [ |
| 731 | 'url' => Utils::get_placeholder_image_src(), |
| 732 | ], |
| 733 | ] ); |
| 734 | |
| 735 | $this->add_group_control( Group_Control_Image_Size::get_type(), [ |
| 736 | 'name' => 'lr_form_logo', |
| 737 | 'default' => 'full', |
| 738 | 'separator' => 'none', |
| 739 | ] ); |
| 740 | $this->add_control( "lr_form_logo_position", [ |
| 741 | 'label' => __( 'Form Logo Position', 'essential-addons-for-elementor-lite' ), |
| 742 | 'type' => Controls_Manager::CHOOSE, |
| 743 | 'options' => [ |
| 744 | 'inline' => [ |
| 745 | 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ), |
| 746 | 'icon' => 'eicon-arrow-left', |
| 747 | ], |
| 748 | 'block' => [ |
| 749 | 'title' => __( 'Top', 'essential-addons-for-elementor-lite' ), |
| 750 | 'icon' => 'eicon-arrow-up', |
| 751 | ], |
| 752 | ], |
| 753 | 'default' => 'left', |
| 754 | 'separator' => 'after', |
| 755 | ] ); |
| 756 | |
| 757 | $this->add_control( 'login_form_title', [ |
| 758 | 'label' => __( 'Login Form Title', 'essential-addons-for-elementor-lite' ), |
| 759 | 'type' => Controls_Manager::TEXT, |
| 760 | 'dynamic' => [ 'active' => true, ], |
| 761 | 'placeholder' => __( 'Welcome Back!', 'essential-addons-for-elementor-lite' ), |
| 762 | 'separator' => 'before', |
| 763 | ] ); |
| 764 | $this->add_control( 'login_form_subtitle', [ |
| 765 | 'label' => __( 'Login Form Sub Title', 'essential-addons-for-elementor-lite' ), |
| 766 | 'type' => Controls_Manager::TEXTAREA, |
| 767 | 'dynamic' => [ 'active' => true, ], |
| 768 | 'placeholder' => __( 'Please login to your account', 'essential-addons-for-elementor-lite' ), |
| 769 | ] ); |
| 770 | |
| 771 | $this->add_control( 'register_form_title', [ |
| 772 | 'label' => __( 'Register Form Title', 'essential-addons-for-elementor-lite' ), |
| 773 | 'type' => Controls_Manager::TEXT, |
| 774 | 'dynamic' => [ 'active' => true, ], |
| 775 | 'placeholder' => __( 'Create a New Account', 'essential-addons-for-elementor-lite' ), |
| 776 | 'separator' => 'before', |
| 777 | ] ); |
| 778 | $this->add_control( 'register_form_subtitle', [ |
| 779 | 'label' => __( 'Register Form Sub Title', 'essential-addons-for-elementor-lite' ), |
| 780 | 'type' => Controls_Manager::TEXTAREA, |
| 781 | 'dynamic' => [ 'active' => true, ], |
| 782 | 'placeholder' => __( 'Create an account to enjoy awesome features.', 'essential-addons-for-elementor-lite' ), |
| 783 | ] ); |
| 784 | |
| 785 | $this->end_controls_section(); |
| 786 | } |
| 787 | |
| 788 | protected function init_content_login_options_controls() { |
| 789 | |
| 790 | $this->start_controls_section( 'section_content_login_options', [ |
| 791 | 'label' => __( 'Login Form Options', 'essential-addons-for-elementor-lite' ), |
| 792 | 'conditions' => $this->get_form_controls_display_condition( 'login' ), |
| 793 | ] ); |
| 794 | |
| 795 | $this->add_control( 'redirect_after_login', [ |
| 796 | 'label' => __( 'Redirect After Login', 'essential-addons-for-elementor-lite' ), |
| 797 | 'type' => Controls_Manager::SWITCHER, |
| 798 | ] ); |
| 799 | |
| 800 | $this->add_control( 'redirect_url', [ |
| 801 | 'type' => Controls_Manager::URL, |
| 802 | 'show_label' => false, |
| 803 | 'show_external' => false, |
| 804 | 'placeholder' => admin_url(), |
| 805 | 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'essential-addons-for-elementor-lite' ), |
| 806 | 'condition' => [ |
| 807 | 'redirect_after_login' => 'yes', |
| 808 | ], |
| 809 | 'default' => [ |
| 810 | 'url' => admin_url(), |
| 811 | 'is_external' => false, |
| 812 | 'nofollow' => true, |
| 813 | ], |
| 814 | 'separator' => 'after', |
| 815 | ] ); |
| 816 | |
| 817 | $this->end_controls_section(); |
| 818 | } |
| 819 | |
| 820 | protected function social_login_promo() { |
| 821 | |
| 822 | $this->start_controls_section( 'section_content_social_login', [ |
| 823 | 'label' => __( 'Social Login', 'essential-addons-elementor' ), |
| 824 | 'conditions' => $this->get_form_controls_display_condition( 'login' ), |
| 825 | ] ); |
| 826 | |
| 827 | $this->add_control( 'enable_google_login', [ |
| 828 | 'label' => sprintf( __( 'Enable Login with Google %s', 'essential-addons-for-elementor-lite' ), '<i class="eael-pro-labe eicon-pro-icon"></i>' ), |
| 829 | 'type' => Controls_Manager::SWITCHER, |
| 830 | 'classes' => 'eael-pro-control', |
| 831 | ] ); |
| 832 | |
| 833 | $this->add_control( 'enable_fb_login', [ |
| 834 | 'label' => sprintf( __( 'Enable Login with Facebook %s', 'essential-addons-for-elementor-lite' ), '<i class="eael-pro-labe eicon-pro-icon"></i>' ), |
| 835 | 'type' => Controls_Manager::SWITCHER, |
| 836 | 'classes' => 'eael-pro-control', |
| 837 | ] ); |
| 838 | |
| 839 | $this->end_controls_section(); |
| 840 | } |
| 841 | |
| 842 | protected function init_content_terms_controls() { |
| 843 | $this->start_controls_section( 'section_content_terms_conditions', [ |
| 844 | 'label' => __( 'Terms & Conditions', 'essential-addons-for-elementor-lite' ), |
| 845 | 'conditions' => $this->get_form_controls_display_condition( 'register' ), |
| 846 | ] ); |
| 847 | |
| 848 | $this->add_control( 'show_terms_conditions', [ |
| 849 | 'label' => __( 'Enforce Terms & Conditions', 'essential-addons-for-elementor-lite' ), |
| 850 | 'type' => Controls_Manager::SWITCHER, |
| 851 | 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ), |
| 852 | 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ), |
| 853 | 'default' => 'no', |
| 854 | 'return_value' => 'yes', |
| 855 | ] ); |
| 856 | |
| 857 | $this->add_control( 'acceptance_label', [ |
| 858 | 'label' => __( 'Acceptance Label', 'essential-addons-for-elementor-lite' ), |
| 859 | 'description' => __( 'Eg. I accept the terms & conditions. Note: First line is checkbox label & Last line will be used as link text.', 'essential-addons-for-elementor-lite' ), |
| 860 | 'type' => Controls_Manager::TEXTAREA, |
| 861 | 'rows' => 2, |
| 862 | 'label_block' => true, |
| 863 | 'placeholder' => __( 'I Accept the Terms and Conditions.', 'essential-addons-for-elementor-lite' ), |
| 864 | /* translators: \n means new line. So, Don't translate this*/ |
| 865 | 'default' => __( "I Accept\n the Terms and Conditions.", 'essential-addons-for-elementor-lite' ), |
| 866 | 'condition' => [ |
| 867 | 'show_terms_conditions' => 'yes', |
| 868 | ], |
| 869 | ] ); |
| 870 | |
| 871 | $this->add_control( 'acceptance_text_source', [ |
| 872 | 'label' => __( 'Content Source', 'essential-addons-for-elementor-lite' ), |
| 873 | 'type' => Controls_Manager::SELECT, |
| 874 | 'options' => [ |
| 875 | 'editor' => __( 'Editor', 'essential-addons-for-elementor-lite' ), |
| 876 | 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 877 | ], |
| 878 | 'default' => 'custom', |
| 879 | 'condition' => [ |
| 880 | 'show_terms_conditions' => 'yes', |
| 881 | ], |
| 882 | ] ); |
| 883 | |
| 884 | $this->add_control( 'acceptance_text', [ |
| 885 | 'label' => __( 'Terms and Conditions', 'essential-addons-for-elementor-lite' ), |
| 886 | 'type' => Controls_Manager::WYSIWYG, |
| 887 | 'rows' => 3, |
| 888 | 'default' => __( 'Please go through the following terms and conditions carefully.', 'essential-addons-for-elementor-lite' ), |
| 889 | 'condition' => [ |
| 890 | 'show_terms_conditions' => 'yes', |
| 891 | 'acceptance_text_source' => 'editor', |
| 892 | ], |
| 893 | ] ); |
| 894 | |
| 895 | |
| 896 | $this->add_control( 'acceptance_text_url', [ |
| 897 | 'label' => __( 'Terms & Conditions URL', 'essential-addons-for-elementor-lite' ), |
| 898 | 'description' => __( 'Enter the link where your terms & condition or privacy policy is found.', 'essential-addons-for-elementor-lite' ), |
| 899 | 'type' => Controls_Manager::URL, |
| 900 | 'dynamic' => [ |
| 901 | 'active' => true, |
| 902 | ], |
| 903 | 'default' => [ |
| 904 | 'url' => get_the_permalink( get_option( 'wp_page_for_privacy_policy' ) ), |
| 905 | 'is_external' => true, |
| 906 | 'nofollow' => true, |
| 907 | ], |
| 908 | 'condition' => [ |
| 909 | 'show_terms_conditions' => 'yes', |
| 910 | 'acceptance_text_source' => 'custom', |
| 911 | ], |
| 912 | ] ); |
| 913 | |
| 914 | $this->end_controls_section(); |
| 915 | } |
| 916 | |
| 917 | protected function init_content_validation_messages_controls() { |
| 918 | $this->start_controls_section( 'section_content_errors', [ |
| 919 | 'label' => __( 'Validation Messages', 'essential-addons-for-elementor-lite' ), |
| 920 | ] ); |
| 921 | |
| 922 | $this->add_control( 'err_message_heading', [ |
| 923 | 'label' => esc_html__( 'Error Messages', 'essential-addons-for-elementor-lite' ), |
| 924 | 'type' => Controls_Manager::HEADING, |
| 925 | ] ); |
| 926 | |
| 927 | $this->add_control( 'err_email', [ |
| 928 | 'label' => __( 'Invalid Email', 'essential-addons-for-elementor-lite' ), |
| 929 | 'type' => Controls_Manager::TEXT, |
| 930 | 'label_block' => true, |
| 931 | 'placeholder' => __( 'Eg. Your email is invalid.', 'essential-addons-for-elementor-lite' ), |
| 932 | 'default' => __( "You have used an invalid email", 'essential-addons-for-elementor-lite' ), |
| 933 | ] ); |
| 934 | $this->add_control( 'err_email_missing', [ |
| 935 | 'label' => __( 'Email is missing', 'essential-addons-for-elementor-lite' ), |
| 936 | 'type' => Controls_Manager::TEXT, |
| 937 | 'label_block' => true, |
| 938 | 'placeholder' => __( 'Eg. Email is missing or Invalid', 'essential-addons-for-elementor-lite' ), |
| 939 | 'default' => __( 'Email is missing or Invalid', 'essential-addons-for-elementor-lite' ), |
| 940 | ] ); |
| 941 | $this->add_control( 'err_email_used', [ |
| 942 | 'label' => __( 'Already Used Email', 'essential-addons-for-elementor-lite' ), |
| 943 | 'type' => Controls_Manager::TEXT, |
| 944 | 'label_block' => true, |
| 945 | 'placeholder' => __( 'Eg. Your email is already in use..', 'essential-addons-for-elementor-lite' ), |
| 946 | 'default' => __( 'The provided email is already registered with other account. Please login or reset password or use another email.', 'essential-addons-for-elementor-lite' ), |
| 947 | ] ); |
| 948 | $this->add_control( 'err_username', [ |
| 949 | 'label' => __( 'Invalid Username', 'essential-addons-for-elementor-lite' ), |
| 950 | 'type' => Controls_Manager::TEXT, |
| 951 | 'label_block' => true, |
| 952 | 'placeholder' => __( 'Eg. Your username is invalid.', 'essential-addons-for-elementor-lite' ), |
| 953 | 'default' => __( "You have used an invalid username", 'essential-addons-for-elementor-lite' ), |
| 954 | ] ); |
| 955 | $this->add_control( 'err_username_used', [ |
| 956 | 'label' => __( 'Username already in use', 'essential-addons-for-elementor-lite' ), |
| 957 | 'type' => Controls_Manager::TEXT, |
| 958 | 'label_block' => true, |
| 959 | 'placeholder' => __( 'Eg. Your username is already registered.', 'essential-addons-for-elementor-lite' ), |
| 960 | 'default' => __( 'Invalid username provided or the username already registered.', 'essential-addons-for-elementor-lite' ), |
| 961 | ] ); |
| 962 | $this->add_control( 'err_pass', [ |
| 963 | 'label' => __( 'Invalid Password', 'essential-addons-for-elementor-lite' ), |
| 964 | 'type' => Controls_Manager::TEXT, |
| 965 | 'label_block' => true, |
| 966 | 'placeholder' => __( 'Eg. Your password is invalid', 'essential-addons-for-elementor-lite' ), |
| 967 | 'default' => __( "Your password is invalid.", 'essential-addons-for-elementor-lite' ), |
| 968 | ] ); |
| 969 | |
| 970 | $this->add_control( 'err_conf_pass', [ |
| 971 | 'label' => __( 'Invalid Password Confirmed', 'essential-addons-for-elementor-lite' ), |
| 972 | 'type' => Controls_Manager::TEXT, |
| 973 | 'label_block' => true, |
| 974 | 'placeholder' => __( 'Eg. Password did not matched', 'essential-addons-for-elementor-lite' ), |
| 975 | 'default' => __( "Your confirmed password did not match", 'essential-addons-for-elementor-lite' ), |
| 976 | ] ); |
| 977 | |
| 978 | $this->add_control( 'err_loggedin', [ |
| 979 | 'label' => __( 'Already Logged In', 'essential-addons-for-elementor-lite' ), |
| 980 | 'type' => Controls_Manager::TEXT, |
| 981 | 'label_block' => true, |
| 982 | 'placeholder' => __( 'Eg. You are already logged in', 'essential-addons-for-elementor-lite' ), |
| 983 | 'default' => __( "You are already logged in", 'essential-addons-for-elementor-lite' ), |
| 984 | ] ); |
| 985 | |
| 986 | $this->add_control( 'err_recaptcha', [ |
| 987 | 'label' => __( 'reCAPTCHA Failed', 'essential-addons-for-elementor-lite' ), |
| 988 | 'type' => Controls_Manager::TEXT, |
| 989 | 'label_block' => true, |
| 990 | 'placeholder' => __( 'Eg. reCAPTCHA Validation Failed', 'essential-addons-for-elementor-lite' ), |
| 991 | 'default' => __( "You did not pass reCAPTCHA challenge.", 'essential-addons-for-elementor-lite' ), |
| 992 | ] ); |
| 993 | |
| 994 | $this->add_control( 'err_tc', [ |
| 995 | 'label' => __( 'Terms & Condition Error', 'essential-addons-for-elementor-lite' ), |
| 996 | 'type' => Controls_Manager::TEXT, |
| 997 | 'label_block' => true, |
| 998 | 'placeholder' => __( 'Eg. You must accept the Terms & Conditions', 'essential-addons-for-elementor-lite' ), |
| 999 | 'default' => __( 'You did not accept the Terms and Conditions. Please accept it and try again.', 'essential-addons-for-elementor-lite' ), |
| 1000 | ] ); |
| 1001 | |
| 1002 | $this->add_control( 'err_unknown', [ |
| 1003 | 'label' => __( 'Other Errors', 'essential-addons-for-elementor-lite' ), |
| 1004 | 'type' => Controls_Manager::TEXT, |
| 1005 | 'label_block' => true, |
| 1006 | 'placeholder' => __( 'Eg. Something went wrong', 'essential-addons-for-elementor-lite' ), |
| 1007 | 'default' => __( "Something went wrong!", 'essential-addons-for-elementor-lite' ), |
| 1008 | ] ); |
| 1009 | |
| 1010 | $this->add_control( 'success_message_heading', [ |
| 1011 | 'label' => esc_html__( 'Success Messages', 'essential-addons-for-elementor-lite' ), |
| 1012 | 'type' => Controls_Manager::HEADING, |
| 1013 | 'separator' => 'before', |
| 1014 | ] ); |
| 1015 | |
| 1016 | $this->add_control( 'success_login', [ |
| 1017 | 'label' => __( 'Successful Login', 'essential-addons-for-elementor-lite' ), |
| 1018 | 'type' => Controls_Manager::TEXT, |
| 1019 | 'label_block' => true, |
| 1020 | 'placeholder' => __( 'Eg. You have logged in successfully', 'essential-addons-for-elementor-lite' ), |
| 1021 | 'default' => __( "You have logged in successfully", 'essential-addons-for-elementor-lite' ), |
| 1022 | ] ); |
| 1023 | $this->add_control( 'success_register', [ |
| 1024 | 'label' => __( 'Successful Registration', 'essential-addons-for-elementor-lite' ), |
| 1025 | 'type' => Controls_Manager::TEXTAREA, |
| 1026 | 'default' => __( 'Registration completed successfully, Check your inbox for password if you did not provided while registering.', 'essential-addons-for-elementor-lite' ), |
| 1027 | 'placeholder' => __( 'eg. Registration completed successfully', 'essential-addons-for-elementor-lite' ), |
| 1028 | ] ); |
| 1029 | |
| 1030 | $this->end_controls_section(); |
| 1031 | } |
| 1032 | |
| 1033 | protected function show_pro_promotion(){ |
| 1034 | |
| 1035 | $this->start_controls_section( |
| 1036 | 'eael_section_pro', |
| 1037 | [ |
| 1038 | 'label' => __( 'Go Premium for More Features', 'essential-addons-for-elementor-lite' ), |
| 1039 | ] |
| 1040 | ); |
| 1041 | |
| 1042 | $this->add_control( |
| 1043 | 'eael_control_get_pro', |
| 1044 | [ |
| 1045 | 'label' => __( 'Unlock more possibilities', 'essential-addons-for-elementor-lite' ), |
| 1046 | 'type' => Controls_Manager::CHOOSE, |
| 1047 | 'options' => [ |
| 1048 | '1' => [ |
| 1049 | 'title' => '', |
| 1050 | 'icon' => 'fa fa-unlock-alt', |
| 1051 | ], |
| 1052 | ], |
| 1053 | 'default' => '1', |
| 1054 | 'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>', |
| 1055 | ] |
| 1056 | ); |
| 1057 | |
| 1058 | $this->end_controls_section(); |
| 1059 | |
| 1060 | } |
| 1061 | |
| 1062 | protected function init_content_register_fields_controls() { |
| 1063 | |
| 1064 | $this->start_controls_section( 'section_content_register_fields', [ |
| 1065 | 'label' => __( 'Register Form Fields', 'essential-addons-for-elementor-lite' ), |
| 1066 | 'conditions' => $this->get_form_controls_display_condition( 'register' ), |
| 1067 | ] ); |
| 1068 | $this->add_control( 'register_form_field_note', [ |
| 1069 | 'type' => Controls_Manager::RAW_HTML, |
| 1070 | 'raw' => __( 'Select the type of fields you want to show in the registration form', 'essential-addons-for-elementor-lite' ), |
| 1071 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1072 | ] ); |
| 1073 | $repeater = new Repeater(); |
| 1074 | |
| 1075 | $repeater->add_control( 'field_type', [ |
| 1076 | 'label' => __( 'Type', 'essential-addons-for-elementor-lite' ), |
| 1077 | 'type' => Controls_Manager::SELECT, |
| 1078 | 'options' => $this->get_form_field_types(), |
| 1079 | 'default' => 'first_name', |
| 1080 | ] ); |
| 1081 | |
| 1082 | $repeater->add_control( 'field_label', [ |
| 1083 | 'label' => __( 'Label', 'essential-addons-for-elementor-lite' ), |
| 1084 | 'type' => Controls_Manager::TEXT, |
| 1085 | 'default' => '', |
| 1086 | 'dynamic' => [ |
| 1087 | 'active' => true, |
| 1088 | ], |
| 1089 | ] ); |
| 1090 | |
| 1091 | $repeater->add_control( 'placeholder', [ |
| 1092 | 'label' => __( 'Placeholder', 'essential-addons-for-elementor-lite' ), |
| 1093 | 'type' => Controls_Manager::TEXT, |
| 1094 | 'default' => '', |
| 1095 | 'dynamic' => [ |
| 1096 | 'active' => true, |
| 1097 | ], |
| 1098 | ] ); |
| 1099 | |
| 1100 | $repeater->add_control( 'required', [ |
| 1101 | 'label' => __( 'Required', 'essential-addons-for-elementor-lite' ), |
| 1102 | 'type' => Controls_Manager::SWITCHER, |
| 1103 | 'condition' => [ |
| 1104 | 'field_type!' => [ |
| 1105 | 'email', |
| 1106 | 'password', |
| 1107 | 'confirm_pass', |
| 1108 | ], |
| 1109 | ], |
| 1110 | ] ); |
| 1111 | |
| 1112 | $repeater->add_control( 'required_note', [ |
| 1113 | 'type' => Controls_Manager::RAW_HTML, |
| 1114 | 'raw' => __( 'Note: This field is required by default.', 'essential-addons-for-elementor-lite' ), |
| 1115 | 'condition' => [ |
| 1116 | 'field_type' => [ |
| 1117 | 'email', |
| 1118 | 'password', |
| 1119 | 'confirm_pass', |
| 1120 | ], |
| 1121 | ], |
| 1122 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1123 | ] ); |
| 1124 | |
| 1125 | $repeater->add_responsive_control( 'width', [ |
| 1126 | 'label' => __( 'Field Width', 'essential-addons-for-elementor-lite' ), |
| 1127 | 'type' => Controls_Manager::SELECT, |
| 1128 | 'options' => [ |
| 1129 | '' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 1130 | '100' => '100%', |
| 1131 | '80' => '80%', |
| 1132 | '75' => '75%', |
| 1133 | '66' => '66%', |
| 1134 | '60' => '60%', |
| 1135 | '50' => '50%', |
| 1136 | '40' => '40%', |
| 1137 | '33' => '33%', |
| 1138 | '25' => '25%', |
| 1139 | '20' => '20%', |
| 1140 | ], |
| 1141 | 'default' => '100', |
| 1142 | ] ); |
| 1143 | apply_filters( 'eael/login-register/register-repeater', $repeater ); |
| 1144 | $rf = [ |
| 1145 | 'label' => __( 'Fields', 'essential-addons-for-elementor-lite' ), |
| 1146 | 'type' => Controls_Manager::REPEATER, |
| 1147 | 'fields' => apply_filters( 'eael/login-register/register-repeater-fields', $repeater->get_controls() ), |
| 1148 | 'default' => apply_filters( 'eael/login-register/register-rf-default', [ |
| 1149 | [ |
| 1150 | 'field_type' => 'user_name', |
| 1151 | 'field_label' => __( 'Username', 'essential-addons-for-elementor-lite' ), |
| 1152 | 'placeholder' => __( 'Username', 'essential-addons-for-elementor-lite' ), |
| 1153 | 'width' => '100', |
| 1154 | ], |
| 1155 | [ |
| 1156 | 'field_type' => 'email', |
| 1157 | 'field_label' => __( 'Email', 'essential-addons-for-elementor-lite' ), |
| 1158 | 'placeholder' => __( 'Email', 'essential-addons-for-elementor-lite' ), |
| 1159 | 'required' => 'yes', |
| 1160 | 'width' => '100', |
| 1161 | ], |
| 1162 | [ |
| 1163 | 'field_type' => 'password', |
| 1164 | 'field_label' => __( 'Password', 'essential-addons-for-elementor-lite' ), |
| 1165 | 'placeholder' => __( 'Password', 'essential-addons-for-elementor-lite' ), |
| 1166 | 'required' => 'yes', |
| 1167 | 'width' => '100', |
| 1168 | ], |
| 1169 | ] ), |
| 1170 | 'title_field' => '{{ field_label }}', |
| 1171 | ]; |
| 1172 | if ( $this->pro_enabled ) { |
| 1173 | $rf['title_field'] = '{{{ elementor.helpers.renderIcon( this, icon, {}, "i", "panel" ) || \'<i class="{{ icon }}" aria-hidden="true"></i>\' }}} {{ field_label }}'; |
| 1174 | } |
| 1175 | $this->add_control( 'register_fields', $rf ); |
| 1176 | |
| 1177 | $this->add_control( 'show_labels', [ |
| 1178 | 'label' => __( 'Show Label', 'essential-addons-for-elementor-lite' ), |
| 1179 | 'type' => Controls_Manager::SWITCHER, |
| 1180 | 'default' => 'yes', |
| 1181 | ] ); |
| 1182 | |
| 1183 | $this->add_control( 'mark_required', [ |
| 1184 | 'label' => __( 'Show Required Mark', 'essential-addons-for-elementor-lite' ), |
| 1185 | 'type' => Controls_Manager::SWITCHER, |
| 1186 | 'condition' => [ |
| 1187 | 'show_labels' => 'yes', |
| 1188 | ], |
| 1189 | ] ); |
| 1190 | do_action( 'eael/login-register/after-register-options-controls', $this ); |
| 1191 | |
| 1192 | /*--Register Fields Button--*/ |
| 1193 | $this->add_control( 'reg_button_heading', [ |
| 1194 | 'label' => esc_html__( 'Register Button', 'essential-addons-for-elementor-lite' ), |
| 1195 | 'type' => Controls_Manager::HEADING, |
| 1196 | 'separator' => 'before', |
| 1197 | ] ); |
| 1198 | |
| 1199 | $this->add_control( 'reg_button_text', [ |
| 1200 | 'label' => __( 'Button Text', 'essential-addons-for-elementor-lite' ), |
| 1201 | 'type' => Controls_Manager::TEXT, |
| 1202 | 'dynamic' => [ 'active' => true, ], |
| 1203 | 'default' => __( 'Register', 'essential-addons-for-elementor-lite' ), |
| 1204 | ] ); |
| 1205 | |
| 1206 | |
| 1207 | $this->end_controls_section(); |
| 1208 | } |
| 1209 | |
| 1210 | protected function init_content_register_options_controls() { |
| 1211 | |
| 1212 | $this->start_controls_section( 'section_content_register_actions', [ |
| 1213 | 'label' => __( 'Register Form Options', 'essential-addons-for-elementor-lite' ), |
| 1214 | 'conditions' => $this->get_form_controls_display_condition( 'register' ), |
| 1215 | ] ); |
| 1216 | |
| 1217 | $this->add_control( 'register_action', [ |
| 1218 | 'label' => __( 'Register Actions', 'essential-addons-for-elementor-lite' ), |
| 1219 | 'description' => __( 'You can select what should happen after a user registers successfully', 'essential-addons-for-elementor-lite' ), |
| 1220 | 'type' => Controls_Manager::SELECT2, |
| 1221 | 'multiple' => true, |
| 1222 | 'label_block' => true, |
| 1223 | 'default' => 'send_email', |
| 1224 | 'options' => [ |
| 1225 | 'redirect' => __( 'Redirect', 'essential-addons-for-elementor-lite' ), |
| 1226 | 'auto_login' => __( 'Auto Login', 'essential-addons-for-elementor-lite' ), |
| 1227 | 'send_email' => __( 'Notify User By Email', 'essential-addons-for-elementor-lite' ), |
| 1228 | ], |
| 1229 | ] ); |
| 1230 | |
| 1231 | $this->add_control( 'register_redirect_url', [ |
| 1232 | 'type' => Controls_Manager::URL, |
| 1233 | 'label' => __( 'Custom Redirect URL', 'essential-addons-for-elementor-lite' ), |
| 1234 | 'show_external' => false, |
| 1235 | 'placeholder' => __( 'eg. https://your-link.com/wp-admin/', 'essential-addons-for-elementor-lite' ), |
| 1236 | 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'essential-addons-for-elementor-lite' ), |
| 1237 | 'default' => [ |
| 1238 | 'url' => get_admin_url(), |
| 1239 | 'is_external' => false, |
| 1240 | 'nofollow' => true, |
| 1241 | ], |
| 1242 | 'condition' => [ |
| 1243 | 'register_action' => 'redirect', |
| 1244 | ], |
| 1245 | ] ); |
| 1246 | |
| 1247 | if(current_user_can('create_users')){ |
| 1248 | $user_role = $this->get_user_roles(); |
| 1249 | }else{ |
| 1250 | $user_role = [ |
| 1251 | get_option( 'default_role' ) => ucfirst(get_option( 'default_role' )) |
| 1252 | ]; |
| 1253 | } |
| 1254 | |
| 1255 | $this->add_control( 'register_user_role', [ |
| 1256 | 'label' => __( 'New User Role', 'essential-addons-for-elementor-lite' ), |
| 1257 | 'type' => Controls_Manager::SELECT, |
| 1258 | 'default' => '', |
| 1259 | 'options' => $user_role, |
| 1260 | 'separator' => 'before', |
| 1261 | ] ); |
| 1262 | |
| 1263 | $this->end_controls_section(); |
| 1264 | } |
| 1265 | |
| 1266 | protected function init_content_register_user_email_controls() { |
| 1267 | /* translators: %s: Site Name */ |
| 1268 | $default_subject = sprintf( __( 'Thank you for registering on "%s"!', 'essential-addons-for-elementor-lite' ), get_option( 'blogname' ) ); |
| 1269 | $default_message = $default_subject . "\r\n\r\n"; |
| 1270 | $default_message .= __( 'Username: [username]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n"; |
| 1271 | $default_message .= __( 'Password: [password]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n"; |
| 1272 | $default_message .= __( 'To reset your password, visit the following address:', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n"; |
| 1273 | $default_message .= "[password_reset_link]\r\n\r\n"; |
| 1274 | $default_message .= __( 'Please click the following address to login to your account:', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n"; |
| 1275 | $default_message .= wp_login_url() . "\r\n"; |
| 1276 | |
| 1277 | $this->start_controls_section( 'section_content_reg_email', [ |
| 1278 | 'label' => __( 'Register User Email Options', 'essential-addons-for-elementor-lite' ), |
| 1279 | 'conditions' => [ |
| 1280 | 'relation' => 'or', |
| 1281 | 'terms' => [ |
| 1282 | [ |
| 1283 | 'name' => 'show_register_link', |
| 1284 | 'value' => 'yes', |
| 1285 | //@TODO; debug why multi-level condition is not working. |
| 1286 | //'relation' => 'and', |
| 1287 | //'terms' => [ |
| 1288 | // [ |
| 1289 | // 'name' => 'register_action', |
| 1290 | // 'value' => 'send_email', |
| 1291 | // 'operator' => '===', |
| 1292 | // ], |
| 1293 | //], |
| 1294 | ], |
| 1295 | [ |
| 1296 | 'name' => 'default_form_type', |
| 1297 | 'value' => 'register', |
| 1298 | //'relation' => 'and', |
| 1299 | //'terms' => [ |
| 1300 | // [ |
| 1301 | // 'name' => 'register_action', |
| 1302 | // 'value' => 'send_email', |
| 1303 | // 'operator' => '===', |
| 1304 | // ], |
| 1305 | //], |
| 1306 | ], |
| 1307 | ], |
| 1308 | ], |
| 1309 | ] ); |
| 1310 | |
| 1311 | $this->add_control( 'reg_email_template_type', [ |
| 1312 | 'label' => __( 'Email Template Type', 'essential-addons-for-elementor-lite' ), |
| 1313 | 'description' => __( 'Default template uses WordPress Default email template. So, please select the Custom Option to send the user proper information if you used any username field.', 'essential-addons-for-elementor-lite' ), |
| 1314 | 'type' => Controls_Manager::SELECT, |
| 1315 | 'default' => 'default', |
| 1316 | 'render_type' => 'none', |
| 1317 | 'options' => [ |
| 1318 | 'default' => __( 'WordPres Default', 'essential-addons-for-elementor-lite' ), |
| 1319 | 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 1320 | ], |
| 1321 | ] ); |
| 1322 | |
| 1323 | $this->add_control( 'reg_email_subject', [ |
| 1324 | 'label' => __( 'Email Subject', 'essential-addons-for-elementor-lite' ), |
| 1325 | 'type' => Controls_Manager::TEXT, |
| 1326 | 'placeholder' => $default_subject, |
| 1327 | 'default' => $default_subject, |
| 1328 | 'label_block' => true, |
| 1329 | 'render_type' => 'none', |
| 1330 | 'condition' => [ |
| 1331 | 'reg_email_template_type' => 'custom', |
| 1332 | ], |
| 1333 | ] ); |
| 1334 | |
| 1335 | $this->add_control( 'reg_email_message', [ |
| 1336 | 'label' => __( 'Email Message', 'essential-addons-for-elementor-lite' ), |
| 1337 | 'type' => Controls_Manager::WYSIWYG, |
| 1338 | 'placeholder' => __( 'Enter Your Custom Email Message..', 'essential-addons-for-elementor-lite' ), |
| 1339 | 'default' => $default_message, |
| 1340 | 'label_block' => true, |
| 1341 | 'render_type' => 'none', |
| 1342 | 'condition' => [ |
| 1343 | 'reg_email_template_type' => 'custom', |
| 1344 | ], |
| 1345 | ] ); |
| 1346 | |
| 1347 | $this->add_control( 'reg_email_content_note', [ |
| 1348 | 'type' => Controls_Manager::RAW_HTML, |
| 1349 | 'raw' => __( '<strong>Note:</strong> You can use dynamic content in the email body like [fieldname]. For example [username] will be replaced by user-typed username. Available tags are: [password], [username], [email], [firstname],[lastname], [website], [loginurl], [password_reset_link] and [sitetitle] ', 'essential-addons-for-elementor-lite' ), |
| 1350 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1351 | 'condition' => [ |
| 1352 | 'reg_email_template_type' => 'custom', |
| 1353 | ], |
| 1354 | 'render_type' => 'none', |
| 1355 | ] ); |
| 1356 | |
| 1357 | $this->add_control( 'reg_email_content_type', [ |
| 1358 | 'label' => __( 'Email Content Type', 'essential-addons-for-elementor-lite' ), |
| 1359 | 'type' => Controls_Manager::SELECT, |
| 1360 | 'default' => 'html', |
| 1361 | 'render_type' => 'none', |
| 1362 | 'options' => [ |
| 1363 | 'html' => __( 'HTML', 'essential-addons-for-elementor-lite' ), |
| 1364 | 'plain' => __( 'Plain', 'essential-addons-for-elementor-lite' ), |
| 1365 | ], |
| 1366 | 'condition' => [ |
| 1367 | 'reg_email_template_type' => 'custom', |
| 1368 | ], |
| 1369 | ] ); |
| 1370 | |
| 1371 | $this->end_controls_section(); |
| 1372 | } |
| 1373 | |
| 1374 | protected function init_content_register_admin_email_controls() { |
| 1375 | /* translators: %s: Site Name */ |
| 1376 | $default_subject = sprintf( __( '["%s"] New User Registration', 'essential-addons-for-elementor-lite' ), get_option( 'blogname' ) ); |
| 1377 | /* translators: %s: Site Name */ |
| 1378 | $default_message = sprintf( __( "New user registration on your site %s", 'essential-addons-for-elementor-lite' ), get_option( 'blogname' ) ) . "\r\n\r\n"; |
| 1379 | $default_message .= __( 'Username: [username]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n"; |
| 1380 | $default_message .= __( 'Email: [email]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n"; |
| 1381 | |
| 1382 | |
| 1383 | $this->start_controls_section( 'section_content_reg_admin_email', [ |
| 1384 | 'label' => __( 'Register Admin Email Options', 'essential-addons-for-elementor-lite' ), |
| 1385 | 'conditions' => [ |
| 1386 | 'relation' => 'or', |
| 1387 | 'terms' => [ |
| 1388 | [ |
| 1389 | 'name' => 'show_register_link', |
| 1390 | 'value' => 'yes', |
| 1391 | //@TODO; debug why multi-level condition is not working. |
| 1392 | //'relation' => 'and', |
| 1393 | //'terms' => [ |
| 1394 | // [ |
| 1395 | // 'name' => 'register_action', |
| 1396 | // 'value' => 'send_email', |
| 1397 | // 'operator' => '===', |
| 1398 | // ], |
| 1399 | //], |
| 1400 | ], |
| 1401 | [ |
| 1402 | 'name' => 'default_form_type', |
| 1403 | 'value' => 'register', |
| 1404 | //'relation' => 'and', |
| 1405 | //'terms' => [ |
| 1406 | // [ |
| 1407 | // 'name' => 'register_action', |
| 1408 | // 'value' => 'send_email', |
| 1409 | // 'operator' => '===', |
| 1410 | // ], |
| 1411 | //], |
| 1412 | ], |
| 1413 | ], |
| 1414 | ], |
| 1415 | ] ); |
| 1416 | |
| 1417 | $this->add_control( 'reg_admin_email_template_type', [ |
| 1418 | 'label' => __( 'Email Template Type', 'essential-addons-for-elementor-lite' ), |
| 1419 | 'description' => __( 'Default template uses WordPress Default Admin email template. You can customize it by choosing the custom option.', 'essential-addons-for-elementor-lite' ), |
| 1420 | 'type' => Controls_Manager::SELECT, |
| 1421 | 'default' => 'default', |
| 1422 | 'render_type' => 'none', |
| 1423 | 'options' => [ |
| 1424 | 'default' => __( 'WordPres Default', 'essential-addons-for-elementor-lite' ), |
| 1425 | 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 1426 | ], |
| 1427 | ] ); |
| 1428 | |
| 1429 | $this->add_control( 'reg_admin_email_subject', [ |
| 1430 | 'label' => __( 'Email Subject', 'essential-addons-for-elementor-lite' ), |
| 1431 | 'type' => Controls_Manager::TEXT, |
| 1432 | 'placeholder' => $default_subject, |
| 1433 | 'default' => $default_subject, |
| 1434 | 'label_block' => true, |
| 1435 | 'render_type' => 'none', |
| 1436 | 'condition' => [ |
| 1437 | 'reg_admin_email_template_type' => 'custom', |
| 1438 | ], |
| 1439 | ] ); |
| 1440 | |
| 1441 | $this->add_control( 'reg_admin_email_message', [ |
| 1442 | 'label' => __( 'Email Message', 'essential-addons-for-elementor-lite' ), |
| 1443 | 'type' => Controls_Manager::WYSIWYG, |
| 1444 | 'placeholder' => __( 'Enter Your Custom Email Message..', 'essential-addons-for-elementor-lite' ), |
| 1445 | 'default' => $default_message, |
| 1446 | 'label_block' => true, |
| 1447 | 'render_type' => 'none', |
| 1448 | 'condition' => [ |
| 1449 | 'reg_admin_email_template_type' => 'custom', |
| 1450 | ], |
| 1451 | ] ); |
| 1452 | |
| 1453 | $this->add_control( 'reg_admin_email_content_note', [ |
| 1454 | 'type' => Controls_Manager::RAW_HTML, |
| 1455 | 'raw' => __( '<strong>Note:</strong> You can use dynamic content in the email body like [fieldname]. For example [username] will be replaced by user-typed username. Available tags are: [username], [email], [firstname],[lastname], [website], [loginurl] and [sitetitle] ', 'essential-addons-for-elementor-lite' ), |
| 1456 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1457 | 'condition' => [ |
| 1458 | 'reg_admin_email_template_type' => 'custom', |
| 1459 | ], |
| 1460 | 'render_type' => 'none', |
| 1461 | ] ); |
| 1462 | |
| 1463 | $this->add_control( 'reg_admin_email_content_type', [ |
| 1464 | 'label' => __( 'Email Content Type', 'essential-addons-for-elementor-lite' ), |
| 1465 | 'type' => Controls_Manager::SELECT, |
| 1466 | 'default' => 'html', |
| 1467 | 'render_type' => 'none', |
| 1468 | 'options' => [ |
| 1469 | 'html' => __( 'HTML', 'essential-addons-for-elementor-lite' ), |
| 1470 | 'plain' => __( 'Plain', 'essential-addons-for-elementor-lite' ), |
| 1471 | ], |
| 1472 | 'condition' => [ |
| 1473 | 'reg_admin_email_template_type' => 'custom', |
| 1474 | ], |
| 1475 | ] ); |
| 1476 | |
| 1477 | $this->end_controls_section(); |
| 1478 | } |
| 1479 | |
| 1480 | /** |
| 1481 | * It prints controls for managing general style of both login and registration form |
| 1482 | */ |
| 1483 | protected function init_style_general_controls() { |
| 1484 | $this->start_controls_section( 'section_style_general', [ |
| 1485 | 'label' => __( 'General', 'essential-addons-for-elementor-lite' ), |
| 1486 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1487 | ] ); |
| 1488 | //---Form Container or Box |
| 1489 | $this->add_control( 'form_form_wrap_po_toggle', [ |
| 1490 | 'label' => __( 'Container Box', 'essential-addons-for-elementor-lite' ), |
| 1491 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 1492 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 1493 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 1494 | 'return_value' => 'yes', |
| 1495 | ] ); |
| 1496 | $this->start_popover(); |
| 1497 | $this->add_responsive_control( "eael_form_wrap_width", [ |
| 1498 | 'label' => esc_html__( 'Width', 'essential-addons-for-elementor-lite' ), |
| 1499 | 'type' => Controls_Manager::SLIDER, |
| 1500 | 'size_units' => [ |
| 1501 | 'px', |
| 1502 | 'rem', |
| 1503 | '%', |
| 1504 | ], |
| 1505 | 'range' => [ |
| 1506 | 'px' => [ |
| 1507 | 'min' => 0, |
| 1508 | 'max' => 1000, |
| 1509 | 'step' => 5, |
| 1510 | ], |
| 1511 | 'rem' => [ |
| 1512 | 'min' => 0, |
| 1513 | 'max' => 10, |
| 1514 | 'step' => .5, |
| 1515 | ], |
| 1516 | '%' => [ |
| 1517 | 'min' => 0, |
| 1518 | 'max' => 100, |
| 1519 | ], |
| 1520 | ], |
| 1521 | 'desktop_default' => [ |
| 1522 | 'unit' => '%', |
| 1523 | 'size' => 65, |
| 1524 | ], |
| 1525 | 'tablet_default' => [ |
| 1526 | 'unit' => '%', |
| 1527 | 'size' => 75, |
| 1528 | ], |
| 1529 | 'mobile_default' => [ |
| 1530 | 'unit' => '%', |
| 1531 | 'size' => 100, |
| 1532 | ], |
| 1533 | 'selectors' => [ |
| 1534 | "{{WRAPPER}} .eael-lr-form-wrapper" => 'width: {{SIZE}}{{UNIT}};', |
| 1535 | ], |
| 1536 | 'condition' => [ |
| 1537 | 'form_form_wrap_po_toggle' => 'yes', |
| 1538 | ], |
| 1539 | ] ); |
| 1540 | |
| 1541 | $this->add_responsive_control( "eael_form_wrap_margin", [ |
| 1542 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 1543 | 'type' => Controls_Manager::DIMENSIONS, |
| 1544 | 'size_units' => [ |
| 1545 | 'px', |
| 1546 | 'em', |
| 1547 | '%', |
| 1548 | ], |
| 1549 | 'selectors' => [ |
| 1550 | "{{WRAPPER}} .eael-lr-form-wrapper" => $this->apply_dim( 'margin' ), |
| 1551 | ], |
| 1552 | 'condition' => [ |
| 1553 | 'form_form_wrap_po_toggle' => 'yes', |
| 1554 | ], |
| 1555 | ] ); |
| 1556 | $this->add_responsive_control( "eael_form_wrap_padding", [ |
| 1557 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 1558 | 'type' => Controls_Manager::DIMENSIONS, |
| 1559 | 'size_units' => [ |
| 1560 | 'px', |
| 1561 | 'em', |
| 1562 | '%', |
| 1563 | ], |
| 1564 | 'selectors' => [ |
| 1565 | "{{WRAPPER}} .eael-lr-form-wrapper" => $this->apply_dim( 'padding' ), |
| 1566 | ], |
| 1567 | 'condition' => [ |
| 1568 | 'form_form_wrap_po_toggle' => 'yes', |
| 1569 | ], |
| 1570 | ] ); |
| 1571 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 1572 | 'name' => "eael_form_wrap_border", |
| 1573 | 'selector' => "{{WRAPPER}} .eael-lr-form-wrapper", |
| 1574 | 'condition' => [ |
| 1575 | 'form_form_wrap_po_toggle' => 'yes', |
| 1576 | ], |
| 1577 | ] ); |
| 1578 | $this->add_control( "eael_form_wrap_border_radius", [ |
| 1579 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 1580 | 'type' => Controls_Manager::DIMENSIONS, |
| 1581 | 'size_units' => [ |
| 1582 | 'px', |
| 1583 | '%', |
| 1584 | ], |
| 1585 | 'selectors' => [ |
| 1586 | "{{WRAPPER}} .eael-lr-form-wrapper" => $this->apply_dim( 'border-radius' ), |
| 1587 | ], |
| 1588 | 'condition' => [ |
| 1589 | 'form_form_wrap_po_toggle' => 'yes', |
| 1590 | ], |
| 1591 | ] ); |
| 1592 | $this->add_group_control( Group_Control_Background::get_type(), [ |
| 1593 | 'name' => "eael_form_wrap_bg_color", |
| 1594 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 1595 | 'types' => [ |
| 1596 | 'classic', |
| 1597 | 'gradient', |
| 1598 | ], |
| 1599 | 'selector' => "{{WRAPPER}} .eael-lr-form-wrapper", |
| 1600 | 'condition' => [ |
| 1601 | 'form_form_wrap_po_toggle' => 'yes', |
| 1602 | ], |
| 1603 | ] ); |
| 1604 | $this->end_popover(); |
| 1605 | $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ |
| 1606 | 'label' => __( 'Container Box Shadow', 'essential-addons-for-elementor-lite' ), |
| 1607 | 'name' => 'eael_form_wrap_shadow', |
| 1608 | 'selector' => "{{WRAPPER}} .eael-lr-form-wrapper", |
| 1609 | 'exclude' => [ |
| 1610 | 'box_shadow_position', |
| 1611 | ], |
| 1612 | ] ); |
| 1613 | |
| 1614 | //----Form Wrapper----- |
| 1615 | $this->add_control( 'form_form_po_toggle', [ |
| 1616 | 'label' => __( 'Form', 'essential-addons-for-elementor-lite' ), |
| 1617 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 1618 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 1619 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 1620 | 'return_value' => 'yes', |
| 1621 | 'separator' => 'before', |
| 1622 | ] ); |
| 1623 | $this->start_popover(); |
| 1624 | $this->add_control( 'eael_form_wrapper_heading', [ |
| 1625 | 'type' => Controls_Manager::HEADING, |
| 1626 | 'label' => __( '---Form Wrapper---', 'essential-addons-for-elementor-lite' ), |
| 1627 | 'separator' => 'before', |
| 1628 | ] ); |
| 1629 | |
| 1630 | $this->add_responsive_control( "eael_form_width", [ |
| 1631 | 'label' => esc_html__( 'Wrapper width', 'essential-addons-for-elementor-lite' ), |
| 1632 | 'type' => Controls_Manager::SLIDER, |
| 1633 | 'size_units' => [ |
| 1634 | 'px', |
| 1635 | 'rem', |
| 1636 | '%', |
| 1637 | ], |
| 1638 | 'range' => [ |
| 1639 | 'px' => [ |
| 1640 | 'min' => 0, |
| 1641 | 'max' => 1000, |
| 1642 | 'step' => 5, |
| 1643 | ], |
| 1644 | 'rem' => [ |
| 1645 | 'min' => 0, |
| 1646 | 'max' => 10, |
| 1647 | 'step' => .5, |
| 1648 | ], |
| 1649 | '%' => [ |
| 1650 | 'min' => 0, |
| 1651 | 'max' => 100, |
| 1652 | ], |
| 1653 | ], |
| 1654 | 'desktop_default' => [ |
| 1655 | 'unit' => '%', |
| 1656 | 'size' => 50, |
| 1657 | ], |
| 1658 | 'tablet_default' => [ |
| 1659 | 'unit' => '%', |
| 1660 | 'size' => 75, |
| 1661 | ], |
| 1662 | 'mobile_default' => [ |
| 1663 | 'unit' => '%', |
| 1664 | 'size' => 100, |
| 1665 | ], |
| 1666 | 'selectors' => [ |
| 1667 | "{{WRAPPER}} .lr-form-wrapper" => 'width: {{SIZE}}{{UNIT}};', |
| 1668 | ], |
| 1669 | 'condition' => [ |
| 1670 | 'form_form_po_toggle' => 'yes', |
| 1671 | ], |
| 1672 | ] ); |
| 1673 | |
| 1674 | $this->add_responsive_control( "eael_form_margin", [ |
| 1675 | 'label' => __( 'Wrapper Margin', 'essential-addons-for-elementor-lite' ), |
| 1676 | 'type' => Controls_Manager::DIMENSIONS, |
| 1677 | 'size_units' => [ |
| 1678 | 'px', |
| 1679 | 'em', |
| 1680 | '%', |
| 1681 | ], |
| 1682 | 'selectors' => [ |
| 1683 | "{{WRAPPER}} .lr-form-wrapper" => $this->apply_dim( 'margin' ), |
| 1684 | ], |
| 1685 | 'condition' => [ |
| 1686 | 'form_form_po_toggle' => 'yes', |
| 1687 | ], |
| 1688 | ] ); |
| 1689 | $this->add_responsive_control( "eael_form_padding", [ |
| 1690 | 'label' => __( 'Wrapper Padding', 'essential-addons-for-elementor-lite' ), |
| 1691 | 'type' => Controls_Manager::DIMENSIONS, |
| 1692 | 'size_units' => [ |
| 1693 | 'px', |
| 1694 | 'em', |
| 1695 | '%', |
| 1696 | ], |
| 1697 | 'selectors' => [ |
| 1698 | "{{WRAPPER}} .lr-form-wrapper" => $this->apply_dim( 'padding' ), |
| 1699 | ], |
| 1700 | 'condition' => [ |
| 1701 | 'form_form_po_toggle' => 'yes', |
| 1702 | ], |
| 1703 | ] ); |
| 1704 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 1705 | 'name' => "eael_form_border", |
| 1706 | 'selector' => "{{WRAPPER}} .lr-form-wrapper", |
| 1707 | 'condition' => [ |
| 1708 | 'form_form_po_toggle' => 'yes', |
| 1709 | ], |
| 1710 | ] ); |
| 1711 | $this->add_control( "eael_form_border_radius", [ |
| 1712 | 'label' => __( 'Wrapper Border Radius', 'essential-addons-for-elementor-lite' ), |
| 1713 | 'type' => Controls_Manager::DIMENSIONS, |
| 1714 | 'size_units' => [ |
| 1715 | 'px', |
| 1716 | '%', |
| 1717 | ], |
| 1718 | 'selectors' => [ |
| 1719 | "{{WRAPPER}} .lr-form-wrapper" => $this->apply_dim( 'border-radius' ), |
| 1720 | ], |
| 1721 | 'condition' => [ |
| 1722 | 'form_form_po_toggle' => 'yes', |
| 1723 | ], |
| 1724 | ] ); |
| 1725 | $this->add_group_control( Group_Control_Background::get_type(), [ |
| 1726 | 'name' => "eael_form_bg_color", |
| 1727 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 1728 | 'types' => [ |
| 1729 | 'classic', |
| 1730 | 'gradient', |
| 1731 | ], |
| 1732 | 'selector' => "{{WRAPPER}} .lr-form-wrapper", |
| 1733 | ] ); |
| 1734 | |
| 1735 | $this->add_control( 'eael_form_input_container', [ |
| 1736 | 'type' => Controls_Manager::HEADING, |
| 1737 | 'label' => __( '---Form Style---', 'essential-addons-for-elementor-lite' ), |
| 1738 | 'separator' => 'before', |
| 1739 | ] ); |
| 1740 | $this->add_responsive_control( "eael_form_ic_width", [ |
| 1741 | 'label' => esc_html__( 'Form width', 'essential-addons-for-elementor-lite' ), |
| 1742 | 'type' => Controls_Manager::SLIDER, |
| 1743 | 'size_units' => [ |
| 1744 | 'px', |
| 1745 | 'rem', |
| 1746 | '%', |
| 1747 | ], |
| 1748 | 'range' => [ |
| 1749 | 'px' => [ |
| 1750 | 'min' => 0, |
| 1751 | 'max' => 1000, |
| 1752 | 'step' => 5, |
| 1753 | ], |
| 1754 | 'rem' => [ |
| 1755 | 'min' => 0, |
| 1756 | 'max' => 10, |
| 1757 | 'step' => .5, |
| 1758 | ], |
| 1759 | '%' => [ |
| 1760 | 'min' => 0, |
| 1761 | 'max' => 100, |
| 1762 | ], |
| 1763 | ], |
| 1764 | 'default' => [ |
| 1765 | 'unit' => '%', |
| 1766 | 'size' => 100, |
| 1767 | ], |
| 1768 | 'selectors' => [ |
| 1769 | "{{WRAPPER}} .lr-form-wrapper form" => 'width: {{SIZE}}{{UNIT}};', |
| 1770 | ], |
| 1771 | 'condition' => [ |
| 1772 | 'form_form_po_toggle' => 'yes', |
| 1773 | ], |
| 1774 | ] ); |
| 1775 | |
| 1776 | $this->add_responsive_control( "eael_form_ic_margin", [ |
| 1777 | 'label' => __( 'Form Margin', 'essential-addons-for-elementor-lite' ), |
| 1778 | 'type' => Controls_Manager::DIMENSIONS, |
| 1779 | 'size_units' => [ |
| 1780 | 'px', |
| 1781 | 'em', |
| 1782 | '%', |
| 1783 | ], |
| 1784 | 'selectors' => [ |
| 1785 | "{{WRAPPER}} .lr-form-wrapper form" => $this->apply_dim( 'margin' ), |
| 1786 | ], |
| 1787 | 'condition' => [ |
| 1788 | 'form_form_po_toggle' => 'yes', |
| 1789 | ], |
| 1790 | ] ); |
| 1791 | $this->add_responsive_control( "eael_form_ic_padding", [ |
| 1792 | 'label' => __( 'Form Padding', 'essential-addons-for-elementor-lite' ), |
| 1793 | 'type' => Controls_Manager::DIMENSIONS, |
| 1794 | 'size_units' => [ |
| 1795 | 'px', |
| 1796 | 'em', |
| 1797 | '%', |
| 1798 | ], |
| 1799 | 'selectors' => [ |
| 1800 | "{{WRAPPER}} .lr-form-wrapper form" => $this->apply_dim( 'padding' ), |
| 1801 | ], |
| 1802 | 'condition' => [ |
| 1803 | 'form_form_po_toggle' => 'yes', |
| 1804 | ], |
| 1805 | ] ); |
| 1806 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 1807 | 'name' => "eael_form_ic_border", |
| 1808 | 'selector' => "{{WRAPPER}} .lr-form-wrapper form", |
| 1809 | 'condition' => [ |
| 1810 | 'form_form_po_toggle' => 'yes', |
| 1811 | ], |
| 1812 | ] ); |
| 1813 | $this->add_control( "eael_form_ic_border_radius", [ |
| 1814 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 1815 | 'type' => Controls_Manager::DIMENSIONS, |
| 1816 | 'size_units' => [ |
| 1817 | 'px', |
| 1818 | '%', |
| 1819 | ], |
| 1820 | 'selectors' => [ |
| 1821 | "{{WRAPPER}} .lr-form-wrapper form" => $this->apply_dim( 'border-radius' ), |
| 1822 | ], |
| 1823 | 'condition' => [ |
| 1824 | 'form_form_po_toggle' => 'yes', |
| 1825 | ], |
| 1826 | ] ); |
| 1827 | $this->add_group_control( Group_Control_Background::get_type(), [ |
| 1828 | 'name' => "eael_form_ic_bg_color", |
| 1829 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 1830 | 'types' => [ |
| 1831 | 'classic', |
| 1832 | 'gradient', |
| 1833 | ], |
| 1834 | 'selector' => "{{WRAPPER}} .lr-form-wrapper form", |
| 1835 | ] ); |
| 1836 | $this->end_popover(); |
| 1837 | |
| 1838 | $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ |
| 1839 | 'label' => __( 'Form Wrapper Shadow', 'essential-addons-for-elementor-lite' ), |
| 1840 | 'name' => 'eael_form_shadow', |
| 1841 | 'selector' => "{{WRAPPER}} .lr-form-wrapper", |
| 1842 | 'exclude' => [ |
| 1843 | 'box_shadow_position', |
| 1844 | ], |
| 1845 | ] ); |
| 1846 | |
| 1847 | $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ |
| 1848 | 'label' => __( 'Form Shadow', 'essential-addons-for-elementor-lite' ), |
| 1849 | 'name' => 'eael_form_ic_shadow', |
| 1850 | 'selector' => "{{WRAPPER}} .lr-form-wrapper form", |
| 1851 | 'exclude' => [ |
| 1852 | 'box_shadow_position', |
| 1853 | ], |
| 1854 | ] ); |
| 1855 | //@TODO; add only input wrapper shadow |
| 1856 | $this->end_controls_section(); |
| 1857 | } |
| 1858 | |
| 1859 | protected function init_style_header_content_controls( $form_type = 'login' ) { |
| 1860 | $this->start_controls_section( "section_style_{$form_type}_header_content", [ |
| 1861 | 'label' => sprintf( __( '%s Form Header', 'essential-addons-for-elementor-lite' ), ucfirst( $form_type ) ), |
| 1862 | // Login Form Header | Register Form Header |
| 1863 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1864 | 'conditions' => $this->get_form_controls_display_condition( $form_type ), |
| 1865 | ] ); |
| 1866 | //Define all css selectors ahead for better management |
| 1867 | $illustration_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-illustration"; |
| 1868 | $header_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-header"; |
| 1869 | $logo_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-header img"; |
| 1870 | $title_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-header .form-dsc h4"; |
| 1871 | $subtitle_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-header .form-dsc p"; |
| 1872 | $this->add_control( "{$form_type}_fhc_po_toggle", [ |
| 1873 | 'label' => __( 'Header Content', 'essential-addons-for-elementor-lite' ), |
| 1874 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 1875 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 1876 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 1877 | 'return_value' => 'yes', |
| 1878 | ] ); |
| 1879 | |
| 1880 | $this->start_popover(); |
| 1881 | |
| 1882 | $this->add_responsive_control( "{$form_type}_fhc_width", [ |
| 1883 | 'label' => esc_html__( 'Header width', 'essential-addons-for-elementor-lite' ), |
| 1884 | 'type' => Controls_Manager::SLIDER, |
| 1885 | 'size_units' => [ |
| 1886 | 'px', |
| 1887 | 'rem', |
| 1888 | '%', |
| 1889 | ], |
| 1890 | 'range' => [ |
| 1891 | 'px' => [ |
| 1892 | 'min' => 0, |
| 1893 | 'max' => 1000, |
| 1894 | 'step' => 5, |
| 1895 | ], |
| 1896 | 'rem' => [ |
| 1897 | 'min' => 0, |
| 1898 | 'max' => 10, |
| 1899 | 'step' => .5, |
| 1900 | ], |
| 1901 | '%' => [ |
| 1902 | 'min' => 0, |
| 1903 | 'max' => 100, |
| 1904 | ], |
| 1905 | ], |
| 1906 | 'default' => [ |
| 1907 | 'unit' => '%', |
| 1908 | 'size' => 100, |
| 1909 | ], |
| 1910 | 'selectors' => [ |
| 1911 | $header_selector => 'width: {{SIZE}}{{UNIT}};', |
| 1912 | ], |
| 1913 | 'condition' => [ |
| 1914 | "{$form_type}_fhc_po_toggle" => 'yes', |
| 1915 | ], |
| 1916 | ] ); |
| 1917 | $this->add_responsive_control( "{$form_type}_fhc_height", [ |
| 1918 | 'label' => esc_html__( 'Header height', 'essential-addons-for-elementor-lite' ), |
| 1919 | 'type' => Controls_Manager::SLIDER, |
| 1920 | 'size_units' => [ |
| 1921 | 'px', |
| 1922 | 'rem', |
| 1923 | '%', |
| 1924 | ], |
| 1925 | 'range' => [ |
| 1926 | 'px' => [ |
| 1927 | 'min' => 0, |
| 1928 | 'max' => 1000, |
| 1929 | 'step' => 5, |
| 1930 | ], |
| 1931 | 'rem' => [ |
| 1932 | 'min' => 0, |
| 1933 | 'max' => 10, |
| 1934 | 'step' => .5, |
| 1935 | ], |
| 1936 | '%' => [ |
| 1937 | 'min' => 0, |
| 1938 | 'max' => 100, |
| 1939 | ], |
| 1940 | ], |
| 1941 | 'selectors' => [ |
| 1942 | $header_selector => 'height: {{SIZE}}{{UNIT}};', |
| 1943 | ], |
| 1944 | 'condition' => [ |
| 1945 | "{$form_type}_fhc_po_toggle" => 'yes', |
| 1946 | ], |
| 1947 | ] ); |
| 1948 | $this->add_responsive_control( "{$form_type}_fhc_margin", [ |
| 1949 | 'label' => __( 'Header Margin', 'essential-addons-for-elementor-lite' ), |
| 1950 | 'type' => Controls_Manager::DIMENSIONS, |
| 1951 | 'size_units' => [ |
| 1952 | 'px', |
| 1953 | 'em', |
| 1954 | '%', |
| 1955 | ], |
| 1956 | 'selectors' => [ |
| 1957 | $header_selector => $this->apply_dim( 'margin' ), |
| 1958 | ], |
| 1959 | 'condition' => [ |
| 1960 | "{$form_type}_fhc_po_toggle" => 'yes', |
| 1961 | ], |
| 1962 | ] ); |
| 1963 | $this->add_responsive_control( "{$form_type}_fhc_padding", [ |
| 1964 | 'label' => __( 'Header Padding', 'essential-addons-for-elementor-lite' ), |
| 1965 | 'type' => Controls_Manager::DIMENSIONS, |
| 1966 | 'size_units' => [ |
| 1967 | 'px', |
| 1968 | 'em', |
| 1969 | '%', |
| 1970 | ], |
| 1971 | 'selectors' => [ |
| 1972 | $header_selector => $this->apply_dim( 'padding' ), |
| 1973 | ], |
| 1974 | 'condition' => [ |
| 1975 | "{$form_type}_fhc_po_toggle" => 'yes', |
| 1976 | ], |
| 1977 | ] ); |
| 1978 | |
| 1979 | |
| 1980 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 1981 | 'name' => "{$form_type}_fhc_border", |
| 1982 | 'selector' => $header_selector, |
| 1983 | 'condition' => [ |
| 1984 | "{$form_type}_fhc_po_toggle" => 'yes', |
| 1985 | ], |
| 1986 | ] ); |
| 1987 | $this->add_control( "{$form_type}_fhc_border_radius", [ |
| 1988 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 1989 | 'type' => Controls_Manager::DIMENSIONS, |
| 1990 | 'size_units' => [ |
| 1991 | 'px', |
| 1992 | '%', |
| 1993 | ], |
| 1994 | 'selectors' => [ |
| 1995 | $header_selector => $this->apply_dim( 'border-radius' ), |
| 1996 | ], |
| 1997 | 'condition' => [ |
| 1998 | "{$form_type}_fhc_po_toggle" => 'yes', |
| 1999 | ], |
| 2000 | ] ); |
| 2001 | $this->add_group_control( Group_Control_Background::get_type(), [ |
| 2002 | 'name' => "{$form_type}_form_header_bg", |
| 2003 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 2004 | 'types' => [ |
| 2005 | 'classic', |
| 2006 | 'gradient', |
| 2007 | ], |
| 2008 | 'selector' => $header_selector, |
| 2009 | 'condition' => [ |
| 2010 | "{$form_type}_fhc_po_toggle" => 'yes', |
| 2011 | ], |
| 2012 | ] ); |
| 2013 | $this->end_popover(); |
| 2014 | |
| 2015 | |
| 2016 | $this->add_control( "{$form_type}_form_img_po_toggle", [ |
| 2017 | 'label' => __( 'Form Illustration', 'essential-addons-for-elementor-lite' ), |
| 2018 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2019 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 2020 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 2021 | 'return_value' => 'yes', |
| 2022 | 'separator' => 'before', |
| 2023 | ] ); |
| 2024 | $this->start_popover(); |
| 2025 | $this->add_responsive_control( "{$form_type}_form_img_width", [ |
| 2026 | 'label' => esc_html__( 'Width', 'essential-addons-for-elementor-lite' ), |
| 2027 | 'type' => Controls_Manager::SLIDER, |
| 2028 | 'size_units' => [ |
| 2029 | 'px', |
| 2030 | 'rem', |
| 2031 | '%', |
| 2032 | ], |
| 2033 | 'range' => [ |
| 2034 | 'px' => [ |
| 2035 | 'min' => 0, |
| 2036 | 'max' => 1000, |
| 2037 | 'step' => 5, |
| 2038 | ], |
| 2039 | 'rem' => [ |
| 2040 | 'min' => 0, |
| 2041 | 'max' => 10, |
| 2042 | 'step' => .5, |
| 2043 | ], |
| 2044 | '%' => [ |
| 2045 | 'min' => 0, |
| 2046 | 'max' => 100, |
| 2047 | ], |
| 2048 | ], |
| 2049 | 'desktop_default' => [ |
| 2050 | 'unit' => '%', |
| 2051 | 'size' => 50, |
| 2052 | ], |
| 2053 | 'tablet_default' => [ |
| 2054 | 'unit' => '%', |
| 2055 | 'size' => 100, |
| 2056 | ], |
| 2057 | 'mobile_default' => [ |
| 2058 | 'unit' => '%', |
| 2059 | 'size' => 100, |
| 2060 | ], |
| 2061 | 'selectors' => [ |
| 2062 | $illustration_selector => 'width: {{SIZE}}{{UNIT}};', |
| 2063 | ], |
| 2064 | 'condition' => [ |
| 2065 | "{$form_type}_form_img_po_toggle" => 'yes', |
| 2066 | ], |
| 2067 | ] ); |
| 2068 | $this->add_responsive_control( "{$form_type}_form_img_height", [ |
| 2069 | 'label' => esc_html__( 'Height', 'essential-addons-for-elementor-lite' ), |
| 2070 | 'type' => Controls_Manager::SLIDER, |
| 2071 | 'size_units' => [ |
| 2072 | 'px', |
| 2073 | 'rem', |
| 2074 | ], |
| 2075 | 'range' => [ |
| 2076 | 'px' => [ |
| 2077 | 'min' => 0, |
| 2078 | 'max' => 1000, |
| 2079 | 'step' => 5, |
| 2080 | ], |
| 2081 | 'rem' => [ |
| 2082 | 'min' => 0, |
| 2083 | 'max' => 10, |
| 2084 | 'step' => .5, |
| 2085 | ], |
| 2086 | ], |
| 2087 | 'desktop_default' => [ |
| 2088 | 'unit' => 'px', |
| 2089 | 'size' => 375, |
| 2090 | ], |
| 2091 | 'tablet_default' => [ |
| 2092 | 'unit' => 'px', |
| 2093 | 'size' => 375, |
| 2094 | ], |
| 2095 | 'mobile_default' => [ |
| 2096 | 'unit' => 'px', |
| 2097 | 'size' => 375, |
| 2098 | ], |
| 2099 | 'selectors' => [ |
| 2100 | $illustration_selector => 'height: {{SIZE}}{{UNIT}};', |
| 2101 | ], |
| 2102 | 'condition' => [ |
| 2103 | "{$form_type}_form_img_po_toggle" => 'yes', |
| 2104 | ], |
| 2105 | ] ); |
| 2106 | $this->add_control( "{$form_type}_form_img_margin", [ |
| 2107 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 2108 | 'type' => Controls_Manager::DIMENSIONS, |
| 2109 | 'size_units' => [ |
| 2110 | 'px', |
| 2111 | 'em', |
| 2112 | '%', |
| 2113 | ], |
| 2114 | 'selectors' => [ |
| 2115 | $illustration_selector => $this->apply_dim( 'margin' ), |
| 2116 | ], |
| 2117 | 'condition' => [ |
| 2118 | "{$form_type}_form_img_po_toggle" => 'yes', |
| 2119 | ], |
| 2120 | ] ); |
| 2121 | $this->add_control( "{$form_type}_form_img_padding", [ |
| 2122 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 2123 | 'type' => Controls_Manager::DIMENSIONS, |
| 2124 | 'size_units' => [ |
| 2125 | 'px', |
| 2126 | 'em', |
| 2127 | '%', |
| 2128 | ], |
| 2129 | 'selectors' => [ |
| 2130 | $illustration_selector => $this->apply_dim( 'padding' ), |
| 2131 | ], |
| 2132 | 'condition' => [ |
| 2133 | "{$form_type}_form_img_po_toggle" => 'yes', |
| 2134 | ], |
| 2135 | ] ); |
| 2136 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 2137 | 'name' => "{$form_type}_form_img_border", |
| 2138 | 'selector' => $illustration_selector, |
| 2139 | 'condition' => [ |
| 2140 | "{$form_type}_form_img_po_toggle" => 'yes', |
| 2141 | ], |
| 2142 | ] ); |
| 2143 | $this->add_control( "{$form_type}_form_img_border_radius", [ |
| 2144 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 2145 | 'type' => Controls_Manager::DIMENSIONS, |
| 2146 | 'size_units' => [ |
| 2147 | 'px', |
| 2148 | '%', |
| 2149 | ], |
| 2150 | 'selectors' => [ |
| 2151 | $illustration_selector => $this->apply_dim( 'border-radius' ), |
| 2152 | ], |
| 2153 | 'condition' => [ |
| 2154 | "{$form_type}_form_img_po_toggle" => 'yes', |
| 2155 | ], |
| 2156 | ] ); |
| 2157 | $this->end_popover(); |
| 2158 | $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ |
| 2159 | 'label' => __( 'Illustration Shadow', 'essential-addons-for-elementor-lite' ), |
| 2160 | 'name' => "{$form_type}_form_img_shadow", |
| 2161 | 'selector' => $illustration_selector, |
| 2162 | 'exclude' => [ |
| 2163 | 'box_shadow_position', |
| 2164 | ], |
| 2165 | ] ); |
| 2166 | $this->add_control( "{$form_type}_form_logo_po_toggle", [ |
| 2167 | 'label' => __( 'Form Logo', 'essential-addons-for-elementor-lite' ), |
| 2168 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2169 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 2170 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 2171 | 'return_value' => 'yes', |
| 2172 | 'separator' => 'before', |
| 2173 | ] ); |
| 2174 | $this->start_popover(); |
| 2175 | $this->add_responsive_control( "{$form_type}_form_logo_width", [ |
| 2176 | 'label' => esc_html__( 'width', 'essential-addons-for-elementor-lite' ), |
| 2177 | 'type' => Controls_Manager::SLIDER, |
| 2178 | 'size_units' => [ |
| 2179 | 'px', |
| 2180 | 'rem', |
| 2181 | '%', |
| 2182 | ], |
| 2183 | 'range' => [ |
| 2184 | 'px' => [ |
| 2185 | 'min' => 0, |
| 2186 | 'max' => 1000, |
| 2187 | 'step' => 5, |
| 2188 | ], |
| 2189 | 'rem' => [ |
| 2190 | 'min' => 0, |
| 2191 | 'max' => 10, |
| 2192 | 'step' => .5, |
| 2193 | ], |
| 2194 | '%' => [ |
| 2195 | 'min' => 0, |
| 2196 | 'max' => 100, |
| 2197 | ], |
| 2198 | ], |
| 2199 | 'default' => [ |
| 2200 | 'unit' => 'px', |
| 2201 | 'size' => 100, |
| 2202 | ], |
| 2203 | 'selectors' => [ |
| 2204 | $logo_selector => 'width: {{SIZE}}{{UNIT}};', |
| 2205 | ], |
| 2206 | 'condition' => [ |
| 2207 | "{$form_type}_form_logo_po_toggle" => 'yes', |
| 2208 | ], |
| 2209 | ] ); |
| 2210 | $this->add_responsive_control( "{$form_type}_form_logo_height", [ |
| 2211 | 'label' => esc_html__( 'height', 'essential-addons-for-elementor-lite' ), |
| 2212 | 'type' => Controls_Manager::SLIDER, |
| 2213 | 'size_units' => [ |
| 2214 | 'px', |
| 2215 | 'rem', |
| 2216 | '%', |
| 2217 | ], |
| 2218 | 'range' => [ |
| 2219 | 'px' => [ |
| 2220 | 'min' => 0, |
| 2221 | 'max' => 1000, |
| 2222 | 'step' => 5, |
| 2223 | ], |
| 2224 | 'rem' => [ |
| 2225 | 'min' => 0, |
| 2226 | 'max' => 10, |
| 2227 | 'step' => .5, |
| 2228 | ], |
| 2229 | '%' => [ |
| 2230 | 'min' => 0, |
| 2231 | 'max' => 100, |
| 2232 | ], |
| 2233 | ], |
| 2234 | 'default' => [ |
| 2235 | 'unit' => 'px', |
| 2236 | 'size' => 100, |
| 2237 | ], |
| 2238 | 'selectors' => [ |
| 2239 | $logo_selector => 'height: {{SIZE}}{{UNIT}};', |
| 2240 | ], |
| 2241 | 'condition' => [ |
| 2242 | "{$form_type}_form_logo_po_toggle" => 'yes', |
| 2243 | ], |
| 2244 | ] ); |
| 2245 | $this->add_responsive_control( "{$form_type}_form_logo_margin", [ |
| 2246 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 2247 | 'type' => Controls_Manager::DIMENSIONS, |
| 2248 | 'size_units' => [ |
| 2249 | 'px', |
| 2250 | 'em', |
| 2251 | '%', |
| 2252 | ], |
| 2253 | 'selectors' => [ |
| 2254 | $logo_selector => $this->apply_dim( 'margin' ), |
| 2255 | ], |
| 2256 | 'condition' => [ |
| 2257 | "{$form_type}_form_logo_po_toggle" => 'yes', |
| 2258 | ], |
| 2259 | ] ); |
| 2260 | $this->add_responsive_control( "{$form_type}_form_logo_padding", [ |
| 2261 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 2262 | 'type' => Controls_Manager::DIMENSIONS, |
| 2263 | 'size_units' => [ |
| 2264 | 'px', |
| 2265 | 'em', |
| 2266 | '%', |
| 2267 | ], |
| 2268 | 'selectors' => [ |
| 2269 | $logo_selector => $this->apply_dim( 'padding' ), |
| 2270 | ], |
| 2271 | 'condition' => [ |
| 2272 | "{$form_type}_form_logo_po_toggle" => 'yes', |
| 2273 | ], |
| 2274 | ] ); |
| 2275 | |
| 2276 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 2277 | 'name' => "{$form_type}_form_logo_border", |
| 2278 | 'selector' => $logo_selector, |
| 2279 | 'condition' => [ |
| 2280 | "{$form_type}_form_logo_po_toggle" => 'yes', |
| 2281 | ], |
| 2282 | ] ); |
| 2283 | $this->add_control( "{$form_type}_form_logo_border_radius", [ |
| 2284 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 2285 | 'type' => Controls_Manager::DIMENSIONS, |
| 2286 | 'size_units' => [ |
| 2287 | 'px', |
| 2288 | '%', |
| 2289 | ], |
| 2290 | 'selectors' => [ |
| 2291 | $logo_selector => $this->apply_dim( 'border-radius' ), |
| 2292 | ], |
| 2293 | 'condition' => [ |
| 2294 | "{$form_type}_form_logo_po_toggle" => 'yes', |
| 2295 | ], |
| 2296 | ] ); |
| 2297 | $this->end_popover(); |
| 2298 | $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ |
| 2299 | 'label' => __( 'Logo Shadow', 'essential-addons-for-elementor-lite' ), |
| 2300 | 'name' => "{$form_type}_form_logo_shadow", |
| 2301 | 'selector' => $logo_selector, |
| 2302 | 'exclude' => [ |
| 2303 | 'box_shadow_position', |
| 2304 | ], |
| 2305 | ] ); |
| 2306 | |
| 2307 | |
| 2308 | /*-- Title Typography --*/ |
| 2309 | $this->add_control( "{$form_type}_form_title_po_toggle", [ |
| 2310 | 'label' => __( 'Title', 'essential-addons-for-elementor-lite' ), |
| 2311 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2312 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 2313 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 2314 | 'return_value' => 'yes', |
| 2315 | 'separator' => 'before', |
| 2316 | ] ); |
| 2317 | $this->start_popover(); |
| 2318 | $this->add_responsive_control( "{$form_type}_form_title_margin", [ |
| 2319 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 2320 | 'type' => Controls_Manager::DIMENSIONS, |
| 2321 | 'size_units' => [ |
| 2322 | 'px', |
| 2323 | 'em', |
| 2324 | '%', |
| 2325 | ], |
| 2326 | 'selectors' => [ |
| 2327 | $title_selector => $this->apply_dim( 'margin' ), |
| 2328 | ], |
| 2329 | 'condition' => [ |
| 2330 | "{$form_type}_form_title_po_toggle" => 'yes', |
| 2331 | ], |
| 2332 | ] ); |
| 2333 | $this->add_responsive_control( "{$form_type}_form_title_padding", [ |
| 2334 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 2335 | 'type' => Controls_Manager::DIMENSIONS, |
| 2336 | 'size_units' => [ |
| 2337 | 'px', |
| 2338 | 'em', |
| 2339 | '%', |
| 2340 | ], |
| 2341 | 'selectors' => [ |
| 2342 | $title_selector => $this->apply_dim( 'padding' ), |
| 2343 | ], |
| 2344 | 'condition' => [ |
| 2345 | "{$form_type}_form_title_po_toggle" => 'yes', |
| 2346 | ], |
| 2347 | ] ); |
| 2348 | $this->add_control( "{$form_type}_form_title_color", [ |
| 2349 | 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ), |
| 2350 | 'type' => Controls_Manager::COLOR, |
| 2351 | 'selectors' => [ |
| 2352 | $title_selector => 'color: {{VALUE}};', |
| 2353 | ], |
| 2354 | 'condition' => [ |
| 2355 | "{$form_type}_form_title_po_toggle" => 'yes', |
| 2356 | ], |
| 2357 | ] ); |
| 2358 | $this->add_control( "{$form_type}_form_title_bg_color", [ |
| 2359 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 2360 | 'type' => Controls_Manager::COLOR, |
| 2361 | 'selectors' => [ |
| 2362 | $title_selector => 'background: {{VALUE}};', |
| 2363 | ], |
| 2364 | 'condition' => [ |
| 2365 | "{$form_type}_form_title_po_toggle" => 'yes', |
| 2366 | ], |
| 2367 | ] ); |
| 2368 | |
| 2369 | |
| 2370 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 2371 | 'name' => "{$form_type}_form_title_border", |
| 2372 | 'selector' => $title_selector, |
| 2373 | 'condition' => [ |
| 2374 | "{$form_type}_form_title_po_toggle" => 'yes', |
| 2375 | ], |
| 2376 | ] ); |
| 2377 | $this->add_control( "{$form_type}_form_title_border_radius", [ |
| 2378 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 2379 | 'type' => Controls_Manager::DIMENSIONS, |
| 2380 | 'size_units' => [ |
| 2381 | 'px', |
| 2382 | '%', |
| 2383 | ], |
| 2384 | 'selectors' => [ |
| 2385 | $title_selector => $this->apply_dim( 'border-radius' ), |
| 2386 | ], |
| 2387 | 'condition' => [ |
| 2388 | "{$form_type}_form_title_po_toggle" => 'yes', |
| 2389 | ], |
| 2390 | ] ); |
| 2391 | |
| 2392 | $this->end_popover(); |
| 2393 | $this->add_group_control( Group_Control_Typography::get_type(), [ |
| 2394 | 'name' => "{$form_type}_form_title_typo", |
| 2395 | 'label' => __( 'Title Typography', 'essential-addons-for-elementor-lite' ), |
| 2396 | 'selector' => $title_selector, |
| 2397 | ] ); |
| 2398 | |
| 2399 | /*Subtitle----*/ |
| 2400 | $this->add_control( "{$form_type}_form_subtitle_po_toggle", [ |
| 2401 | 'label' => __( 'Subtitle', 'essential-addons-for-elementor-lite' ), |
| 2402 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2403 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 2404 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 2405 | 'return_value' => 'yes', |
| 2406 | 'separator' => 'before', |
| 2407 | ] ); |
| 2408 | $this->start_popover(); |
| 2409 | $this->add_responsive_control( "{$form_type}_form_subtitle_margin", [ |
| 2410 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 2411 | 'type' => Controls_Manager::DIMENSIONS, |
| 2412 | 'size_units' => [ |
| 2413 | 'px', |
| 2414 | 'em', |
| 2415 | '%', |
| 2416 | ], |
| 2417 | 'selectors' => [ |
| 2418 | $subtitle_selector => $this->apply_dim( 'margin' ), |
| 2419 | ], |
| 2420 | 'condition' => [ |
| 2421 | "{$form_type}_form_subtitle_po_toggle" => 'yes', |
| 2422 | ], |
| 2423 | ] ); |
| 2424 | $this->add_responsive_control( "{$form_type}_form_subtitle_padding", [ |
| 2425 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 2426 | 'type' => Controls_Manager::DIMENSIONS, |
| 2427 | 'size_units' => [ |
| 2428 | 'px', |
| 2429 | 'em', |
| 2430 | '%', |
| 2431 | ], |
| 2432 | 'selectors' => [ |
| 2433 | $subtitle_selector => $this->apply_dim( 'padding' ), |
| 2434 | ], |
| 2435 | 'condition' => [ |
| 2436 | "{$form_type}_form_subtitle_po_toggle" => 'yes', |
| 2437 | ], |
| 2438 | ] ); |
| 2439 | $this->add_control( "{$form_type}_form_subtitle_color", [ |
| 2440 | 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ), |
| 2441 | 'type' => Controls_Manager::COLOR, |
| 2442 | 'selectors' => [ |
| 2443 | $subtitle_selector => 'color: {{VALUE}};', |
| 2444 | ], |
| 2445 | 'condition' => [ |
| 2446 | "{$form_type}_form_subtitle_po_toggle" => 'yes', |
| 2447 | ], |
| 2448 | ] ); |
| 2449 | $this->add_control( "{$form_type}_form_subtitle_bg_color", [ |
| 2450 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 2451 | 'type' => Controls_Manager::COLOR, |
| 2452 | 'selectors' => [ |
| 2453 | $subtitle_selector => 'background: {{VALUE}};', |
| 2454 | ], |
| 2455 | 'condition' => [ |
| 2456 | "{$form_type}_form_subtitle_po_toggle" => 'yes', |
| 2457 | ], |
| 2458 | ] ); |
| 2459 | |
| 2460 | |
| 2461 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 2462 | 'name' => "{$form_type}_form_subtitle_border", |
| 2463 | 'selector' => $subtitle_selector, |
| 2464 | 'condition' => [ |
| 2465 | "{$form_type}_form_subtitle_po_toggle" => 'yes', |
| 2466 | ], |
| 2467 | ] ); |
| 2468 | $this->add_control( "{$form_type}_form_subtitle_border_radius", [ |
| 2469 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 2470 | 'type' => Controls_Manager::DIMENSIONS, |
| 2471 | 'size_units' => [ |
| 2472 | 'px', |
| 2473 | '%', |
| 2474 | ], |
| 2475 | 'selectors' => [ |
| 2476 | $subtitle_selector => $this->apply_dim( 'border-radius' ), |
| 2477 | ], |
| 2478 | 'condition' => [ |
| 2479 | "{$form_type}_form_subtitle_po_toggle" => 'yes', |
| 2480 | ], |
| 2481 | ] ); |
| 2482 | |
| 2483 | $this->end_popover(); |
| 2484 | $this->add_group_control( Group_Control_Typography::get_type(), [ |
| 2485 | 'name' => "{$form_type}_form_subtitle_typo", |
| 2486 | 'label' => __( 'Subtitle Typography', 'essential-addons-for-elementor-lite' ), |
| 2487 | 'selector' => $subtitle_selector, |
| 2488 | ] ); |
| 2489 | |
| 2490 | $this->end_controls_section(); |
| 2491 | } |
| 2492 | |
| 2493 | protected function init_style_input_fields_controls() { |
| 2494 | $this->start_controls_section( 'section_style_form_fields', [ |
| 2495 | 'label' => __( 'Form Fields', 'essential-addons-for-elementor-lite' ), |
| 2496 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2497 | ] ); |
| 2498 | $this->add_control( 'eael_form_field_po_toggle', [ |
| 2499 | 'label' => __( 'Spacing', 'essential-addons-for-elementor-lite' ), |
| 2500 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2501 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 2502 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 2503 | 'return_value' => 'yes', |
| 2504 | ] ); |
| 2505 | |
| 2506 | $this->start_popover(); |
| 2507 | $this->add_control( 'eael_form_input_fields_heading', [ |
| 2508 | 'type' => Controls_Manager::HEADING, |
| 2509 | 'label' => __( 'Form Input Fields', 'essential-addons-for-elementor-lite' ), |
| 2510 | ] ); |
| 2511 | $this->add_responsive_control( "eael_form_field_margin", [ |
| 2512 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 2513 | 'type' => Controls_Manager::DIMENSIONS, |
| 2514 | 'size_units' => [ |
| 2515 | 'px', |
| 2516 | 'em', |
| 2517 | '%', |
| 2518 | ], |
| 2519 | 'selectors' => [ |
| 2520 | "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-group" => $this->apply_dim( 'margin' ), |
| 2521 | ], |
| 2522 | 'condition' => [ |
| 2523 | 'eael_form_field_po_toggle' => 'yes', |
| 2524 | ], |
| 2525 | ] ); |
| 2526 | $this->add_responsive_control( "eael_form_field_padding", [ |
| 2527 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 2528 | 'type' => Controls_Manager::DIMENSIONS, |
| 2529 | 'size_units' => [ |
| 2530 | 'px', |
| 2531 | 'em', |
| 2532 | '%', |
| 2533 | ], |
| 2534 | 'selectors' => [ |
| 2535 | "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => $this->apply_dim( 'padding' ), |
| 2536 | ], |
| 2537 | 'condition' => [ |
| 2538 | 'eael_form_field_po_toggle' => 'yes', |
| 2539 | ], |
| 2540 | ] ); |
| 2541 | |
| 2542 | $this->add_control( 'eael_form_tc_fields_heading', [ |
| 2543 | 'type' => Controls_Manager::HEADING, |
| 2544 | 'label' => __( 'Terms & Condition Field', 'essential-addons-for-elementor-lite' ), |
| 2545 | 'separator' => 'before', |
| 2546 | ] ); |
| 2547 | $this->add_responsive_control( "eael_form_tc_field_margin", [ |
| 2548 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 2549 | 'type' => Controls_Manager::DIMENSIONS, |
| 2550 | 'size_units' => [ |
| 2551 | 'px', |
| 2552 | 'em', |
| 2553 | '%', |
| 2554 | ], |
| 2555 | 'selectors' => [ |
| 2556 | "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap" => $this->apply_dim( 'margin' ), |
| 2557 | ], |
| 2558 | 'condition' => [ |
| 2559 | 'eael_form_field_po_toggle' => 'yes', |
| 2560 | ], |
| 2561 | ] ); |
| 2562 | $this->add_responsive_control( "eael_form_tc_field_padding", [ |
| 2563 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 2564 | 'type' => Controls_Manager::DIMENSIONS, |
| 2565 | 'size_units' => [ |
| 2566 | 'px', |
| 2567 | 'em', |
| 2568 | '%', |
| 2569 | ], |
| 2570 | 'selectors' => [ |
| 2571 | "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap" => $this->apply_dim( 'padding' ), |
| 2572 | ], |
| 2573 | 'condition' => [ |
| 2574 | 'eael_form_field_po_toggle' => 'yes', |
| 2575 | ], |
| 2576 | ] ); |
| 2577 | $this->end_popover(); |
| 2578 | $this->add_group_control( Group_Control_Typography::get_type(), [ |
| 2579 | 'name' => "eael_fields_typography", |
| 2580 | 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control", |
| 2581 | ] ); |
| 2582 | $this->add_responsive_control( "ph_align", [ |
| 2583 | 'label' => __( 'Text Alignment', 'essential-addons-for-elementor-lite' ), |
| 2584 | 'type' => Controls_Manager::CHOOSE, |
| 2585 | 'options' => [ |
| 2586 | 'left' => [ |
| 2587 | 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ), |
| 2588 | 'icon' => 'eicon-h-align-left', |
| 2589 | ], |
| 2590 | 'center' => [ |
| 2591 | 'title' => __( 'Center', 'essential-addons-for-elementor-lite' ), |
| 2592 | 'icon' => 'eicon-h-align-center', |
| 2593 | ], |
| 2594 | 'right' => [ |
| 2595 | 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ), |
| 2596 | 'icon' => 'eicon-h-align-right', |
| 2597 | ], |
| 2598 | ], |
| 2599 | 'default' => 'left', |
| 2600 | 'selectors' => [ |
| 2601 | "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => 'text-align: {{VALUE}};', |
| 2602 | ], |
| 2603 | ] ); |
| 2604 | $this->add_control( 'eael_form_label_colors_heading', [ |
| 2605 | 'type' => Controls_Manager::HEADING, |
| 2606 | 'label' => __( 'Colors & Border', 'essential-addons-for-elementor-lite' ), |
| 2607 | 'separator' => 'before', |
| 2608 | ] ); |
| 2609 | $this->start_controls_tabs( "tabs_form_fields_style" ); |
| 2610 | |
| 2611 | /*-----Form Input Fields NORMAL state------ */ |
| 2612 | $this->start_controls_tab( "tab_form_field_style_normal", [ |
| 2613 | 'label' => __( 'Normal', 'essential-addons-for-elementor-lite' ), |
| 2614 | ] ); |
| 2615 | $this->add_control( 'eael_field_color', [ |
| 2616 | 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ), |
| 2617 | 'type' => Controls_Manager::COLOR, |
| 2618 | 'selectors' => [ |
| 2619 | "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => 'color: {{VALUE}};', |
| 2620 | ], |
| 2621 | ] ); |
| 2622 | $this->add_control( 'eael_field_placeholder_color', [ |
| 2623 | 'label' => __( 'Placeholder Color', 'essential-addons-for-elementor-lite' ), |
| 2624 | 'type' => Controls_Manager::COLOR, |
| 2625 | 'selectors' => [ |
| 2626 | "{{WRAPPER}} .lr-form-wrapper input.eael-lr-form-control::placeholder" => 'color: {{VALUE}};', |
| 2627 | ], |
| 2628 | ] ); |
| 2629 | $this->add_control( 'eael_field_bg_color', [ |
| 2630 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 2631 | 'type' => Controls_Manager::COLOR, |
| 2632 | 'default' => '#ffffff', |
| 2633 | 'selectors' => [ |
| 2634 | "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => 'background-color: {{VALUE}};', |
| 2635 | ], |
| 2636 | ] ); |
| 2637 | |
| 2638 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 2639 | 'name' => "eael_field_border", |
| 2640 | 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control", |
| 2641 | ] ); |
| 2642 | $this->add_control( "eael_field_border_radius", [ |
| 2643 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 2644 | 'type' => Controls_Manager::DIMENSIONS, |
| 2645 | 'size_units' => [ |
| 2646 | 'px', |
| 2647 | '%', |
| 2648 | ], |
| 2649 | 'selectors' => [ |
| 2650 | "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => $this->apply_dim( 'border-radius' ), |
| 2651 | ], |
| 2652 | ] ); |
| 2653 | |
| 2654 | $this->end_controls_tab(); |
| 2655 | |
| 2656 | $this->start_controls_tab( "tab_form_field_style_active", [ |
| 2657 | 'label' => __( 'Focus', 'essential-addons-for-elementor-lite' ), |
| 2658 | ] ); |
| 2659 | |
| 2660 | $this->add_control( 'eael_field_placeholder_color_active', [ |
| 2661 | 'label' => __( 'Placeholder Color', 'essential-addons-for-elementor-lite' ), |
| 2662 | 'type' => Controls_Manager::COLOR, |
| 2663 | 'selectors' => [ |
| 2664 | "{{WRAPPER}} .lr-form-wrapper input.eael-lr-form-control:focus::placeholder" => 'color: {{VALUE}};', |
| 2665 | ], |
| 2666 | ] ); |
| 2667 | $this->add_control( 'eael_field_bg_color_active', [ |
| 2668 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 2669 | 'type' => Controls_Manager::COLOR, |
| 2670 | 'default' => '#ffffff', |
| 2671 | 'selectors' => [ |
| 2672 | "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control:focus" => 'background-color: {{VALUE}};', |
| 2673 | ], |
| 2674 | ] ); |
| 2675 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 2676 | 'name' => "eael_field_border_focus", |
| 2677 | 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control:focus", |
| 2678 | ] ); |
| 2679 | $this->add_control( "eael_field_border_radius_focus", [ |
| 2680 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 2681 | 'type' => Controls_Manager::DIMENSIONS, |
| 2682 | 'size_units' => [ |
| 2683 | 'px', |
| 2684 | '%', |
| 2685 | ], |
| 2686 | 'selectors' => [ |
| 2687 | "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control:focus" => $this->apply_dim( 'border-radius' ), |
| 2688 | ], |
| 2689 | ] ); |
| 2690 | $this->end_controls_tab(); |
| 2691 | $this->end_controls_tabs(); |
| 2692 | $this->end_controls_section(); |
| 2693 | } |
| 2694 | |
| 2695 | protected function init_style_input_labels_controls() { |
| 2696 | $this->start_controls_section( 'section_style_form_labels', [ |
| 2697 | 'label' => __( 'Form Labels', 'essential-addons-for-elementor-lite' ), |
| 2698 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2699 | ] ); |
| 2700 | $this->add_control( 'eael_form_label_po_toggle', [ |
| 2701 | 'label' => __( 'Spacing', 'essential-addons-for-elementor-lite' ), |
| 2702 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2703 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 2704 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 2705 | 'return_value' => 'yes', |
| 2706 | ] ); |
| 2707 | |
| 2708 | $this->start_popover(); |
| 2709 | $this->add_responsive_control( "eael_form_label_margin", [ |
| 2710 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 2711 | 'type' => Controls_Manager::DIMENSIONS, |
| 2712 | 'size_units' => [ |
| 2713 | 'px', |
| 2714 | 'em', |
| 2715 | '%', |
| 2716 | ], |
| 2717 | 'selectors' => [ |
| 2718 | "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => $this->apply_dim( 'margin' ), |
| 2719 | ], |
| 2720 | 'condition' => [ |
| 2721 | 'eael_form_label_po_toggle' => 'yes', |
| 2722 | ], |
| 2723 | ] ); |
| 2724 | $this->add_responsive_control( "eael_form_label_padding", [ |
| 2725 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 2726 | 'type' => Controls_Manager::DIMENSIONS, |
| 2727 | 'size_units' => [ |
| 2728 | 'px', |
| 2729 | 'em', |
| 2730 | '%', |
| 2731 | ], |
| 2732 | 'selectors' => [ |
| 2733 | "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => $this->apply_dim( 'padding' ), |
| 2734 | ], |
| 2735 | 'condition' => [ |
| 2736 | 'eael_form_label_po_toggle' => 'yes', |
| 2737 | ], |
| 2738 | ] ); |
| 2739 | $this->end_popover(); |
| 2740 | $this->add_group_control( Group_Control_Typography::get_type(), [ |
| 2741 | 'name' => "eael_label_typography", |
| 2742 | 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-field-label", |
| 2743 | ] ); |
| 2744 | |
| 2745 | $this->add_control( 'eael_form_label_c_po_toggle', [ |
| 2746 | 'label' => __( 'Colors', 'essential-addons-for-elementor-lite' ), |
| 2747 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2748 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 2749 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 2750 | 'return_value' => 'yes', |
| 2751 | ] ); |
| 2752 | |
| 2753 | $this->start_popover(); |
| 2754 | $this->add_control( 'eael_label_color', [ |
| 2755 | 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ), |
| 2756 | 'type' => Controls_Manager::COLOR, |
| 2757 | 'selectors' => [ |
| 2758 | "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => 'color: {{VALUE}};', |
| 2759 | ], |
| 2760 | 'condition' => [ |
| 2761 | 'eael_form_label_c_po_toggle' => 'yes', |
| 2762 | ], |
| 2763 | ] ); |
| 2764 | $this->add_control( 'eael_label_bg_color', [ |
| 2765 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 2766 | 'type' => Controls_Manager::COLOR, |
| 2767 | 'default' => '#ffffff', |
| 2768 | 'selectors' => [ |
| 2769 | "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => 'background-color: {{VALUE}};', |
| 2770 | ], |
| 2771 | 'condition' => [ |
| 2772 | 'eael_form_label_c_po_toggle' => 'yes', |
| 2773 | ], |
| 2774 | ] ); |
| 2775 | $this->end_popover(); |
| 2776 | |
| 2777 | $this->add_control( 'eael_form_label_b_po_toggle', [ |
| 2778 | 'label' => __( 'Border', 'essential-addons-for-elementor-lite' ), |
| 2779 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2780 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 2781 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 2782 | 'return_value' => 'yes', |
| 2783 | ] ); |
| 2784 | |
| 2785 | $this->start_popover(); |
| 2786 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 2787 | 'name' => "eael_label_border", |
| 2788 | 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-field-label", |
| 2789 | 'condition' => [ |
| 2790 | 'eael_form_label_b_po_toggle' => 'yes', |
| 2791 | ], |
| 2792 | ] ); |
| 2793 | $this->add_control( "eael_label_border_radius", [ |
| 2794 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 2795 | 'type' => Controls_Manager::DIMENSIONS, |
| 2796 | 'size_units' => [ |
| 2797 | 'px', |
| 2798 | '%', |
| 2799 | ], |
| 2800 | 'selectors' => [ |
| 2801 | "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => $this->apply_dim( 'border-radius' ), |
| 2802 | ], |
| 2803 | 'condition' => [ |
| 2804 | 'eael_form_label_b_po_toggle' => 'yes', |
| 2805 | ], |
| 2806 | ] ); |
| 2807 | $this->end_popover(); |
| 2808 | |
| 2809 | $this->add_control( 'rmark_po_toggle', [ |
| 2810 | 'label' => __( 'Required Mark Style', 'essential-addons-for-elementor-lite' ), |
| 2811 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2812 | 'condition' => [ |
| 2813 | 'show_labels' => 'yes', |
| 2814 | 'mark_required' => 'yes', |
| 2815 | ], |
| 2816 | ] ); |
| 2817 | |
| 2818 | $this->start_popover(); |
| 2819 | $this->add_control( 'rmark_sign', [ |
| 2820 | 'label' => __( 'Mark Sign', 'essential-addons-for-elementor-lite' ), |
| 2821 | 'type' => Controls_Manager::TEXT, |
| 2822 | 'default' => '*', |
| 2823 | 'placeholder' => 'Enter * or (required) etc.', |
| 2824 | 'selectors' => [ |
| 2825 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'content: "{{VALUE}}";', |
| 2826 | ], |
| 2827 | 'condition' => [ |
| 2828 | 'rmark_po_toggle' => 'yes', |
| 2829 | ], |
| 2830 | ] ); |
| 2831 | $this->add_control( "rmark_size", [ |
| 2832 | 'label' => esc_html__( 'Size', 'essential-addons-for-elementor-lite' ), |
| 2833 | 'type' => Controls_Manager::SLIDER, |
| 2834 | 'size_units' => [ |
| 2835 | 'px', |
| 2836 | 'rem', |
| 2837 | '%', |
| 2838 | ], |
| 2839 | 'range' => [ |
| 2840 | 'px' => [ |
| 2841 | 'min' => 0, |
| 2842 | 'max' => 50, |
| 2843 | 'step' => 1, |
| 2844 | ], |
| 2845 | ], |
| 2846 | 'selectors' => [ |
| 2847 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'font-size: {{SIZE}}{{UNIT}};', |
| 2848 | ], |
| 2849 | 'condition' => [ |
| 2850 | 'rmark_po_toggle' => 'yes', |
| 2851 | ], |
| 2852 | ] ); |
| 2853 | $this->add_control( "rmakr_color", [ |
| 2854 | 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ), |
| 2855 | 'type' => Controls_Manager::COLOR, |
| 2856 | 'selectors' => [ |
| 2857 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'color: {{VALUE}};', |
| 2858 | ], |
| 2859 | 'condition' => [ |
| 2860 | 'rmark_po_toggle' => 'yes', |
| 2861 | ], |
| 2862 | ] ); |
| 2863 | |
| 2864 | $this->add_responsive_control( "rmark_valign", [ |
| 2865 | 'label' => esc_html__( 'Vertical Alignment', 'essential-addons-for-elementor-lite' ), |
| 2866 | 'type' => Controls_Manager::SLIDER, |
| 2867 | 'range' => [ |
| 2868 | 'px' => [ |
| 2869 | 'min' => - 50, |
| 2870 | 'max' => 50, |
| 2871 | 'step' => 0, |
| 2872 | ], |
| 2873 | ], |
| 2874 | 'default' => [ |
| 2875 | 'unit' => 'px', |
| 2876 | 'size' => 17, |
| 2877 | ], |
| 2878 | 'selectors' => [ |
| 2879 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'top: {{SIZE}}px;', |
| 2880 | ], |
| 2881 | 'condition' => [ |
| 2882 | 'rmark_po_toggle' => 'yes', |
| 2883 | ], |
| 2884 | ] ); |
| 2885 | $this->add_responsive_control( "rmark_halign", [ |
| 2886 | 'label' => esc_html__( 'Horizontal Alignment', 'essential-addons-for-elementor-lite' ), |
| 2887 | 'type' => Controls_Manager::SLIDER, |
| 2888 | 'range' => [ |
| 2889 | 'px' => [ |
| 2890 | 'min' => - 50, |
| 2891 | 'max' => 50, |
| 2892 | 'step' => 0, |
| 2893 | ], |
| 2894 | ], |
| 2895 | 'default' => [ |
| 2896 | 'unit' => 'px', |
| 2897 | 'size' => - 10, |
| 2898 | ], |
| 2899 | 'selectors' => [ |
| 2900 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'right: {{SIZE}}px;', |
| 2901 | ], |
| 2902 | 'condition' => [ |
| 2903 | 'rmark_po_toggle' => 'yes', |
| 2904 | ], |
| 2905 | ] ); |
| 2906 | |
| 2907 | $this->end_popover(); |
| 2908 | $this->add_control( 'lpv_po_toggle', [ |
| 2909 | 'label' => __( 'Password Visibility Style', 'essential-addons-for-elementor-lite' ), |
| 2910 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 2911 | 'condition' => [ |
| 2912 | 'password_toggle' => 'yes', |
| 2913 | ], |
| 2914 | ] ); |
| 2915 | $this->start_popover(); |
| 2916 | |
| 2917 | $this->add_responsive_control( "lpv_size", [ |
| 2918 | 'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite' ), |
| 2919 | 'type' => Controls_Manager::SLIDER, |
| 2920 | 'size_units' => [ |
| 2921 | 'px', |
| 2922 | 'rem', |
| 2923 | '%', |
| 2924 | ], |
| 2925 | 'range' => [ |
| 2926 | 'px' => [ |
| 2927 | 'min' => 0, |
| 2928 | 'max' => 50, |
| 2929 | 'step' => 1, |
| 2930 | ], |
| 2931 | ], |
| 2932 | 'selectors' => [ |
| 2933 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group .dashicons" => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}', |
| 2934 | ], |
| 2935 | 'condition' => [ |
| 2936 | 'lpv_po_toggle' => 'yes', |
| 2937 | ], |
| 2938 | ] ); |
| 2939 | $this->add_control( "lvp_open_color", [ |
| 2940 | 'label' => __( 'Open Eye Color', 'essential-addons-for-elementor-lite' ), |
| 2941 | 'type' => Controls_Manager::COLOR, |
| 2942 | 'selectors' => [ |
| 2943 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group .dashicons-visibility" => 'color: {{VALUE}};', |
| 2944 | ], |
| 2945 | 'condition' => [ |
| 2946 | 'lpv_po_toggle' => 'yes', |
| 2947 | ], |
| 2948 | ] ); |
| 2949 | $this->add_control( "lvp_close_color", [ |
| 2950 | 'label' => __( 'Close Eye Color', 'essential-addons-for-elementor-lite' ), |
| 2951 | 'type' => Controls_Manager::COLOR, |
| 2952 | 'selectors' => [ |
| 2953 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group .dashicons-hidden" => 'color: {{VALUE}};', |
| 2954 | ], |
| 2955 | 'condition' => [ |
| 2956 | 'lpv_po_toggle' => 'yes', |
| 2957 | ], |
| 2958 | ] ); |
| 2959 | |
| 2960 | $this->add_responsive_control( "lpv_valign", [ |
| 2961 | 'label' => esc_html__( 'Vertical Alignment', 'essential-addons-for-elementor-lite' ), |
| 2962 | 'type' => Controls_Manager::SLIDER, |
| 2963 | 'range' => [ |
| 2964 | 'px' => [ |
| 2965 | 'min' => - 50, |
| 2966 | 'max' => 50, |
| 2967 | 'step' => 1, |
| 2968 | ], |
| 2969 | ], |
| 2970 | 'default' => [ |
| 2971 | 'unit' => 'px', |
| 2972 | 'size' => 0.73, |
| 2973 | ], |
| 2974 | 'selectors' => [ |
| 2975 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group .wp-hide-pw" => 'top: {{SIZE}}px;', |
| 2976 | ], |
| 2977 | 'condition' => [ |
| 2978 | 'lpv_po_toggle' => 'yes', |
| 2979 | ], |
| 2980 | ] ); |
| 2981 | $this->add_responsive_control( "lpv_halign", [ |
| 2982 | 'label' => esc_html__( 'Horizontal Alignment', 'essential-addons-for-elementor-lite' ), |
| 2983 | 'type' => Controls_Manager::SLIDER, |
| 2984 | 'range' => [ |
| 2985 | 'px' => [ |
| 2986 | 'min' => - 50, |
| 2987 | 'max' => 50, |
| 2988 | 'step' => 1, |
| 2989 | ], |
| 2990 | ], |
| 2991 | 'default' => [ |
| 2992 | 'unit' => 'px', |
| 2993 | 'size' => - 27, |
| 2994 | ], |
| 2995 | 'selectors' => [ |
| 2996 | "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group .wp-hide-pw" => 'right: {{SIZE}}px;', |
| 2997 | ], |
| 2998 | 'condition' => [ |
| 2999 | 'lpv_po_toggle' => 'yes', |
| 3000 | ], |
| 3001 | ] ); |
| 3002 | |
| 3003 | $this->end_popover(); |
| 3004 | |
| 3005 | //Remember Me Style |
| 3006 | $this->add_control( 'eael_form_rm_fields_heading', [ |
| 3007 | 'type' => Controls_Manager::HEADING, |
| 3008 | 'label' => __( 'Remember Me Field', 'essential-addons-for-elementor-lite' ), |
| 3009 | 'separator' => 'before', |
| 3010 | ] ); |
| 3011 | $this->add_control( 'remember_me_style_pot', [ |
| 3012 | 'label' => __( 'Remember Me Style', 'essential-addons-for-elementor-lite' ), |
| 3013 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 3014 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 3015 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 3016 | 'return_value' => 'yes', |
| 3017 | 'condition' => [ |
| 3018 | 'login_show_remember_me' => 'yes', |
| 3019 | ], |
| 3020 | ] ); |
| 3021 | |
| 3022 | $this->start_popover(); |
| 3023 | $this->add_control( 'remember_me_style', [ |
| 3024 | 'label' => __( 'Style', 'essential-addons-for-elementor-lite' ), |
| 3025 | 'type' => Controls_Manager::SELECT, |
| 3026 | 'default' => 'lr-checkbox', |
| 3027 | 'options' => [ |
| 3028 | 'lr-checkbox' => __( 'Checkbox', 'essential-addons-for-elementor-lite' ), |
| 3029 | 'lr-toggle' => __( 'Toggle', 'essential-addons-for-elementor-lite' ), |
| 3030 | ], |
| 3031 | 'condition' => [ |
| 3032 | 'remember_me_style_pot' => 'yes', |
| 3033 | ], |
| 3034 | 'separator' => 'before', |
| 3035 | ] ); |
| 3036 | |
| 3037 | $this->add_responsive_control( "eael_form_rm_field_margin", [ |
| 3038 | 'label' => __( 'Container Margin', 'essential-addons-for-elementor-lite' ), |
| 3039 | 'type' => Controls_Manager::DIMENSIONS, |
| 3040 | 'size_units' => [ |
| 3041 | 'px', |
| 3042 | 'em', |
| 3043 | '%', |
| 3044 | ], |
| 3045 | 'selectors' => [ |
| 3046 | "{{WRAPPER}} .lr-form-wrapper .eael-forever-forget" => $this->apply_dim( 'margin' ), |
| 3047 | ], |
| 3048 | 'condition' => [ |
| 3049 | 'remember_me_style_pot' => 'yes', |
| 3050 | ], |
| 3051 | ] ); |
| 3052 | $this->add_responsive_control( "eael_form_rm_field_padding", [ |
| 3053 | 'label' => __( 'Container Padding', 'essential-addons-for-elementor-lite' ), |
| 3054 | 'type' => Controls_Manager::DIMENSIONS, |
| 3055 | 'size_units' => [ |
| 3056 | 'px', |
| 3057 | 'em', |
| 3058 | '%', |
| 3059 | ], |
| 3060 | 'selectors' => [ |
| 3061 | "{{WRAPPER}} .lr-form-wrapper .eael-forever-forget" => $this->apply_dim( 'padding' ), |
| 3062 | ], |
| 3063 | 'condition' => [ |
| 3064 | 'remember_me_style_pot' => 'yes', |
| 3065 | ], |
| 3066 | ] ); |
| 3067 | $this->add_responsive_control( "eael_form_rm_lbl_margin", [ |
| 3068 | 'label' => __( 'Label Margin', 'essential-addons-for-elementor-lite' ), |
| 3069 | 'type' => Controls_Manager::DIMENSIONS, |
| 3070 | 'size_units' => [ |
| 3071 | 'px', |
| 3072 | 'em', |
| 3073 | '%', |
| 3074 | ], |
| 3075 | 'selectors' => [ |
| 3076 | "{{WRAPPER}} .lr-form-wrapper .forget-menot" => $this->apply_dim( 'margin' ), |
| 3077 | ], |
| 3078 | 'condition' => [ |
| 3079 | 'remember_me_style_pot' => 'yes', |
| 3080 | ], |
| 3081 | ] ); |
| 3082 | $this->add_responsive_control( "eael_form_rm_lbl_padding", [ |
| 3083 | 'label' => __( 'Label Padding', 'essential-addons-for-elementor-lite' ), |
| 3084 | 'type' => Controls_Manager::DIMENSIONS, |
| 3085 | 'size_units' => [ |
| 3086 | 'px', |
| 3087 | 'em', |
| 3088 | '%', |
| 3089 | ], |
| 3090 | 'selectors' => [ |
| 3091 | "{{WRAPPER}} .lr-form-wrapper .forget-menot" => $this->apply_dim( 'padding' ), |
| 3092 | ], |
| 3093 | 'condition' => [ |
| 3094 | 'remember_me_style_pot' => 'yes', |
| 3095 | ], |
| 3096 | ] ); |
| 3097 | |
| 3098 | $this->add_control( 'eael_rm_label_color', [ |
| 3099 | 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ), |
| 3100 | 'type' => Controls_Manager::COLOR, |
| 3101 | 'selectors' => [ |
| 3102 | "{{WRAPPER}} .lr-form-wrapper .forget-menot" => 'color: {{VALUE}};', |
| 3103 | ], |
| 3104 | 'condition' => [ |
| 3105 | 'remember_me_style_pot' => 'yes', |
| 3106 | ], |
| 3107 | ] ); |
| 3108 | $this->add_control( 'eael_rm_label_bg_color', [ |
| 3109 | 'label' => __( 'Text Background', 'essential-addons-for-elementor-lite' ), |
| 3110 | 'type' => Controls_Manager::COLOR, |
| 3111 | 'default' => '#ffffff', |
| 3112 | 'selectors' => [ |
| 3113 | "{{WRAPPER}} .lr-form-wrapper .forget-menot" => 'background-color: {{VALUE}};', |
| 3114 | ], |
| 3115 | 'condition' => [ |
| 3116 | 'remember_me_style_pot' => 'yes', |
| 3117 | ], |
| 3118 | ] ); |
| 3119 | $this->add_control( 'eael_rm_checkbox_color', [ |
| 3120 | 'label' => __( 'Checkbox | Toggle Color', 'essential-addons-for-elementor-lite' ), |
| 3121 | 'type' => Controls_Manager::COLOR, |
| 3122 | 'selectors' => [ |
| 3123 | "{{WRAPPER}} .lr-form-wrapper .forget-menot input[type=checkbox]:checked" => 'border-color: {{VALUE}};background: {{VALUE}};', |
| 3124 | ], |
| 3125 | 'condition' => [ |
| 3126 | 'remember_me_style_pot' => 'yes', |
| 3127 | ], |
| 3128 | ] ); |
| 3129 | $this->end_popover(); |
| 3130 | $this->add_group_control( Group_Control_Typography::get_type(), [ |
| 3131 | 'label' => __( 'Remember Me Typography', 'essential-addons-for-elementor-lite' ), |
| 3132 | 'name' => "eael_rm_label_typography", |
| 3133 | 'selector' => "{{WRAPPER}} .lr-form-wrapper .forget-menot", |
| 3134 | ] ); |
| 3135 | $this->end_controls_section(); |
| 3136 | } |
| 3137 | |
| 3138 | protected function init_style_login_button_controls() { |
| 3139 | $this->_init_button_style( 'login' ); |
| 3140 | } |
| 3141 | |
| 3142 | protected function init_style_register_button_controls() { |
| 3143 | $this->_init_button_style( 'register' ); |
| 3144 | } |
| 3145 | |
| 3146 | protected function init_style_login_link_controls() { |
| 3147 | $this->_init_link_style( 'login' ); |
| 3148 | } |
| 3149 | |
| 3150 | protected function init_style_register_link_controls() { |
| 3151 | $this->_init_link_style( 'register' ); |
| 3152 | } |
| 3153 | |
| 3154 | protected function init_style_login_recaptcha_controls() { |
| 3155 | $this->_init_recaptcha_style( 'login' ); |
| 3156 | } |
| 3157 | |
| 3158 | protected function init_style_register_recaptcha_controls() { |
| 3159 | $this->_init_recaptcha_style( 'register' ); |
| 3160 | } |
| 3161 | |
| 3162 | /** |
| 3163 | * Print style controls for a specific type of button. |
| 3164 | * |
| 3165 | * @param string $button_type the type of the button. accepts login or register. |
| 3166 | */ |
| 3167 | protected function _init_button_style( $button_type = 'login' ) { |
| 3168 | $this->start_controls_section( "section_style_{$button_type}_btn", [ |
| 3169 | 'label' => sprintf( __( '%s Button', 'essential-addons-for-elementor-lite' ), ucfirst( $button_type ) ), |
| 3170 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3171 | 'conditions' => $this->get_form_controls_display_condition( $button_type ), |
| 3172 | ] ); |
| 3173 | $this->add_control( "{$button_type}_btn_pot", [ |
| 3174 | 'label' => __( 'Spacing', 'essential-addons-for-elementor-lite' ), |
| 3175 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 3176 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 3177 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 3178 | 'return_value' => 'yes', |
| 3179 | ] ); |
| 3180 | $this->start_popover(); |
| 3181 | $this->add_responsive_control( "{$button_type}_btn_margin", [ |
| 3182 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 3183 | 'type' => Controls_Manager::DIMENSIONS, |
| 3184 | 'size_units' => [ |
| 3185 | 'px', |
| 3186 | 'em', |
| 3187 | '%', |
| 3188 | ], |
| 3189 | 'selectors' => [ |
| 3190 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => $this->apply_dim( 'margin' ), |
| 3191 | ], |
| 3192 | 'condition' => [ |
| 3193 | "{$button_type}_btn_pot" => 'yes', |
| 3194 | ], |
| 3195 | ] ); |
| 3196 | $this->add_responsive_control( "{$button_type}_btn_padding", [ |
| 3197 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 3198 | 'type' => Controls_Manager::DIMENSIONS, |
| 3199 | 'size_units' => [ |
| 3200 | 'px', |
| 3201 | 'em', |
| 3202 | '%', |
| 3203 | ], |
| 3204 | 'selectors' => [ |
| 3205 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => $this->apply_dim( 'padding' ), |
| 3206 | ], |
| 3207 | 'condition' => [ |
| 3208 | "{$button_type}_btn_pot" => 'yes', |
| 3209 | ], |
| 3210 | ] ); |
| 3211 | $this->end_popover(); |
| 3212 | $this->add_group_control( Group_Control_Typography::get_type(), [ |
| 3213 | 'name' => "{$button_type}_btn_typography", |
| 3214 | 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn", |
| 3215 | ] ); |
| 3216 | $this->add_responsive_control( "{$button_type}_btn_d_type", [ |
| 3217 | 'label' => __( 'Display as', 'essential-addons-for-elementor-lite' ), |
| 3218 | 'type' => Controls_Manager::SELECT, |
| 3219 | 'options' => [ |
| 3220 | 'row' => __( 'Inline', 'essential-addons-for-elementor-lite' ), |
| 3221 | 'column' => __( 'Block', 'essential-addons-for-elementor-lite' ), |
| 3222 | ], |
| 3223 | 'default' => 'row', |
| 3224 | 'selectors' => [ |
| 3225 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-footer" => 'flex-direction: {{VALUE}};', |
| 3226 | "{{WRAPPER}} .eael-{$button_type}-form .eael-sign-wrapper" => 'padding-top: 0;', |
| 3227 | ], |
| 3228 | ] ); |
| 3229 | |
| 3230 | |
| 3231 | $this->add_responsive_control( "{$button_type}_btn_jc", [ |
| 3232 | 'label' => __( 'Justify Content', 'essential-addons-for-elementor-lite' ), |
| 3233 | 'type' => Controls_Manager::SELECT, |
| 3234 | 'options' => [ |
| 3235 | 'flex-start' => __( 'Start', 'essential-addons-for-elementor-lite' ), |
| 3236 | 'flex-end' => __( 'End', 'essential-addons-for-elementor-lite' ), |
| 3237 | 'center' => __( 'Center', 'essential-addons-for-elementor-lite' ), |
| 3238 | 'space-between' => __( 'Space Between', 'essential-addons-for-elementor-lite' ), |
| 3239 | 'space-around' => __( 'Space Around', 'essential-addons-for-elementor-lite' ), |
| 3240 | 'space-evenly' => __( 'Space Evenly', 'essential-addons-for-elementor-lite' ), |
| 3241 | ], |
| 3242 | 'default' => 'space-between', |
| 3243 | 'condition' => [ |
| 3244 | "{$button_type}_btn_d_type" => 'row', |
| 3245 | ], |
| 3246 | 'selectors' => [ |
| 3247 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-footer" => 'justify-content: {{VALUE}};', |
| 3248 | ], |
| 3249 | ] ); |
| 3250 | $this->add_responsive_control( "{$button_type}_btn_align", [ |
| 3251 | 'label' => __( 'Alignment', 'essential-addons-for-elementor-lite' ), |
| 3252 | 'type' => Controls_Manager::CHOOSE, |
| 3253 | 'options' => [ |
| 3254 | 'mr-auto' => [ |
| 3255 | 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ), |
| 3256 | 'icon' => 'eicon-h-align-left', |
| 3257 | ], |
| 3258 | 'ml-auto mr-auto' => [ |
| 3259 | 'title' => __( 'Center', 'essential-addons-for-elementor-lite' ), |
| 3260 | 'icon' => 'eicon-h-align-center', |
| 3261 | ], |
| 3262 | 'ml-auto' => [ |
| 3263 | 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ), |
| 3264 | 'icon' => 'eicon-h-align-right', |
| 3265 | ], |
| 3266 | ], |
| 3267 | 'default' => '', |
| 3268 | 'condition' => [ |
| 3269 | "{$button_type}_btn_d_type" => 'column', |
| 3270 | ], |
| 3271 | ] ); |
| 3272 | $this->add_control( "tabs_{$button_type}_btn_colors_heading", [ |
| 3273 | 'type' => Controls_Manager::HEADING, |
| 3274 | 'label' => __( 'Colors & Border', 'essential-addons-for-elementor-lite' ), |
| 3275 | 'separator' => 'before', |
| 3276 | ] ); |
| 3277 | |
| 3278 | $this->start_controls_tabs( "tabs_{$button_type}_btn_style" ); |
| 3279 | /*-----Login Button NORMAL state------ */ |
| 3280 | $this->start_controls_tab( "tab_{$button_type}_btn_normal", [ |
| 3281 | 'label' => __( 'Normal', 'essential-addons-for-elementor-lite' ), |
| 3282 | ] ); |
| 3283 | $this->add_control( "{$button_type}_btn_color", [ |
| 3284 | 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ), |
| 3285 | 'type' => Controls_Manager::COLOR, |
| 3286 | 'selectors' => [ |
| 3287 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => 'color: {{VALUE}};', |
| 3288 | ], |
| 3289 | ] ); |
| 3290 | $this->add_group_control( Group_Control_Background::get_type(), [ |
| 3291 | 'name' => "{$button_type}_btn_bg_color", |
| 3292 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 3293 | 'types' => [ |
| 3294 | 'classic', |
| 3295 | 'gradient', |
| 3296 | ], |
| 3297 | 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn", |
| 3298 | ] ); |
| 3299 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 3300 | 'name' => "{$button_type}_btn_border", |
| 3301 | 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn", |
| 3302 | ] ); |
| 3303 | $this->add_control( "{$button_type}_btn_border_radius", [ |
| 3304 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 3305 | 'type' => Controls_Manager::DIMENSIONS, |
| 3306 | 'size_units' => [ |
| 3307 | 'px', |
| 3308 | '%', |
| 3309 | ], |
| 3310 | 'selectors' => [ |
| 3311 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => $this->apply_dim( 'border-radius' ), |
| 3312 | ], |
| 3313 | ] ); |
| 3314 | $this->end_controls_tab(); |
| 3315 | |
| 3316 | /*-----Login Button HOVER state------ */ |
| 3317 | $this->start_controls_tab( "tab_{$button_type}_button_hover", [ |
| 3318 | 'label' => __( 'Hover', 'essential-addons-for-elementor-lite' ), |
| 3319 | ] ); |
| 3320 | $this->add_control( "{$button_type}_button_color_hover", [ |
| 3321 | 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ), |
| 3322 | 'type' => Controls_Manager::COLOR, |
| 3323 | 'selectors' => [ |
| 3324 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover" => 'color: {{VALUE}};', |
| 3325 | ], |
| 3326 | ] ); |
| 3327 | $this->add_group_control( Group_Control_Background::get_type(), [ |
| 3328 | 'name' => "{$button_type}_btn_bg_color_hover", |
| 3329 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 3330 | 'types' => [ |
| 3331 | 'classic', |
| 3332 | 'gradient', |
| 3333 | ], |
| 3334 | 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover", |
| 3335 | ] ); |
| 3336 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 3337 | 'name' => "{$button_type}_btn_border_hover", |
| 3338 | 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover", |
| 3339 | ] ); |
| 3340 | $this->add_control( "{$button_type}_btn_border_radius_hover", [ |
| 3341 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 3342 | 'type' => Controls_Manager::DIMENSIONS, |
| 3343 | 'size_units' => [ |
| 3344 | 'px', |
| 3345 | '%', |
| 3346 | ], |
| 3347 | 'selectors' => [ |
| 3348 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover" => $this->apply_dim( 'border-radius' ), |
| 3349 | ], |
| 3350 | ] ); |
| 3351 | $this->end_controls_tab(); |
| 3352 | $this->end_controls_tabs(); |
| 3353 | /*-----ends Button tabs--------*/ |
| 3354 | |
| 3355 | $this->add_responsive_control( "{$button_type}_btn_width", [ |
| 3356 | 'label' => esc_html__( 'Button width', 'essential-addons-for-elementor-lite' ), |
| 3357 | 'type' => Controls_Manager::SLIDER, |
| 3358 | 'size_units' => [ |
| 3359 | 'px', |
| 3360 | '%', |
| 3361 | ], |
| 3362 | 'range' => [ |
| 3363 | 'px' => [ |
| 3364 | 'min' => 0, |
| 3365 | 'max' => 500, |
| 3366 | 'step' => 5, |
| 3367 | ], |
| 3368 | '%' => [ |
| 3369 | 'min' => 0, |
| 3370 | 'max' => 100, |
| 3371 | ], |
| 3372 | ], |
| 3373 | 'selectors' => [ |
| 3374 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => 'width: {{SIZE}}{{UNIT}};', |
| 3375 | ], |
| 3376 | 'separator' => 'before', |
| 3377 | ] ); |
| 3378 | $this->add_responsive_control( "{$button_type}_btn_height", [ |
| 3379 | 'label' => esc_html__( 'Button Height', 'essential-addons-for-elementor-lite' ), |
| 3380 | 'type' => Controls_Manager::SLIDER, |
| 3381 | 'size_units' => [ |
| 3382 | 'px', |
| 3383 | '%', |
| 3384 | ], |
| 3385 | 'range' => [ |
| 3386 | 'px' => [ |
| 3387 | 'min' => 0, |
| 3388 | 'max' => 500, |
| 3389 | 'step' => 5, |
| 3390 | ], |
| 3391 | '%' => [ |
| 3392 | 'min' => 0, |
| 3393 | 'max' => 100, |
| 3394 | ], |
| 3395 | ], |
| 3396 | 'selectors' => [ |
| 3397 | "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => 'height: {{SIZE}}{{UNIT}};', |
| 3398 | ], |
| 3399 | ] ); |
| 3400 | $this->end_controls_section(); |
| 3401 | } |
| 3402 | |
| 3403 | /** |
| 3404 | * Print style controls for a specific type of reCAPTCHA. |
| 3405 | * |
| 3406 | * @param string $form_type the type of the reCAPTCHA. accepts login or register. |
| 3407 | */ |
| 3408 | protected function _init_recaptcha_style( $form_type = 'login' ) { |
| 3409 | $this->start_controls_section( "section_style_{$form_type}_rc", [ |
| 3410 | 'label' => sprintf( __( '%s Form reCAPTCHA', 'essential-addons-for-elementor-lite' ), ucfirst( $form_type ) ), |
| 3411 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3412 | 'condition' => [ |
| 3413 | "enable_{$form_type}_recaptcha" => 'yes', |
| 3414 | ], |
| 3415 | ] ); |
| 3416 | $this->add_responsive_control( "{$form_type}_rc_margin", [ |
| 3417 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 3418 | 'type' => Controls_Manager::DIMENSIONS, |
| 3419 | 'size_units' => [ |
| 3420 | 'px', |
| 3421 | 'em', |
| 3422 | '%', |
| 3423 | ], |
| 3424 | 'selectors' => [ |
| 3425 | "{{WRAPPER}} .eael-{$form_type}-form .eael-recaptcha-wrapper" => $this->apply_dim( 'margin' ), |
| 3426 | ], |
| 3427 | |
| 3428 | ] ); |
| 3429 | |
| 3430 | $this->add_control( "{$form_type}_rc_theme", [ |
| 3431 | 'label' => __( 'Theme', 'essential-addons-for-elementor-lite' ), |
| 3432 | 'type' => Controls_Manager::SELECT, |
| 3433 | 'options' => [ |
| 3434 | 'light' => __( 'Light', 'essential-addons-for-elementor-lite' ), |
| 3435 | 'dark' => __( 'Dark', 'essential-addons-for-elementor-lite' ), |
| 3436 | ], |
| 3437 | 'default' => 'light', |
| 3438 | ] ); |
| 3439 | |
| 3440 | $this->add_control( "{$form_type}_rc_size", [ |
| 3441 | 'label' => __( 'Size', 'essential-addons-for-elementor-lite' ), |
| 3442 | 'type' => Controls_Manager::SELECT, |
| 3443 | 'options' => [ |
| 3444 | 'normal' => __( 'Normal', 'essential-addons-for-elementor-lite' ), |
| 3445 | 'compact' => __( 'Compact', 'essential-addons-for-elementor-lite' ), |
| 3446 | ], |
| 3447 | 'default' => 'normal', |
| 3448 | ] ); |
| 3449 | |
| 3450 | $this->end_controls_section(); |
| 3451 | } |
| 3452 | |
| 3453 | /** |
| 3454 | * Print style controls for a specific type of link on register or login form. |
| 3455 | * |
| 3456 | * @param string $form_type the type of form where the link is being shown. accepts login or register. |
| 3457 | */ |
| 3458 | protected function _init_link_style( $form_type = 'login' ) { |
| 3459 | $form_name = 'login' === $form_type ? __( 'Register', 'essential-addons-for-elementor-lite' ) : __( 'Login', 'essential-addons-for-elementor-lite' ); |
| 3460 | $this->start_controls_section( "section_style_{$form_type}_link", [ |
| 3461 | 'label' => sprintf( __( '%s Link', 'essential-addons-for-elementor-lite' ), ucfirst( $form_name ) ), |
| 3462 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3463 | 'condition' => [ |
| 3464 | "show_{$form_type}_link" => 'yes', |
| 3465 | ], |
| 3466 | ] ); |
| 3467 | $this->add_control( "{$form_type}_link_style_notice", [ |
| 3468 | 'type' => Controls_Manager::RAW_HTML, |
| 3469 | 'raw' => sprintf( __( 'Here you can style the %s link displayed on the %s Form', 'essential-addons-for-elementor-lite' ), $form_name, ucfirst( $form_type ) ), |
| 3470 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 3471 | ] ); |
| 3472 | $this->add_control( "{$form_type}_link_pot", [ |
| 3473 | 'label' => __( 'Spacing', 'essential-addons-for-elementor-lite' ), |
| 3474 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 3475 | 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ), |
| 3476 | 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ), |
| 3477 | 'return_value' => 'yes', |
| 3478 | ] ); |
| 3479 | $this->start_popover(); |
| 3480 | $this->add_responsive_control( "{$form_type}_link_margin", [ |
| 3481 | 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ), |
| 3482 | 'type' => Controls_Manager::DIMENSIONS, |
| 3483 | 'size_units' => [ |
| 3484 | 'px', |
| 3485 | 'em', |
| 3486 | '%', |
| 3487 | ], |
| 3488 | 'selectors' => [ |
| 3489 | "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => $this->apply_dim( 'margin' ), |
| 3490 | ], |
| 3491 | 'condition' => [ |
| 3492 | "{$form_type}_link_pot" => 'yes', |
| 3493 | ], |
| 3494 | ] ); |
| 3495 | $this->add_responsive_control( "{$form_type}_link_padding", [ |
| 3496 | 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ), |
| 3497 | 'type' => Controls_Manager::DIMENSIONS, |
| 3498 | 'size_units' => [ |
| 3499 | 'px', |
| 3500 | 'em', |
| 3501 | '%', |
| 3502 | ], |
| 3503 | 'selectors' => [ |
| 3504 | "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => $this->apply_dim( 'padding' ), |
| 3505 | ], |
| 3506 | 'condition' => [ |
| 3507 | "{$form_type}_link_pot" => 'yes', |
| 3508 | ], |
| 3509 | ] ); |
| 3510 | $this->end_popover(); |
| 3511 | $this->add_group_control( Group_Control_Typography::get_type(), [ |
| 3512 | 'name' => "{$form_type}_link_typography", |
| 3513 | 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link", |
| 3514 | ] ); |
| 3515 | |
| 3516 | $this->add_responsive_control( "{$form_type}_link_d_type", [ |
| 3517 | 'label' => __( 'Display as', 'essential-addons-for-elementor-lite' ), |
| 3518 | 'type' => Controls_Manager::SELECT, |
| 3519 | 'options' => [ |
| 3520 | 'row' => __( 'Inline', 'essential-addons-for-elementor-lite' ), |
| 3521 | 'column' => __( 'Block', 'essential-addons-for-elementor-lite' ), |
| 3522 | ], |
| 3523 | 'default' => 'row', |
| 3524 | 'selectors' => [ |
| 3525 | "{{WRAPPER}} .eael-{$form_type}-form .eael-sign-wrapper" => 'display:flex; flex-direction: {{VALUE}};', |
| 3526 | ], |
| 3527 | ] ); |
| 3528 | |
| 3529 | |
| 3530 | $this->add_responsive_control( "{$form_type}_link_jc", [ |
| 3531 | 'label' => __( 'Justify Content', 'essential-addons-for-elementor-lite' ), |
| 3532 | 'type' => Controls_Manager::SELECT, |
| 3533 | 'options' => [ |
| 3534 | 'flex-start' => __( 'Start', 'essential-addons-for-elementor-lite' ), |
| 3535 | 'flex-end' => __( 'End', 'essential-addons-for-elementor-lite' ), |
| 3536 | 'center' => __( 'Center', 'essential-addons-for-elementor-lite' ), |
| 3537 | 'space-between' => __( 'Space Between', 'essential-addons-for-elementor-lite' ), |
| 3538 | 'space-around' => __( 'Space Around', 'essential-addons-for-elementor-lite' ), |
| 3539 | 'space-evenly' => __( 'Space Evenly', 'essential-addons-for-elementor-lite' ), |
| 3540 | ], |
| 3541 | 'default' => 'center', |
| 3542 | 'condition' => [ |
| 3543 | "{$form_type}_link_d_type" => 'row', |
| 3544 | ], |
| 3545 | 'selectors' => [ |
| 3546 | "{{WRAPPER}} .eael-{$form_type}-form .eael-sign-wrapper" => 'justify-content: {{VALUE}};', |
| 3547 | ], |
| 3548 | ] ); |
| 3549 | |
| 3550 | $this->add_responsive_control( "{$form_type}_link_ai", [ |
| 3551 | 'label' => __( 'Align Items', 'essential-addons-for-elementor-lite' ), |
| 3552 | 'type' => Controls_Manager::SELECT, |
| 3553 | 'options' => [ |
| 3554 | 'flex-start' => __( 'Start', 'essential-addons-for-elementor-lite' ), |
| 3555 | 'flex-end' => __( 'End', 'essential-addons-for-elementor-lite' ), |
| 3556 | 'center' => __( 'Center', 'essential-addons-for-elementor-lite' ), |
| 3557 | 'stretch' => __( 'Stretch', 'essential-addons-for-elementor-lite' ), |
| 3558 | 'baseline' => __( 'Baseline', 'essential-addons-for-elementor-lite' ), |
| 3559 | 'space-evenly' => __( 'Space Evenly', 'essential-addons-for-elementor-lite' ), |
| 3560 | ], |
| 3561 | 'default' => 'center', |
| 3562 | 'condition' => [ |
| 3563 | "{$form_type}_link_d_type" => 'column', |
| 3564 | ], |
| 3565 | 'selectors' => [ |
| 3566 | "{{WRAPPER}} .eael-{$form_type}-form .eael-sign-wrapper" => 'align-items: {{VALUE}};', |
| 3567 | ], |
| 3568 | ] ); |
| 3569 | |
| 3570 | $this->add_responsive_control( "{$form_type}_link_align", [ |
| 3571 | 'label' => __( 'Alignment', 'essential-addons-for-elementor-lite' ), |
| 3572 | 'type' => Controls_Manager::CHOOSE, |
| 3573 | 'options' => [ |
| 3574 | 'mr-auto' => [ |
| 3575 | 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ), |
| 3576 | 'icon' => 'eicon-h-align-left', |
| 3577 | ], |
| 3578 | 'ml-auto mr-auto' => [ |
| 3579 | 'title' => __( 'Center', 'essential-addons-for-elementor-lite' ), |
| 3580 | 'icon' => 'eicon-h-align-center', |
| 3581 | ], |
| 3582 | 'ml-auto' => [ |
| 3583 | 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ), |
| 3584 | 'icon' => 'eicon-h-align-right', |
| 3585 | ], |
| 3586 | ], |
| 3587 | 'default' => '', |
| 3588 | 'condition' => [ |
| 3589 | "{$form_type}_link_d_type" => 'column', |
| 3590 | ], |
| 3591 | ] ); |
| 3592 | |
| 3593 | $this->add_control( "tabs_{$form_type}_link_colors_heading", [ |
| 3594 | 'type' => Controls_Manager::HEADING, |
| 3595 | 'label' => __( 'Colors & Border', 'essential-addons-for-elementor-lite' ), |
| 3596 | 'separator' => 'before', |
| 3597 | ] ); |
| 3598 | |
| 3599 | $this->start_controls_tabs( "tabs_{$form_type}_link_style" ); |
| 3600 | /*----- Link NORMAL state------ */ |
| 3601 | $this->start_controls_tab( "tab_{$form_type}_link_normal", [ |
| 3602 | 'label' => __( 'Normal', 'essential-addons-for-elementor-lite' ), |
| 3603 | ] ); |
| 3604 | $this->add_control( "{$form_type}_link_color", [ |
| 3605 | 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ), |
| 3606 | 'type' => Controls_Manager::COLOR, |
| 3607 | 'selectors' => [ |
| 3608 | "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => 'color: {{VALUE}};', |
| 3609 | ], |
| 3610 | ] ); |
| 3611 | $this->add_group_control( Group_Control_Background::get_type(), [ |
| 3612 | 'name' => "{$form_type}_link_bg_color", |
| 3613 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 3614 | 'types' => [ |
| 3615 | 'classic', |
| 3616 | 'gradient', |
| 3617 | ], |
| 3618 | 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link", |
| 3619 | ] ); |
| 3620 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 3621 | 'name' => "{$form_type}_link_border", |
| 3622 | 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link", |
| 3623 | ] ); |
| 3624 | $this->add_control( "{$form_type}_link_border_radius", [ |
| 3625 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 3626 | 'type' => Controls_Manager::DIMENSIONS, |
| 3627 | 'size_units' => [ |
| 3628 | 'px', |
| 3629 | '%', |
| 3630 | ], |
| 3631 | 'selectors' => [ |
| 3632 | "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => $this->apply_dim( 'border-radius' ), |
| 3633 | ], |
| 3634 | ] ); |
| 3635 | $this->end_controls_tab(); |
| 3636 | |
| 3637 | /*-----Link HOVER state------ */ |
| 3638 | $this->start_controls_tab( "tab_{$form_type}_link_hover", [ |
| 3639 | 'label' => __( 'Hover', 'essential-addons-for-elementor-lite' ), |
| 3640 | ] ); |
| 3641 | $this->add_control( "{$form_type}_link_color_hover", [ |
| 3642 | 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ), |
| 3643 | 'type' => Controls_Manager::COLOR, |
| 3644 | 'selectors' => [ |
| 3645 | "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link:hover" => 'color: {{VALUE}};', |
| 3646 | ], |
| 3647 | ] ); |
| 3648 | $this->add_group_control( Group_Control_Background::get_type(), [ |
| 3649 | 'name' => "{$form_type}_link_bg_color_hover", |
| 3650 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 3651 | 'types' => [ |
| 3652 | 'classic', |
| 3653 | 'gradient', |
| 3654 | ], |
| 3655 | 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link:hover", |
| 3656 | ] ); |
| 3657 | $this->add_group_control( Group_Control_Border::get_type(), [ |
| 3658 | 'name' => "{$form_type}_link_border_hover", |
| 3659 | 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link:hover", |
| 3660 | ] ); |
| 3661 | $this->add_control( "{$form_type}_link_border_radius_hover", [ |
| 3662 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 3663 | 'type' => Controls_Manager::DIMENSIONS, |
| 3664 | 'size_units' => [ |
| 3665 | 'px', |
| 3666 | '%', |
| 3667 | ], |
| 3668 | 'selectors' => [ |
| 3669 | "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link:hover" => $this->apply_dim( 'border-radius' ), |
| 3670 | ], |
| 3671 | ] ); |
| 3672 | $this->end_controls_tab(); |
| 3673 | $this->end_controls_tabs(); |
| 3674 | /*-----ends Link tabs--------*/ |
| 3675 | $this->add_responsive_control( "{$form_type}_link_wrap_width", [ |
| 3676 | 'label' => esc_html__( 'Link Container width', 'essential-addons-for-elementor-lite' ), |
| 3677 | 'type' => Controls_Manager::SLIDER, |
| 3678 | 'size_units' => [ |
| 3679 | 'px', |
| 3680 | '%', |
| 3681 | ], |
| 3682 | 'range' => [ |
| 3683 | 'px' => [ |
| 3684 | 'min' => 0, |
| 3685 | 'max' => 500, |
| 3686 | 'step' => 5, |
| 3687 | ], |
| 3688 | '%' => [ |
| 3689 | 'min' => 0, |
| 3690 | 'max' => 100, |
| 3691 | ], |
| 3692 | ], |
| 3693 | 'selectors' => [ |
| 3694 | "{{WRAPPER}} .eael-{$form_type}-form .eael-sign-wrapper" => 'width: {{SIZE}}{{UNIT}};', |
| 3695 | ], |
| 3696 | 'separator' => 'before', |
| 3697 | ] ); |
| 3698 | $this->add_responsive_control( "{$form_type}_link_width", [ |
| 3699 | 'label' => esc_html__( 'Link width', 'essential-addons-for-elementor-lite' ), |
| 3700 | 'type' => Controls_Manager::SLIDER, |
| 3701 | 'size_units' => [ |
| 3702 | 'px', |
| 3703 | '%', |
| 3704 | ], |
| 3705 | 'range' => [ |
| 3706 | 'px' => [ |
| 3707 | 'min' => 0, |
| 3708 | 'max' => 500, |
| 3709 | 'step' => 5, |
| 3710 | ], |
| 3711 | '%' => [ |
| 3712 | 'min' => 0, |
| 3713 | 'max' => 100, |
| 3714 | ], |
| 3715 | ], |
| 3716 | 'selectors' => [ |
| 3717 | "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => 'width: {{SIZE}}{{UNIT}};', |
| 3718 | ], |
| 3719 | ] ); |
| 3720 | |
| 3721 | $this->add_responsive_control( "{$form_type}_link_height", [ |
| 3722 | 'label' => esc_html__( 'Link Height', 'essential-addons-for-elementor-lite' ), |
| 3723 | 'type' => Controls_Manager::SLIDER, |
| 3724 | 'size_units' => [ |
| 3725 | 'px', |
| 3726 | '%', |
| 3727 | ], |
| 3728 | 'range' => [ |
| 3729 | 'px' => [ |
| 3730 | 'min' => 0, |
| 3731 | 'max' => 500, |
| 3732 | 'step' => 5, |
| 3733 | ], |
| 3734 | '%' => [ |
| 3735 | 'min' => 0, |
| 3736 | 'max' => 100, |
| 3737 | ], |
| 3738 | ], |
| 3739 | 'selectors' => [ |
| 3740 | "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => 'height: {{SIZE}}{{UNIT}};', |
| 3741 | ], |
| 3742 | ] ); |
| 3743 | |
| 3744 | $this->end_controls_section(); |
| 3745 | } |
| 3746 | |
| 3747 | /** |
| 3748 | * Get conditions for displaying login form and registration |
| 3749 | * |
| 3750 | * @param string $type |
| 3751 | * |
| 3752 | * @return array |
| 3753 | */ |
| 3754 | public function get_form_controls_display_condition( $type = 'login' ) { |
| 3755 | $form_type = in_array( $type, [ |
| 3756 | 'login', |
| 3757 | 'register', |
| 3758 | ] ) ? $type : 'login'; |
| 3759 | |
| 3760 | return [ |
| 3761 | 'relation' => 'or', |
| 3762 | 'terms' => [ |
| 3763 | [ |
| 3764 | 'name' => "show_{$form_type}_link", |
| 3765 | 'value' => 'yes', |
| 3766 | ], |
| 3767 | [ |
| 3768 | 'name' => 'default_form_type', |
| 3769 | 'value' => $form_type, |
| 3770 | ], |
| 3771 | ], |
| 3772 | ]; |
| 3773 | } |
| 3774 | |
| 3775 | protected function render() { |
| 3776 | if ( ! is_admin() && 'yes' === $this->get_settings_for_display( 'redirect_for_logged_in_user' ) && is_user_logged_in() ) { |
| 3777 | if ( $redirect = $this->get_settings_for_display( 'redirect_url_for_logged_in_user' )['url'] ) { |
| 3778 | $redirect = wp_sanitize_redirect( $redirect ); |
| 3779 | $logged_in_location = wp_validate_redirect( $redirect, site_url() ); ?> |
| 3780 | <div class="" data-logged-in-location="<?php echo empty( $logged_in_location ) ? '' : esc_url( $logged_in_location ); ?>"></div> |
| 3781 | <?php |
| 3782 | } |
| 3783 | } |
| 3784 | |
| 3785 | //Note. forms are handled in Login_Registration Trait used in the Bootstrap class. |
| 3786 | if ( ! $this->in_editor && 'yes' === $this->get_settings_for_display( 'hide_for_logged_in_user' ) && is_user_logged_in() ) { |
| 3787 | return; // do not show any form for already logged in user. but let edit on editor |
| 3788 | } |
| 3789 | |
| 3790 | $this->ds = $this->get_settings_for_display(); |
| 3791 | $this->default_form = $this->get_settings_for_display( 'default_form_type' ); |
| 3792 | $this->should_print_login_form = ( 'login' === $this->default_form || 'yes' === $this->get_settings_for_display( 'show_login_link' ) ); |
| 3793 | |
| 3794 | $this->should_print_register_form = ( $this->user_can_register && ( 'register' === $this->get_settings_for_display( 'default_form_type' ) || 'yes' === $this->get_settings_for_display( 'show_register_link' ) ) ); |
| 3795 | if ( Plugin::$instance->documents->get_current() ) { |
| 3796 | $this->page_id = Plugin::$instance->documents->get_current()->get_main_id(); |
| 3797 | } |
| 3798 | |
| 3799 | |
| 3800 | //handle form illustration |
| 3801 | $form_image_id = ! empty( $this->ds['lr_form_image']['id'] ) ? $this->ds['lr_form_image']['id'] : ''; |
| 3802 | $this->form_illustration_pos = ! empty( $this->ds['lr_form_image_position'] ) ? $this->ds['lr_form_image_position'] : 'left'; |
| 3803 | $this->form_illustration_url = Group_Control_Image_Size::get_attachment_image_src( $form_image_id, 'lr_form_image', $this->ds ); |
| 3804 | |
| 3805 | $form_logo_id = ! empty( $this->ds['lr_form_logo']['id'] ) ? $this->ds['lr_form_logo']['id'] : ''; |
| 3806 | $this->form_logo = Group_Control_Image_Size::get_attachment_image_src( $form_logo_id, 'lr_form_logo', $this->ds ); |
| 3807 | $this->form_logo_pos = ! empty( $this->ds['lr_form_logo_position'] ) ? $this->ds['lr_form_logo_position'] : 'inline'; |
| 3808 | $login_redirect_url = ''; |
| 3809 | if ( ! empty( $this->ds['redirect_after_login'] ) && 'yes' === $this->ds['redirect_after_login'] ) { |
| 3810 | $login_redirect_url = !empty( $this->ds[ 'redirect_url' ][ 'url' ] ) ? esc_url( $this->ds[ 'redirect_url' ][ 'url' ] ) : ''; |
| 3811 | } |
| 3812 | ?> |
| 3813 | <div class="eael-login-registration-wrapper <?php echo empty( $form_image_id ) ? '' : esc_attr( 'has-illustration' ); ?>" |
| 3814 | data-is-ajax="<?php echo esc_attr( $this->get_settings_for_display( 'enable_ajax' ) ); ?>" |
| 3815 | data-widget-id="<?php echo esc_attr( $this->get_id() ); ?>" |
| 3816 | data-recaptcha-sitekey="<?php echo esc_attr( get_option( 'eael_recaptcha_sitekey' ) ); ?>" |
| 3817 | data-redirect-to="<?php echo esc_attr( $login_redirect_url ); ?>" |
| 3818 | > |
| 3819 | <?php |
| 3820 | $this->print_login_form(); |
| 3821 | $this->print_register_form(); |
| 3822 | ?> |
| 3823 | </div> |
| 3824 | |
| 3825 | <?php |
| 3826 | } |
| 3827 | |
| 3828 | protected function print_login_form() { |
| 3829 | if ( $this->should_print_login_form ) { |
| 3830 | // prepare all login form related vars |
| 3831 | $default_hide_class = 'register' === $this->default_form || isset($_GET['eael-register']) ? 'eael-lr-d-none' : ''; |
| 3832 | |
| 3833 | //Reg link related |
| 3834 | $reg_link_action = ! empty( $this->ds['registration_link_action'] ) ? $this->ds['registration_link_action'] : 'form'; |
| 3835 | $show_reg_link = ( $this->user_can_register && 'yes' === $this->get_settings( 'show_register_link' ) ); |
| 3836 | $reg_link_text = ! empty( $this->get_settings( 'registration_link_text' ) ) ? HelperCLass::eael_wp_kses($this->get_settings( 'registration_link_text' )) : __( 'Register', 'essential-addons-for-elementor-lite' ); |
| 3837 | $parts = explode( "\n", $reg_link_text ); |
| 3838 | $reg_link_text = array_pop( $parts ); |
| 3839 | $reg_message = array_shift( $parts ); |
| 3840 | |
| 3841 | $reg_link_placeholder = '<span class="d-ib">%1$s</span> <a href="%2$s" id="eael-lr-reg-toggle" class="eael-lr-link" data-action="%3$s" %5$s>%4$s</a>'; |
| 3842 | $reg_atts = $reg_url = ''; |
| 3843 | switch ( $reg_link_action ) { |
| 3844 | case 'custom': |
| 3845 | $reg_url = ! empty( $this->ds['custom_register_url']['url'] ) ? $this->ds['custom_register_url']['url'] : ''; |
| 3846 | $reg_atts = ! empty( $this->ds['custom_register_url']['is_external'] ) ? ' target="_blank"' : ''; |
| 3847 | $reg_atts .= ! empty( $this->ds['custom_register_url']['nofollow'] ) ? ' rel="nofollow"' : ''; |
| 3848 | break; |
| 3849 | case 'default': |
| 3850 | $reg_url = wp_registration_url(); |
| 3851 | break; |
| 3852 | } |
| 3853 | |
| 3854 | $reg_link = sprintf( $reg_link_placeholder, $reg_message, esc_attr( $reg_url ), esc_attr( $reg_link_action ), $reg_link_text, $reg_atts ); |
| 3855 | |
| 3856 | |
| 3857 | // login form fields related |
| 3858 | $label_type = ! empty( $this->ds['login_label_types'] ) ? $this->ds['login_label_types'] : 'default'; |
| 3859 | $is_custom_label = ( 'custom' === $label_type ); |
| 3860 | $display_label = ( 'none' !== $label_type ); |
| 3861 | |
| 3862 | //Default label n placeholder |
| 3863 | $u_label = $u_ph = __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ); |
| 3864 | $p_label = $p_ph = __( 'Password', 'essential-addons-for-elementor-lite' ); |
| 3865 | // custom label n placeholder |
| 3866 | if ( $is_custom_label ) { |
| 3867 | $u_label = isset( $this->ds['login_user_label'] ) ? $this->ds['login_user_label'] : ''; |
| 3868 | $p_label = isset( $this->ds['login_password_label'] ) ? $this->ds['login_password_label'] : ''; |
| 3869 | $u_ph = isset( $this->ds['login_user_placeholder'] ) ? $this->ds['login_user_placeholder'] : ''; |
| 3870 | $p_ph = isset( $this->ds['login_password_placeholder'] ) ? $this->ds['login_password_placeholder'] : ''; |
| 3871 | } |
| 3872 | |
| 3873 | |
| 3874 | $btn_text = ! empty( $this->ds['login_button_text'] ) ? $this->ds['login_button_text'] : ''; |
| 3875 | $show_logout_link = ( ! empty( $this->ds['show_log_out_message'] ) && 'yes' === $this->ds['show_log_out_message'] ); |
| 3876 | $show_rememberme = ( ! empty( $this->ds['login_show_remember_me'] ) && 'yes' === $this->ds['login_show_remember_me'] ); |
| 3877 | $remember_text = isset( $this->ds['remember_text'] ) ? $this->ds['remember_text'] : esc_html__( 'Remember Me', 'essential-addons-for-elementor-lite'); |
| 3878 | $rm_type = ! empty( $this->ds['remember_me_style'] ) ? $this->ds['remember_me_style'] : ''; |
| 3879 | $show_pv_icon = ( ! empty( $this->ds['password_toggle'] ) && 'yes' === $this->ds['password_toggle'] ); |
| 3880 | |
| 3881 | //Loss password |
| 3882 | $show_lp = ( ! empty( $this->ds['show_lost_password'] ) && 'yes' === $this->ds['show_lost_password'] ); |
| 3883 | $lp_text = ! empty( $this->ds['lost_password_text'] ) ? HelperCLass::eael_wp_kses($this->ds['lost_password_text']) : __( 'Forgot password?', 'essential-addons-for-elementor-lite' ); |
| 3884 | $lp_link = sprintf( '<a href="%s">%s</a>', esc_attr( wp_lostpassword_url() ), $lp_text ); |
| 3885 | if ( ! empty( $this->ds['lost_password_link_type'] ) && 'custom' === $this->ds['lost_password_link_type'] ) { |
| 3886 | $lp_url = ! empty( $this->ds['lost_password_url']['url'] ) ? $this->ds['lost_password_url']['url'] : wp_lostpassword_url(); |
| 3887 | $lp_atts = ! empty( $this->ds['lost_password_url']['is_external'] ) ? ' target="_blank"' : ''; |
| 3888 | $lp_atts .= ! empty( $this->ds['lost_password_url']['nofollow'] ) ? ' rel="nofollow"' : ''; |
| 3889 | $lp_link = sprintf( '<a href="%s" %s >%s</a>', esc_attr( $lp_url ), $lp_atts, $lp_text ); |
| 3890 | } |
| 3891 | |
| 3892 | // btn alignment |
| 3893 | $btn_align = isset( $this->ds['login_btn_align'] ) ? $this->ds['login_btn_align'] : ''; |
| 3894 | // btn alignment |
| 3895 | $link_align = isset( $this->ds['login_link_align'] ) ? $this->ds['login_link_align'] : ''; |
| 3896 | // reCAPTCHA style |
| 3897 | $rc_theme = isset( $this->ds['login_rc_theme'] ) ? $this->ds['login_rc_theme'] : 'light'; |
| 3898 | $rc_size = isset( $this->ds['login_rc_size'] ) ? $this->ds['login_rc_size'] : 'normal'; |
| 3899 | // input icons |
| 3900 | $show_icon = ( $this->pro_enabled && ! empty( $this->ds['show_login_icon'] ) && 'yes' === $this->ds['show_login_icon'] ); |
| 3901 | $icon_class = $show_icon ? 'lr-icon-showing' : ''; |
| 3902 | ?> |
| 3903 | <section |
| 3904 | id="eael-login-form-wrapper" |
| 3905 | class="<?php echo esc_attr( $default_hide_class ); ?>" |
| 3906 | data-recaptcha-theme="<?php echo esc_attr( $rc_theme ); ?>" |
| 3907 | data-recaptcha-size="<?php echo esc_attr( $rc_size ); ?>"> |
| 3908 | <div class="eael-login-form-wrapper eael-lr-form-wrapper style-2 <?php echo esc_attr( $icon_class ); ?>"> |
| 3909 | <?php |
| 3910 | if ( $show_logout_link && is_user_logged_in() && ! $this->in_editor ) { |
| 3911 | /* translators: %s user display name */ |
| 3912 | $logged_in_msg = sprintf( __( 'You are already logged in as %s. ', 'essential-addons-for-elementor-lite' ), wp_get_current_user()->display_name ); |
| 3913 | printf( '%1$s (<a href="%2$s">%3$s</a>)', $logged_in_msg, esc_url( wp_logout_url() ), __( 'Logout', 'essential-addons-for-elementor-lite' ) ); |
| 3914 | } else { |
| 3915 | if ( 'left' === $this->form_illustration_pos ) { |
| 3916 | $this->print_form_illustration(); |
| 3917 | } |
| 3918 | ?> |
| 3919 | <div class="lr-form-wrapper"> |
| 3920 | <?php $this->print_form_header( 'login' ); ?> |
| 3921 | <?php do_action( 'eael/login-register/before-login-form', $this ); ?> |
| 3922 | <form class="eael-login-form eael-lr-form" |
| 3923 | id="eael-login-form" |
| 3924 | method="post"> |
| 3925 | <?php do_action( 'eael/login-register/after-login-form-open', $this ); ?> |
| 3926 | <div class="eael-lr-form-group"> |
| 3927 | <?php if ( $display_label && $u_label ) { |
| 3928 | printf( '<label for="eael-user-login" class="eael-field-label">%s</label>', $u_label ); |
| 3929 | } ?> |
| 3930 | <input type="text" |
| 3931 | name="eael-user-login" |
| 3932 | id="eael-user-login" |
| 3933 | class="eael-lr-form-control" |
| 3934 | aria-describedby="emailHelp" |
| 3935 | placeholder="<?php if ( $display_label && $u_ph ) { |
| 3936 | echo esc_attr( $u_ph ); |
| 3937 | } ?>" |
| 3938 | required> |
| 3939 | <?php |
| 3940 | if ( $show_icon ) { |
| 3941 | echo '<i class="fas fa-user"></i>'; |
| 3942 | } ?> |
| 3943 | </div> |
| 3944 | <div class="eael-lr-form-group"> |
| 3945 | <?php if ( $display_label && $p_label ) { |
| 3946 | printf( '<label for="eael-user-password" class="eael-field-label">%s</label>', $p_label ); |
| 3947 | } ?> |
| 3948 | <div class="eael-lr-password-wrapper"> |
| 3949 | <input type="password" |
| 3950 | name="eael-user-password" |
| 3951 | class="eael-lr-form-control" |
| 3952 | id="eael-user-password" |
| 3953 | placeholder="<?php if ( $display_label && $p_ph ) { |
| 3954 | echo esc_attr( $p_ph ); |
| 3955 | } ?>" |
| 3956 | required> |
| 3957 | <?php if ( $show_pv_icon ) { ?> |
| 3958 | <button type="button" |
| 3959 | id="wp-hide-pw" |
| 3960 | class="wp-hide-pw hide-if-no-js" |
| 3961 | aria-label="Show password"> |
| 3962 | <span class="dashicons dashicons-visibility" |
| 3963 | aria-hidden="true"></span> |
| 3964 | </button> |
| 3965 | <?php } ?> |
| 3966 | <?php |
| 3967 | if ( $show_icon ) { |
| 3968 | echo '<i class="fas fa-lock"></i>'; |
| 3969 | } ?> |
| 3970 | </div> |
| 3971 | </div> |
| 3972 | <div class="eael-forever-forget eael-lr-form-group"> |
| 3973 | <?php if ( $show_rememberme && !empty( $remember_text )) { ?> |
| 3974 | <p class="forget-menot"> |
| 3975 | <input name="eael-rememberme" |
| 3976 | type="checkbox" |
| 3977 | id="rememberme" |
| 3978 | class="remember-me <?php echo esc_attr( $rm_type ); ?>" |
| 3979 | value="forever"> |
| 3980 | <label for="rememberme" |
| 3981 | class="eael-checkbox-label rememberme"><?php echo esc_html( $remember_text ); ?></label> |
| 3982 | </p> |
| 3983 | <?php } |
| 3984 | if ( $show_lp ) { |
| 3985 | echo '<p class="forget-pass">' . $lp_link . '</p>';//XSS ok. already escaped |
| 3986 | } ?> |
| 3987 | |
| 3988 | </div> |
| 3989 | |
| 3990 | <?php |
| 3991 | do_action( 'eael/login-register/before-recaptcha', $this ); |
| 3992 | $this->print_recaptcha_node( 'login' ); |
| 3993 | do_action( 'eael/login-register/after-recaptcha', $this ); |
| 3994 | do_action( 'eael/login-register/before-login-footer', $this ); |
| 3995 | ?> |
| 3996 | |
| 3997 | |
| 3998 | <div class="eael-lr-footer"> |
| 3999 | <input type="submit" |
| 4000 | name="eael-login-submit" |
| 4001 | id="eael-login-submit" |
| 4002 | class="g-recaptcha eael-lr-btn eael-lr-btn-block <?php echo esc_attr( $btn_align ); ?>" |
| 4003 | value="<?php echo esc_attr( $btn_text ); ?>"/> |
| 4004 | <?php if ( $show_reg_link ) { ?> |
| 4005 | <div class="eael-sign-wrapper <?php echo esc_attr( $link_align ); ?>"> |
| 4006 | <?php echo $reg_link; // XSS ok. already escaped ?> |
| 4007 | </div> |
| 4008 | <?php } ?> |
| 4009 | |
| 4010 | </div> |
| 4011 | <?php do_action( 'eael/login-register/after-login-footer', $this ); |
| 4012 | ?> |
| 4013 | <div class="eael-form-validation-container"> |
| 4014 | <?php $this->print_login_validation_errors(); ?> |
| 4015 | </div> |
| 4016 | <?php |
| 4017 | $this->print_necessary_hidden_fields( 'login' ); |
| 4018 | |
| 4019 | $this->print_login_validation_errors(); |
| 4020 | |
| 4021 | do_action( 'eael/login-register/before-login-form-close', $this ); |
| 4022 | ?> |
| 4023 | </form> |
| 4024 | <?php do_action( 'eael/login-register/after-login-form', $this ); ?> |
| 4025 | </div> |
| 4026 | <?php |
| 4027 | if ( 'right' === $this->form_illustration_pos ) { |
| 4028 | $this->print_form_illustration(); |
| 4029 | } |
| 4030 | } |
| 4031 | ?> |
| 4032 | </div> |
| 4033 | |
| 4034 | </section> |
| 4035 | <?php |
| 4036 | } |
| 4037 | } |
| 4038 | |
| 4039 | protected function print_register_form() { |
| 4040 | if ( $this->should_print_register_form ) { |
| 4041 | $default_hide_class = 'login' === $this->default_form && !isset($_GET['eael-register']) ? 'eael-lr-d-none' : ''; //eael-register flag for show error/success message when formal form submit |
| 4042 | $is_pass_valid = false; // Does the form has a password field? |
| 4043 | $is_pass_confirmed = false; |
| 4044 | // placeholders to flag if user use one type of field more than once. |
| 4045 | $email_exists = 0; |
| 4046 | $user_name_exists = 0; |
| 4047 | $password_exists = 0; |
| 4048 | $confirm_pass_exists = 0; |
| 4049 | $first_name_exists = 0; |
| 4050 | $last_name_exists = 0; |
| 4051 | $website_exists = 0; |
| 4052 | $f_labels = [ |
| 4053 | 'email' => __( 'Email', 'essential-addons-for-elementor-lite' ), |
| 4054 | 'password' => __( 'Password', 'essential-addons-for-elementor-lite' ), |
| 4055 | 'confirm_password' => __( 'Confirm Password', 'essential-addons-for-elementor-lite' ), |
| 4056 | 'user_name' => __( 'Username', 'essential-addons-for-elementor-lite' ), |
| 4057 | 'first_name' => __( 'First Name', 'essential-addons-for-elementor-lite' ), |
| 4058 | 'last_name' => __( 'Last Name', 'essential-addons-for-elementor-lite' ), |
| 4059 | 'website' => __( 'Website', 'essential-addons-for-elementor-lite' ), |
| 4060 | ]; |
| 4061 | $repeated_f_labels = []; |
| 4062 | |
| 4063 | |
| 4064 | //Login link related |
| 4065 | $lgn_link_action = ! empty( $this->ds['login_link_action'] ) ? $this->ds['login_link_action'] : 'form'; |
| 4066 | $show_lgn_link = 'yes' === $this->get_settings( 'show_login_link' ); |
| 4067 | $lgn_link_text = ! empty( $this->get_settings( 'login_link_text' ) ) ? HelperCLass::eael_wp_kses($this->get_settings( 'login_link_text' )) : __( 'Login', 'essential-addons-for-elementor-lite' ); |
| 4068 | $btn_text = ! empty( $this->ds['reg_button_text'] ) ? $this->ds['reg_button_text'] : ''; |
| 4069 | |
| 4070 | $parts = explode( "\n", $lgn_link_text ); |
| 4071 | $lgn_link_text = array_pop( $parts ); |
| 4072 | $lgn_message = array_shift( $parts ); |
| 4073 | $lgn_link_placeholder = '<span class="d-ib">%1$s</span> <a href="%2$s" id="eael-lr-login-toggle" class="eael-lr-link" data-action="%3$s" %5$s>%4$s</a>'; |
| 4074 | $lgn_url = $lgn_atts = ''; |
| 4075 | |
| 4076 | switch ( $lgn_link_action ) { |
| 4077 | case 'custom': |
| 4078 | $lgn_url = ! empty( $this->ds['custom_login_url']['url'] ) ? $this->ds['custom_login_url']['url'] : ''; |
| 4079 | $lgn_atts = ! empty( $this->ds['custom_login_url']['is_external'] ) ? ' target="_blank"' : ''; |
| 4080 | $lgn_atts .= ! empty( $this->ds['custom_login_url']['nofollow'] ) ? ' rel="nofollow"' : ''; |
| 4081 | break; |
| 4082 | case 'default': |
| 4083 | $lgn_url = wp_login_url(); |
| 4084 | break; |
| 4085 | } |
| 4086 | $lgn_link = sprintf( $lgn_link_placeholder, $lgn_message, esc_attr( $lgn_url ), esc_attr( $lgn_link_action ), $lgn_link_text, $lgn_atts ); |
| 4087 | |
| 4088 | // btn alignment |
| 4089 | $btn_align = isset( $this->ds['register_btn_align'] ) ? $this->ds['register_btn_align'] : ''; |
| 4090 | $link_align = isset( $this->ds['register_link_align'] ) ? $this->ds['register_link_align'] : ''; |
| 4091 | // reCAPTCHA style |
| 4092 | $rc_theme = isset( $this->ds['register_rc_theme'] ) ? $this->ds['register_rc_theme'] : 'light'; |
| 4093 | $rc_size = isset( $this->ds['register_rc_size'] ) ? $this->ds['register_rc_size'] : 'normal'; |
| 4094 | // input icons |
| 4095 | $show_icon = ( $this->pro_enabled && ! empty( $this->ds['show_register_icon'] ) && 'yes' === $this->ds['show_register_icon'] ); |
| 4096 | $icon_class = $show_icon ? 'lr-icon-showing' : ''; |
| 4097 | ob_start(); |
| 4098 | ?> |
| 4099 | <section |
| 4100 | id="eael-register-form-wrapper" |
| 4101 | class="<?php echo esc_attr( $default_hide_class ); ?>" |
| 4102 | data-recaptcha-theme="<?php echo esc_attr( $rc_theme ); ?>" |
| 4103 | data-recaptcha-size="<?php echo esc_attr( $rc_size ); ?>"> |
| 4104 | <div class="eael-register-form-wrapper eael-lr-form-wrapper style-2 <?php echo esc_attr( $icon_class ); ?>"> |
| 4105 | <?php if ( 'left' === $this->form_illustration_pos ) { |
| 4106 | $this->print_form_illustration(); |
| 4107 | } ?> |
| 4108 | <div class="lr-form-wrapper"> |
| 4109 | <?php |
| 4110 | $this->print_form_header( 'register' ); |
| 4111 | do_action( 'eael/login-register/before-register-form', $this ); |
| 4112 | ?> |
| 4113 | <form class="eael-register-form eael-lr-form" |
| 4114 | id="eael-register-form" |
| 4115 | method="post"> |
| 4116 | <?php do_action( 'eael/login-register/after-register-form-open', $this ); ?> |
| 4117 | <?php // Print all dynamic fields |
| 4118 | foreach ( $this->ds['register_fields'] as $f_index => $field ) : |
| 4119 | $field_type = $field['field_type']; |
| 4120 | $dynamic_field_name = "{$field_type}_exists"; |
| 4121 | $$dynamic_field_name ++; //NOTE, double $$ intentional. Dynamically update the var check eg. $username_exists++ to prevent user from using the same field twice |
| 4122 | // is same field repeated? |
| 4123 | if ( $$dynamic_field_name > 1 ) { |
| 4124 | $repeated_f_labels[] = $f_labels[ $field_type ]; |
| 4125 | } |
| 4126 | if ( 'password' === $field_type ) { |
| 4127 | $is_pass_valid = true; |
| 4128 | } |
| 4129 | |
| 4130 | $current_field_required = ( ! empty( $field['required'] ) || in_array( $field_type, [ |
| 4131 | 'password', |
| 4132 | 'confirm_pass', |
| 4133 | 'email', |
| 4134 | ] ) ); |
| 4135 | |
| 4136 | //keys for attribute binding |
| 4137 | $input_key = "input{$f_index}"; |
| 4138 | $label_key = "label{$f_index}"; |
| 4139 | $field_group_key = "field-group{$f_index}"; |
| 4140 | |
| 4141 | // determine proper input tag type |
| 4142 | switch ( $field_type ) { |
| 4143 | case 'user_name': |
| 4144 | case 'first_name': |
| 4145 | case 'last_name': |
| 4146 | $field_input_type = 'text'; |
| 4147 | break; |
| 4148 | case 'confirm_pass': |
| 4149 | $field_input_type = 'password'; |
| 4150 | break; |
| 4151 | case 'website': |
| 4152 | $field_input_type = 'url'; |
| 4153 | break; |
| 4154 | default: |
| 4155 | $field_input_type = $field_type; |
| 4156 | } |
| 4157 | |
| 4158 | $this->add_render_attribute( [ |
| 4159 | $input_key => [ |
| 4160 | 'name' => $field_type, |
| 4161 | 'type' => $field_input_type, |
| 4162 | 'placeholder' => $field['placeholder'], |
| 4163 | 'class' => [ |
| 4164 | 'eael-lr-form-control', |
| 4165 | 'form-field-' . $field_type, |
| 4166 | ], |
| 4167 | 'id' => 'form-field-' . $field_type, |
| 4168 | ], |
| 4169 | $label_key => [ |
| 4170 | 'for' => 'form-field-' . $field_type, |
| 4171 | 'class' => 'eael-field-label', |
| 4172 | ], |
| 4173 | ] ); |
| 4174 | |
| 4175 | // print require field attributes |
| 4176 | if ( $current_field_required ) { |
| 4177 | $this->add_render_attribute( $input_key, [ |
| 4178 | 'required' => 'required', |
| 4179 | 'aria-required' => 'true', |
| 4180 | ] ); |
| 4181 | if ( 'yes' === $this->ds['mark_required'] ) { |
| 4182 | $this->add_render_attribute( $label_key, [ |
| 4183 | 'class' => 'mark-required', |
| 4184 | ] ); |
| 4185 | } |
| 4186 | |
| 4187 | } |
| 4188 | |
| 4189 | |
| 4190 | // add css classes to the main input field wrapper. |
| 4191 | $this->add_render_attribute( [ |
| 4192 | $field_group_key => [ |
| 4193 | 'class' => [ |
| 4194 | 'eael-lr-form-group', |
| 4195 | 'eael-field-type-' . $field_type, |
| 4196 | 'eael-w-' . $field['width'], |
| 4197 | ], |
| 4198 | ], |
| 4199 | ] ); |
| 4200 | |
| 4201 | if ( ! empty( $field['width_tablet'] ) ) { |
| 4202 | $this->add_render_attribute( $field_group_key, 'class', 'elementor-md-' . $field['width_tablet'] ); |
| 4203 | } |
| 4204 | |
| 4205 | if ( ! empty( $field['width_mobile'] ) ) { |
| 4206 | $this->add_render_attribute( $field_group_key, 'class', 'elementor-sm-' . $field['width_mobile'] ); |
| 4207 | } |
| 4208 | |
| 4209 | ?> |
| 4210 | <div <?php $this->print_render_attribute_string( $field_group_key ) ?>> |
| 4211 | <?php |
| 4212 | if ( 'yes' === $this->ds['show_labels'] && ! empty( $field['field_label'] ) ) { |
| 4213 | echo '<label ' . $this->get_render_attribute_string( $label_key ) . '>' . esc_attr( $field['field_label'] ) . '</label>'; |
| 4214 | } |
| 4215 | echo '<input ' . $this->get_render_attribute_string( $input_key ) . '>'; |
| 4216 | if ( $show_icon && ! empty( $field['icon'] ) ) { |
| 4217 | Icons_Manager::render_icon( $field['icon'], [ 'aria-hidden' => 'true' ] ); |
| 4218 | } |
| 4219 | ?> |
| 4220 | </div> |
| 4221 | |
| 4222 | <?php |
| 4223 | if ( 'password' === $field['field_type'] ) { |
| 4224 | do_action( 'eael/login-register/after-password-field', $this ); |
| 4225 | } |
| 4226 | endforeach; |
| 4227 | $this->print_necessary_hidden_fields( 'register' ); |
| 4228 | $this->print_terms_condition_notice(); |
| 4229 | $this->print_recaptcha_node( 'register' ); |
| 4230 | ?> |
| 4231 | |
| 4232 | <div class="eael-lr-footer"> |
| 4233 | <input type="submit" |
| 4234 | name="eael-register-submit" |
| 4235 | id="eael-register-submit" |
| 4236 | class="eael-lr-btn eael-lr-btn-block<?php echo esc_attr( $btn_align ); ?>" |
| 4237 | value="<?php echo esc_attr( $btn_text ); ?>"/> |
| 4238 | <?php if ( $show_lgn_link ) { ?> |
| 4239 | <div class="eael-sign-wrapper <?php echo esc_attr( $link_align ); ?>"> |
| 4240 | <?php echo $lgn_link; ?> |
| 4241 | </div> |
| 4242 | <?php } ?> |
| 4243 | </div> |
| 4244 | |
| 4245 | <?php do_action( 'eael/login-register/after-register-footer', $this ); ?> |
| 4246 | |
| 4247 | <div class="eael-form-validation-container"> |
| 4248 | <?php $this->print_validation_message(); ?> |
| 4249 | </div> |
| 4250 | <?php |
| 4251 | |
| 4252 | do_action( 'eael/login-register/before-register-form-close', $this ); |
| 4253 | ?> |
| 4254 | </form> |
| 4255 | <?php do_action( 'eael/login-register/after-register-form', $this ); ?> |
| 4256 | </div> |
| 4257 | <?php if ( 'right' === $this->form_illustration_pos ) { |
| 4258 | $this->print_form_illustration(); |
| 4259 | } ?> |
| 4260 | </div> |
| 4261 | </section> |
| 4262 | <?php |
| 4263 | $form_markup = apply_filters( 'eael/login-register/register-form-markup', ob_get_clean() ); |
| 4264 | // if we are in the editor then show error related to different input field. |
| 4265 | if ( $this->in_editor ) { |
| 4266 | $repeated = $this->print_error_for_repeated_fields( $repeated_f_labels ); |
| 4267 | $email_field_missing = $this->print_error_for_missing_email_field( $email_exists ); |
| 4268 | $pass_missing = $this->print_error_for_missing_password_field( $password_exists, $confirm_pass_exists ); |
| 4269 | if ( $repeated || $email_field_missing || $pass_missing ) { |
| 4270 | return false; // error found, exit, dont show form. |
| 4271 | } |
| 4272 | echo $form_markup; //XSS OK, data sanitized already. |
| 4273 | } else { |
| 4274 | echo $form_markup; //XSS OK, data sanitized already. |
| 4275 | } |
| 4276 | } |
| 4277 | } |
| 4278 | |
| 4279 | protected function print_form_illustration() { |
| 4280 | if ( ! empty( $this->form_illustration_url ) ) { ?> |
| 4281 | <div class="lr-form-illustration lr-img-pos-<?php echo esc_attr( $this->form_illustration_pos ); ?>" |
| 4282 | style="background-image: url('<?php echo esc_attr( esc_url( $this->form_illustration_url ) ); ?>');"></div> |
| 4283 | <?php } |
| 4284 | } |
| 4285 | |
| 4286 | /** |
| 4287 | * @param string $form_type the type of form. Available values: login and register |
| 4288 | */ |
| 4289 | protected function print_form_header( $form_type = 'login' ) { |
| 4290 | $title = ! empty( $this->ds["{$form_type}_form_title"] ) ? $this->ds["{$form_type}_form_title"] : ''; |
| 4291 | $subtitle = ! empty( $this->ds["{$form_type}_form_subtitle"] ) ? esc_html( $this->ds["{$form_type}_form_subtitle"] ) : ''; |
| 4292 | if ( empty( $this->form_logo ) && empty( $title ) && empty( $subtitle ) ) { |
| 4293 | return; |
| 4294 | } |
| 4295 | |
| 4296 | ?> |
| 4297 | <div class="lr-form-header header-<?php echo esc_attr( $this->form_logo_pos ); ?>"> |
| 4298 | <?php if ( ! empty( $this->form_logo ) ) { ?> |
| 4299 | <div class="form-logo"> |
| 4300 | <img src="<?php echo esc_attr( esc_url( $this->form_logo ) ); ?>" |
| 4301 | alt="<?php esc_attr_e( 'Form Logo Image', 'essential-addons-for-elementor-lite' ); ?>"> |
| 4302 | </div> |
| 4303 | <?php } ?> |
| 4304 | |
| 4305 | <?php if ( ! empty( $title ) || ! empty( $subtitle ) ) { ?> |
| 4306 | <div class="form-dsc"> |
| 4307 | <?php |
| 4308 | if ( ! empty( $title ) ) { |
| 4309 | echo "<h4>{$title}</h4>"; // data escaped already. |
| 4310 | } |
| 4311 | |
| 4312 | if ( ! empty( $subtitle ) ) { |
| 4313 | echo "<p>{$subtitle}</p>"; // data escaped already. |
| 4314 | } ?> |
| 4315 | </div> |
| 4316 | <?php } ?> |
| 4317 | </div> |
| 4318 | <?php |
| 4319 | } |
| 4320 | |
| 4321 | protected function print_necessary_hidden_fields( $form_type = 'login' ) { |
| 4322 | if ( 'login' === $form_type ) { |
| 4323 | if ( ! empty( $this->ds['redirect_after_login'] ) && 'yes' === $this->ds['redirect_after_login'] ) { |
| 4324 | $login_redirect_url = ! empty( $this->ds['redirect_url']['url'] ) ? esc_url( $this->ds['redirect_url']['url'] ) : ''; |
| 4325 | ?> |
| 4326 | <input type="hidden" |
| 4327 | name="redirect_to" |
| 4328 | value="<?php echo esc_attr( $login_redirect_url ); ?>"> |
| 4329 | <?php } |
| 4330 | } |
| 4331 | // add login security nonce |
| 4332 | wp_nonce_field( "eael-{$form_type}-action", "eael-{$form_type}-nonce" ); |
| 4333 | ?> |
| 4334 | <input type="hidden" |
| 4335 | name="page_id" |
| 4336 | value="<?php echo esc_attr( $this->page_id ); ?>"> |
| 4337 | <input type="hidden" |
| 4338 | name="widget_id" |
| 4339 | value="<?php echo esc_attr( $this->get_id() ); ?>"> |
| 4340 | <?php |
| 4341 | } |
| 4342 | |
| 4343 | protected function print_terms_condition_notice() { |
| 4344 | if ( empty( $this->ds['show_terms_conditions'] ) || 'yes' !== $this->ds['show_terms_conditions'] ) { |
| 4345 | return; |
| 4346 | } |
| 4347 | $l = isset( $this->ds['acceptance_label'] ) ? HelperCLass::eael_wp_kses($this->ds['acceptance_label']) : ''; |
| 4348 | $parts = explode( "\n", $l ); |
| 4349 | $label = array_shift( $parts ); |
| 4350 | $link_text = array_pop( $parts ); |
| 4351 | $source = isset( $this->ds['acceptance_text_source'] ) ? $this->ds['acceptance_text_source'] : 'editor'; |
| 4352 | $tc_text = isset( $this->ds['acceptance_text'] ) ? $this->ds['acceptance_text'] : ''; |
| 4353 | $tc_link = '<a href="#" id="eael-lr-tnc-link" class="eael-lr-tnc-link">' . esc_html( $link_text ) . '</a>'; |
| 4354 | if ( 'custom' === $source ) { |
| 4355 | $tc_url = ! empty( $this->ds['acceptance_text_url']['url'] ) ? esc_url( $this->ds['acceptance_text_url']['url'] ) : esc_url( get_the_permalink( get_option( 'wp_page_for_privacy_policy' ) ) ); |
| 4356 | $tc_atts = ! empty( $this->ds['acceptance_text_url']['is_external'] ) ? ' target="_blank"' : ''; |
| 4357 | $tc_atts .= ! empty( $this->ds['acceptance_text_url']['nofollow'] ) ? ' rel="nofollow"' : ''; |
| 4358 | $tc_link = sprintf( '<a href="%1$s" id="eael-lr-tnc-link" class="eael-lr-tnc-link" %2$s>%3$s</a>', esc_attr( $tc_url ), $tc_atts, $link_text ); |
| 4359 | } |
| 4360 | |
| 4361 | ?> |
| 4362 | <div class="eael_accept_tnc_wrap"> |
| 4363 | <input type="hidden" |
| 4364 | name="eael_tnc_active" |
| 4365 | value="1"> |
| 4366 | <input type="checkbox" |
| 4367 | name="eael_accept_tnc" |
| 4368 | class="eael_accept_tnc lr-toggle" |
| 4369 | value="1" |
| 4370 | id="eael_accept_tnc"> |
| 4371 | <label for="eael_accept_tnc" |
| 4372 | class="eael-checkbox-label check-accept"> |
| 4373 | <?php |
| 4374 | echo esc_html( $label ); |
| 4375 | ?> |
| 4376 | </label> |
| 4377 | <?php |
| 4378 | echo $tc_link; // XSS ok. already sanitized. |
| 4379 | ?> |
| 4380 | </div> |
| 4381 | |
| 4382 | <?php |
| 4383 | $tc = '<div class="eael-lr-tnc-wrap">'; |
| 4384 | $tc .= $this->parse_text_editor( $tc_text ); |
| 4385 | $tc .= '</div>'; |
| 4386 | echo $tc; |
| 4387 | |
| 4388 | |
| 4389 | } |
| 4390 | |
| 4391 | protected function print_login_validation_errors() { |
| 4392 | $error_key = 'eael_login_error_' . $this->get_id(); |
| 4393 | if ( $login_error = apply_filters( 'eael/login-register/login-error-message', get_option( $error_key ) ) ) { |
| 4394 | do_action( 'eael/login-register/before-showing-login-error', $login_error, $this ); |
| 4395 | ?> |
| 4396 | <p class="eael-form-msg invalid"> |
| 4397 | <?php echo esc_html( $login_error ); ?> |
| 4398 | </p> |
| 4399 | <?php |
| 4400 | do_action( 'eael/login-register/after-showing-login-error', $login_error, $this ); |
| 4401 | |
| 4402 | delete_option( $error_key ); |
| 4403 | } |
| 4404 | } |
| 4405 | |
| 4406 | protected function print_recaptcha_node( $form_type = 'login' ) { |
| 4407 | if ( 'yes' === $this->get_settings_for_display( "enable_{$form_type}_recaptcha" ) ) { |
| 4408 | $id = "{$form_type}-recaptcha-node-" . $this->get_id(); |
| 4409 | echo "<input type='hidden' name='g-recaptcha-enabled' value='1'/><div id='{$id}' class='eael-recaptcha-wrapper'></div>"; |
| 4410 | } |
| 4411 | } |
| 4412 | |
| 4413 | protected function print_error_for_repeated_fields( $repeated_fields ) { |
| 4414 | if ( ! empty( $repeated_fields ) ) { |
| 4415 | $error_fields = '<strong>' . implode( "</strong>, <strong>", $repeated_fields ) . '</strong>'; |
| 4416 | ?> |
| 4417 | <p class='eael-register-form-error elementor-alert elementor-alert-warning'> |
| 4418 | <?php |
| 4419 | /* translators: %s: Error fields */ |
| 4420 | printf( __( 'Error! you seem to have added %s field in the form more than once.', 'essential-addons-for-elementor-lite' ), $error_fields ); |
| 4421 | ?> |
| 4422 | </p> |
| 4423 | <?php |
| 4424 | return true; |
| 4425 | } |
| 4426 | |
| 4427 | return false; |
| 4428 | } |
| 4429 | |
| 4430 | protected function print_error_for_missing_email_field( $email_exist ) { |
| 4431 | if ( empty( $email_exist ) ) { |
| 4432 | ?> |
| 4433 | <p class='eael-register-form-error elementor-alert elementor-alert-warning'> |
| 4434 | <?php |
| 4435 | /* translators: %s: Error String */ |
| 4436 | printf( __( 'Error! It is required to use %s field.', 'essential-addons-for-elementor-lite' ), '<strong>Email</strong>' ); |
| 4437 | ?> |
| 4438 | </p> |
| 4439 | <?php |
| 4440 | return true; |
| 4441 | } |
| 4442 | |
| 4443 | return false; |
| 4444 | } |
| 4445 | |
| 4446 | /** |
| 4447 | * It shows error if Confirm Password Field is used without using Password Field. |
| 4448 | * |
| 4449 | * @param $password_exist |
| 4450 | * @param $confirm_pass_exist |
| 4451 | * |
| 4452 | * @return bool |
| 4453 | */ |
| 4454 | protected function print_error_for_missing_password_field( $password_exist, $confirm_pass_exist ) { |
| 4455 | if ( empty( $password_exist ) && ! empty( $confirm_pass_exist ) ) { |
| 4456 | ?> |
| 4457 | <p class='eael-register-form-error elementor-alert elementor-alert-warning'> |
| 4458 | <?php |
| 4459 | /* translators: %s: Error String */ |
| 4460 | printf( __( 'Error! It is required to use %s field with %s Field.', 'essential-addons-for-elementor-lite' ), '<strong>Password</strong>', '<strong>Password Confirmation</strong>' ); |
| 4461 | ?> |
| 4462 | </p> |
| 4463 | <?php |
| 4464 | return true; |
| 4465 | } |
| 4466 | |
| 4467 | return false; |
| 4468 | } |
| 4469 | |
| 4470 | protected function print_validation_message() { |
| 4471 | $errors = get_option( 'eael_register_errors_' . $this->get_id() ); |
| 4472 | $success = get_option( 'eael_register_success_' . $this->get_id() ); |
| 4473 | if ( empty( $errors ) && empty( $success ) ) { |
| 4474 | return; |
| 4475 | } |
| 4476 | if ( ! empty( $errors ) && is_array( $errors ) ) { |
| 4477 | $this->print_registration_errors_message( $errors ); |
| 4478 | } else { |
| 4479 | $this->print_registration_success_message( $success ); |
| 4480 | } |
| 4481 | } |
| 4482 | |
| 4483 | protected function print_registration_errors_message( $errors ) { |
| 4484 | ?> |
| 4485 | <div class="eael-form-msg invalid"> |
| 4486 | <?php |
| 4487 | if ( ! empty( $this->ds['err_unknown'] ) ) { |
| 4488 | printf( '<p>%s</p>', esc_html( $this->ds['err_unknown'] ) ); |
| 4489 | } |
| 4490 | ?> |
| 4491 | <ol> |
| 4492 | <?php |
| 4493 | foreach ( $errors as $register_error ) { |
| 4494 | printf( '<li>%s</li>', esc_html( $register_error ) ); |
| 4495 | } |
| 4496 | ?> |
| 4497 | </ol> |
| 4498 | </div> |
| 4499 | <?php |
| 4500 | delete_option( 'eael_register_errors_' . $this->get_id() ); |
| 4501 | } |
| 4502 | |
| 4503 | protected function print_registration_success_message( $success ) { |
| 4504 | |
| 4505 | if ( $success ) { |
| 4506 | $message = '<p class="eael-form-msg valid">' . esc_html( $this->get_settings_for_display( 'success_register' ) ) . '</p>'; |
| 4507 | echo apply_filters( 'eael/login-register/registration-success-msg', $message, $success ); |
| 4508 | |
| 4509 | delete_option( 'eael_register_success_' . $this->get_id() ); |
| 4510 | |
| 4511 | return true; // it will help in case we wanna know if error is printed. |
| 4512 | } |
| 4513 | |
| 4514 | return false; |
| 4515 | } |
| 4516 | |
| 4517 | /** |
| 4518 | * It will apply value like Elementor's dimension control to a property and return it. |
| 4519 | * |
| 4520 | * @param string $css_property CSS property name |
| 4521 | * |
| 4522 | * @return string |
| 4523 | */ |
| 4524 | public function apply_dim( $css_property ) { |
| 4525 | return "{$css_property}: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};"; |
| 4526 | } |
| 4527 | |
| 4528 | } |
| 4529 |