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
module-size-embed.php
151 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Embedded custom size settings. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.3.0 |
| 7 | */ |
| 8 | |
| 9 | $component = '.hustle-inline-content'; |
| 10 | |
| 11 | $is_desktop_custom = ( '1' === $design['customize_size'] ); |
| 12 | $is_mobile_custom = ( '1' === $design['customize_size_mobile'] ); |
| 13 | |
| 14 | // SETTINGS: Width. |
| 15 | $desktop_width = $design['custom_width']; |
| 16 | $desktop_width = ( '' !== $desktop_width ) ? $desktop_width . $design['custom_width_unit'] : '100%'; |
| 17 | $desktop_width = ( 'auto' !== $design['custom_width_unit'] ) ? $desktop_width : ''; |
| 18 | |
| 19 | $mobile_width = $design['custom_width_mobile']; |
| 20 | $mobile_width = ( '' !== $mobile_width ) ? $mobile_width . $design['custom_width_unit_mobile'] : ''; |
| 21 | $mobile_width = ( 'auto' !== $design['custom_width_unit_mobile'] ) ? $mobile_width : ''; |
| 22 | |
| 23 | // SETTINGS: Height. |
| 24 | $desktop_height = $design['custom_height']; |
| 25 | $desktop_height = ( '' !== $desktop_height ) ? $desktop_height . $design['custom_height_unit'] : ''; |
| 26 | $desktop_height = ( 'auto' !== $design['custom_height_unit'] ) ? $desktop_height : ''; |
| 27 | |
| 28 | $mobile_height = $design['custom_height_mobile']; |
| 29 | $mobile_height = ( '' !== $mobile_height ) ? $mobile_height . $design['custom_height_unit_mobile'] : ''; |
| 30 | $mobile_height = ( 'auto' !== $design['custom_height_unit_mobile'] ) ? $mobile_height : ''; |
| 31 | |
| 32 | // Check if module is inline. |
| 33 | if ( $is_embed ) { |
| 34 | |
| 35 | if ( ! $is_vanilla ) { |
| 36 | |
| 37 | $style .= ''; |
| 38 | |
| 39 | // Mobile styles. |
| 40 | if ( $is_mobile_enabled && $is_mobile_custom ) { |
| 41 | |
| 42 | if ( '' !== $mobile_width || '' !== $mobile_height ) { |
| 43 | $style .= $prefix_mobile . $component . ' {'; |
| 44 | $style .= ( '' !== $mobile_width ) ? 'max-width: ' . $mobile_width . ';' : ''; |
| 45 | $style .= ( '' !== $mobile_height ) ? 'max-height: ' . $mobile_height . ';' : ''; |
| 46 | $style .= ( '' !== $mobile_height ) ? 'overflow-y: auto;' : ''; |
| 47 | $style .= '}'; |
| 48 | |
| 49 | if ( '' !== $mobile_height ) { |
| 50 | |
| 51 | if ( $is_optin ) { |
| 52 | $style .= $prefix_mobile . $component . ' .hustle-layout {'; |
| 53 | $style .= 'max-height: calc(' . $mobile_height . ' - 30px);'; |
| 54 | $style .= '}'; |
| 55 | } else { |
| 56 | $style .= $prefix_mobile . $component . ' .hustle-info {'; |
| 57 | $style .= 'max-height: calc(100% - 30px);'; |
| 58 | $style .= '}'; |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // Desktop styles. |
| 65 | if ( $is_desktop_custom ) { |
| 66 | |
| 67 | if ( '' !== $desktop_width || '' !== $desktop_height ) { |
| 68 | |
| 69 | $style .= $breakpoint . ' {'; |
| 70 | $style .= $prefix_desktop . $component . ' {'; |
| 71 | $style .= ( '' !== $desktop_width ) ? 'max-width: ' . $desktop_width . ';' : ''; |
| 72 | $style .= ( '' !== $desktop_height ) ? 'max-height: ' . $desktop_height . ';' : ''; |
| 73 | $style .= ( '' !== $desktop_height ) ? 'overflow-y: auto;' : ''; |
| 74 | $style .= '}'; |
| 75 | $style .= '}'; |
| 76 | |
| 77 | if ( '' !== $desktop_height ) { |
| 78 | |
| 79 | if ( $is_optin ) { |
| 80 | $style .= $breakpoint . ' {'; |
| 81 | $style .= $prefix_desktop . $component . ' .hustle-layout {'; |
| 82 | $style .= 'max-height: calc(' . $desktop_height . ' - 30px);'; |
| 83 | $style .= '}'; |
| 84 | $style .= '}'; |
| 85 | } else { |
| 86 | $style .= $breakpoint . ' {'; |
| 87 | $style .= $prefix_desktop . $component . ' .hustle-info {'; |
| 88 | $style .= 'max-height: calc(100% - 30px);'; |
| 89 | $style .= '}'; |
| 90 | $style .= '}'; |
| 91 | } |
| 92 | } else { |
| 93 | $style .= $breakpoint . ' {'; |
| 94 | $style .= $prefix_desktop . $component . ' {'; |
| 95 | $style .= ( '' !== $mobile_height ) ? 'max-height: none;' : ''; |
| 96 | $style .= ( '' !== $mobile_height ) ? 'max-height: unset;' : ''; |
| 97 | $style .= ( '' !== $mobile_height ) ? 'overflow-y: initial;' : ''; |
| 98 | $style .= '}'; |
| 99 | $style .= ( $is_optin ) ? $prefix_desktop . $component . ' .hustle-layout {' : $prefix_desktop . $component . ' .hustle-info {'; |
| 100 | $style .= 'max-height: none;'; |
| 101 | $style .= 'max-height: unset;'; |
| 102 | $style .= '}'; |
| 103 | $style .= '}'; |
| 104 | } |
| 105 | } elseif ( $is_mobile_enabled && $is_mobile_custom ) { // Check if mobile settings and custom size for mobiles are enabled. |
| 106 | |
| 107 | if ( '' !== $mobile_width || '' !== $mobile_height ) { |
| 108 | |
| 109 | $style .= $breakpoint . ' {'; |
| 110 | $style .= $prefix_desktop . $component . ' {'; |
| 111 | $style .= ( '' !== $mobile_width ) ? 'max-width: 100%;' : ''; |
| 112 | $style .= ( '' !== $mobile_height ) ? 'max-height: none;' : ''; |
| 113 | $style .= ( '' !== $mobile_height ) ? 'max-height: unset;' : ''; |
| 114 | $style .= ( '' !== $mobile_height ) ? 'overflow-y: initial;' : ''; |
| 115 | $style .= '}'; |
| 116 | $style .= '}'; |
| 117 | |
| 118 | if ( '' !== $mobile_height ) { |
| 119 | $style .= $breakpoint . ' {'; |
| 120 | $style .= ( $is_optin ) ? $prefix_desktop . $component . ' .hustle-layout {' : $prefix_desktop . $component . ' .hustle-info {'; |
| 121 | $style .= 'max-height: none;'; |
| 122 | $style .= 'max-height: unset;'; |
| 123 | $style .= '}'; |
| 124 | $style .= '}'; |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | } elseif ( $is_mobile_enabled && $is_mobile_custom ) { // Check if mobile settings and custom size for mobiles are enabled. |
| 129 | |
| 130 | if ( '' !== $mobile_width || '' !== $mobile_height ) { |
| 131 | |
| 132 | $style .= $breakpoint . ' {'; |
| 133 | $style .= $prefix_desktop . $component . ' {'; |
| 134 | $style .= ( '' !== $mobile_width ) ? 'max-width: 100%;' : ''; |
| 135 | $style .= ( '' !== $mobile_height ) ? 'max-height: unset;' : ''; |
| 136 | $style .= ( '' !== $mobile_height ) ? 'overflow-y: initial;' : ''; |
| 137 | $style .= '}'; |
| 138 | $style .= '}'; |
| 139 | |
| 140 | if ( '' !== $mobile_height ) { |
| 141 | $style .= $breakpoint . ' {'; |
| 142 | $style .= ( $is_optin ) ? $prefix_desktop . $component . ' .hustle-layout {' : $prefix_desktop . $component . ' .hustle-info {'; |
| 143 | $style .= 'max-height: unset;'; |
| 144 | $style .= '}'; |
| 145 | $style .= '}'; |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 |