form-01--form-container.php
3 years ago
form-02--form-fields.php
3 years ago
form-03--input.php
5 months ago
form-04--select2.php
5 months ago
form-05--select2-dropdown.php
3 years ago
form-06--timepicker-dropdown.php
3 years ago
form-07--radio.php
5 months ago
form-08--checkbox.php
5 months ago
form-09--calendar.php
3 years ago
form-10--submit.php
5 months ago
form-11--options-container.php
3 years ago
form-12--options-title.php
5 months ago
form-13--gdpr.php
5 months ago
form-14--error-message.php
5 months ago
form-15--success-message.php
2 years ago
form-16--recaptcha.php
5 months ago
general-01--module-container.php
3 years ago
general-02--main-layout.php
1 month ago
general-03--layout-header.php
3 years ago
general-04--layout-content.php
3 years ago
general-05--layout-footer.php
3 years ago
general-06--image-size.php
5 months ago
general-07--image-fitting.php
3 years ago
general-08--image-position.php
5 months ago
general-09--content-wrapper.php
3 years ago
general-10--title.php
5 months ago
general-11--subtitle.php
5 months ago
general-12--content.php
5 months ago
general-13--cta-container.php
3 years ago
general-14--cta-button.php
5 months ago
general-15--cta-alignment.php
3 years ago
general-16--nsa-link.php
5 months ago
general-17--close-button.php
3 years ago
general-18--popup-mask.php
3 years ago
general-19--cta-helper-text.php
5 months ago
module-size-embed.php
5 months ago
module-size-popup.php
5 months ago
module-size-slidein.php
3 years ago
form-01--form-container.php
117 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Form Container. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.3.0 |
| 7 | */ |
| 8 | |
| 9 | global $wp_locale; |
| 10 | |
| 11 | $is_rtl = $wp_locale->is_rtl(); |
| 12 | |
| 13 | $component = '.hustle-layout .hustle-layout-form'; |
| 14 | |
| 15 | // SETTINGS: Margin. |
| 16 | $margin_top = ( '' !== $advanced['form_cont_margin_top'] ) ? $advanced['form_cont_margin_top'] . $advanced['form_cont_margin_unit'] : '0'; |
| 17 | $margin_right = ( '' !== $advanced['form_cont_margin_right'] ) ? $advanced['form_cont_margin_right'] . $advanced['form_cont_margin_unit'] : '0'; |
| 18 | $margin_bottom = ( '' !== $advanced['form_cont_margin_bottom'] ) ? $advanced['form_cont_margin_bottom'] . $advanced['form_cont_margin_unit'] : '0'; |
| 19 | $margin_left = ( '' !== $advanced['form_cont_margin_left'] ) ? $advanced['form_cont_margin_left'] . $advanced['form_cont_margin_unit'] : '0'; |
| 20 | |
| 21 | $margin = $margin_top . ' ' . $margin_right . ' ' . $margin_bottom . ' ' . $margin_left; |
| 22 | |
| 23 | $mobile_margin_top = ( '' !== $advanced['form_cont_margin_top_mobile'] ) ? $advanced['form_cont_margin_top_mobile'] . $advanced['form_cont_margin_unit_mobile'] : $margin_top; |
| 24 | $mobile_margin_right = ( '' !== $advanced['form_cont_margin_right_mobile'] ) ? $advanced['form_cont_margin_right_mobile'] . $advanced['form_cont_margin_unit_mobile'] : $margin_right; |
| 25 | $mobile_margin_bottom = ( '' !== $advanced['form_cont_margin_bottom_mobile'] ) ? $advanced['form_cont_margin_bottom_mobile'] . $advanced['form_cont_margin_unit_mobile'] : $margin_bottom; |
| 26 | $mobile_margin_left = ( '' !== $advanced['form_cont_margin_left_mobile'] ) ? $advanced['form_cont_margin_left_mobile'] . $advanced['form_cont_margin_unit_mobile'] : $margin_left; |
| 27 | |
| 28 | $mobile_margin = $mobile_margin_top . ' ' . $mobile_margin_right . ' ' . $mobile_margin_bottom . ' ' . $mobile_margin_left; |
| 29 | $mobile_margin = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $margin : $mobile_margin; |
| 30 | |
| 31 | // SETTINGS: Padding. |
| 32 | $padding_top = ( '' !== $advanced['form_cont_padding_top'] ) ? $advanced['form_cont_padding_top'] . $advanced['form_cont_padding_unit'] : '0'; |
| 33 | $padding_right = ( '' !== $advanced['form_cont_padding_right'] ) ? $advanced['form_cont_padding_right'] . $advanced['form_cont_padding_unit'] : '0'; |
| 34 | $padding_bottom = ( '' !== $advanced['form_cont_padding_bottom'] ) ? $advanced['form_cont_padding_bottom'] . $advanced['form_cont_padding_unit'] : '0'; |
| 35 | $padding_left = ( '' !== $advanced['form_cont_padding_left'] ) ? $advanced['form_cont_padding_left'] . $advanced['form_cont_padding_unit'] : '0'; |
| 36 | |
| 37 | $padding = ( ! $is_rtl ) ? $padding_top . ' ' . $padding_right . ' ' . $padding_bottom . ' ' . $padding_left : $padding_top . ' ' . $padding_left . ' ' . $padding_bottom . ' ' . $padding_right; |
| 38 | |
| 39 | $mobile_padding_top = ( '' !== $advanced['form_cont_padding_top_mobile'] ) ? $advanced['form_cont_padding_top_mobile'] . $advanced['form_cont_padding_unit_mobile'] : $padding_top; |
| 40 | $mobile_padding_right = ( '' !== $advanced['form_cont_padding_right_mobile'] ) ? $advanced['form_cont_padding_right_mobile'] . $advanced['form_cont_padding_unit_mobile'] : $padding_right; |
| 41 | $mobile_padding_bottom = ( '' !== $advanced['form_cont_padding_bottom_mobile'] ) ? $advanced['form_cont_padding_bottom_mobile'] . $advanced['form_cont_padding_unit_mobile'] : $padding_bottom; |
| 42 | $mobile_padding_left = ( '' !== $advanced['form_cont_padding_left_mobile'] ) ? $advanced['form_cont_padding_left_mobile'] . $advanced['form_cont_padding_unit_mobile'] : $padding_left; |
| 43 | |
| 44 | $mobile_padding = $mobile_padding_top . ' ' . $mobile_padding_right . ' ' . $mobile_padding_bottom . ' ' . $mobile_padding_left; |
| 45 | $mobile_padding = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $padding : $mobile_padding; |
| 46 | |
| 47 | // SETTINGS: Border. |
| 48 | $border_top = ( '' !== $advanced['form_cont_border_top'] ) ? $advanced['form_cont_border_top'] . $advanced['form_cont_border_unit'] : '0'; |
| 49 | $border_right = ( '' !== $advanced['form_cont_border_right'] ) ? $advanced['form_cont_border_right'] . $advanced['form_cont_border_unit'] : '0'; |
| 50 | $border_bottom = ( '' !== $advanced['form_cont_border_bottom'] ) ? $advanced['form_cont_border_bottom'] . $advanced['form_cont_border_unit'] : '0'; |
| 51 | $border_left = ( '' !== $advanced['form_cont_border_left'] ) ? $advanced['form_cont_border_left'] . $advanced['form_cont_border_unit'] : '0'; |
| 52 | |
| 53 | $border_width = ( ! $is_rtl ) ? $border_top . ' ' . $border_right . ' ' . $border_bottom . ' ' . $border_left : $border_top . ' ' . $border_left . ' ' . $border_bottom . ' ' . $border_right; |
| 54 | $border_style = ( '' !== $advanced['form_cont_border_type'] ) ? $advanced['form_cont_border_type'] : 'solid'; |
| 55 | $border_color = $colors['form_cont_border']; |
| 56 | |
| 57 | $mobile_border_top = ( '' !== $advanced['form_cont_border_top_mobile'] ) ? $advanced['form_cont_border_top_mobile'] . $advanced['form_cont_border_unit_mobile'] : $border_top; |
| 58 | $mobile_border_right = ( '' !== $advanced['form_cont_border_right_mobile'] ) ? $advanced['form_cont_border_right_mobile'] . $advanced['form_cont_border_unit_mobile'] : $border_right; |
| 59 | $mobile_border_bottom = ( '' !== $advanced['form_cont_border_bottom_mobile'] ) ? $advanced['form_cont_border_bottom_mobile'] . $advanced['form_cont_border_unit_mobile'] : $border_bottom; |
| 60 | $mobile_border_left = ( '' !== $advanced['form_cont_border_left_mobile'] ) ? $advanced['form_cont_border_left_mobile'] . $advanced['form_cont_border_unit_mobile'] : $border_left; |
| 61 | |
| 62 | $mobile_border_width = $mobile_border_top . ' ' . $mobile_border_right . ' ' . $mobile_border_bottom . ' ' . $mobile_border_left; |
| 63 | $mobile_border_width = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_width : $mobile_border_width; |
| 64 | $mobile_border_style = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_style : $advanced['form_cont_border_type_mobile']; |
| 65 | |
| 66 | // SETTINGS: Border Radius. |
| 67 | $radius_topleft = ( '' !== $advanced['form_cont_radius_top_left'] ) ? $advanced['form_cont_radius_top_left'] . $advanced['form_cont_radius_unit'] : '0'; |
| 68 | $radius_topright = ( '' !== $advanced['form_cont_radius_top_right'] ) ? $advanced['form_cont_radius_top_right'] . $advanced['form_cont_radius_unit'] : '0'; |
| 69 | $radius_bottomright = ( '' !== $advanced['form_cont_radius_bottom_right'] ) ? $advanced['form_cont_radius_bottom_right'] . $advanced['form_cont_radius_unit'] : '0'; |
| 70 | $radius_bottomleft = ( '' !== $advanced['form_cont_radius_bottom_left'] ) ? $advanced['form_cont_radius_bottom_left'] . $advanced['form_cont_radius_unit'] : '0'; |
| 71 | |
| 72 | $border_radius = $radius_topleft . ' ' . $radius_topright . ' ' . $radius_bottomright . ' ' . $radius_bottomleft; |
| 73 | |
| 74 | $mobile_radius_topleft = ( '' !== $advanced['form_cont_radius_top_left_mobile'] ) ? $advanced['form_cont_radius_top_left_mobile'] . $advanced['form_cont_radius_unit_mobile'] : $radius_topleft; |
| 75 | $mobile_radius_topright = ( '' !== $advanced['form_cont_radius_top_right_mobile'] ) ? $advanced['form_cont_radius_top_right_mobile'] . $advanced['form_cont_radius_unit_mobile'] : $radius_topright; |
| 76 | $mobile_radius_bottomright = ( '' !== $advanced['form_cont_radius_bottom_right_mobile'] ) ? $advanced['form_cont_radius_bottom_right_mobile'] . $advanced['form_cont_radius_unit_mobile'] : $radius_bottomright; |
| 77 | $mobile_radius_bottomleft = ( '' !== $advanced['form_cont_radius_bottom_left_mobile'] ) ? $advanced['form_cont_radius_bottom_left_mobile'] . $advanced['form_cont_radius_unit_mobile'] : $radius_bottomleft; |
| 78 | |
| 79 | $mobile_border_radius = $mobile_radius_topleft . ' ' . $mobile_radius_topright . ' ' . $mobile_radius_bottomright . ' ' . $mobile_radius_bottomleft; |
| 80 | $mobile_border_radius = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_radius : $mobile_border_radius; |
| 81 | |
| 82 | // SETTINGS: Background. |
| 83 | $background_color = $colors['form_area_bg']; |
| 84 | |
| 85 | // ================================================== |
| 86 | // Check if module is an opt-in. |
| 87 | if ( $is_optin ) { |
| 88 | |
| 89 | $style .= ' '; |
| 90 | |
| 91 | // Mobile styles. |
| 92 | $style .= $prefix_mobile . $component . ' {'; |
| 93 | $style .= 'margin: ' . $mobile_margin . ';'; |
| 94 | $style .= 'padding: ' . $mobile_padding . ';'; |
| 95 | $style .= 'border-width: ' . $mobile_border_width . ';'; |
| 96 | $style .= 'border-style: ' . $mobile_border_style . ';'; |
| 97 | $style .= ( ! $is_vanilla ) ? 'border-color: ' . $border_color . ';' : ''; |
| 98 | $style .= 'border-radius: ' . $mobile_border_radius . ';'; |
| 99 | $style .= ( ! $is_vanilla ) ? 'background-color: ' . $background_color . ';' : ''; |
| 100 | $style .= '}'; |
| 101 | |
| 102 | // Desktop styles. |
| 103 | if ( $is_mobile_enabled ) { |
| 104 | |
| 105 | $style .= $breakpoint . ' {'; |
| 106 | $style .= $prefix_desktop . $component . ' {'; |
| 107 | $style .= 'margin: ' . $margin . ';'; |
| 108 | $style .= 'padding: ' . $padding . ';'; |
| 109 | $style .= 'border-width: ' . $border_width . ';'; |
| 110 | $style .= 'border-style: ' . $border_style . ';'; |
| 111 | $style .= 'border-radius: ' . $border_radius . ';'; |
| 112 | $style .= '}'; |
| 113 | $style .= '}'; |
| 114 | |
| 115 | } |
| 116 | } |
| 117 |