form-01--form-container.php
5 years ago
form-02--form-fields.php
5 years ago
form-03--input.php
5 years ago
form-04--select2.php
5 years ago
form-05--select2-dropdown.php
5 years ago
form-06--timepicker-dropdown.php
5 years ago
form-07--radio.php
5 years ago
form-08--checkbox.php
5 years ago
form-09--calendar.php
5 years ago
form-10--submit.php
5 years ago
form-11--options-container.php
5 years ago
form-12--options-title.php
5 years ago
form-13--gdpr.php
5 years ago
form-14--error-message.php
5 years ago
form-15--success-message.php
5 years ago
form-16--recaptcha.php
5 years ago
general-01--module-container.php
5 years ago
general-02--main-layout.php
5 years ago
general-03--layout-header.php
5 years ago
general-04--layout-content.php
5 years ago
general-05--layout-footer.php
5 years ago
general-06--image-size.php
5 years ago
general-07--image-fitting.php
5 years ago
general-08--image-position.php
5 years ago
general-09--content-wrapper.php
5 years ago
general-10--title.php
5 years ago
general-11--subtitle.php
5 years ago
general-12--content.php
5 years ago
general-13--cta-container.php
5 years ago
general-14--cta-button.php
5 years ago
general-15--cta-alignment.php
5 years ago
general-16--nsa-link.php
5 years ago
general-17--close-button.php
5 years ago
general-18--popup-mask.php
5 years ago
module-size-embed.php
5 years ago
module-size-popup.php
5 years ago
module-size-slidein.php
5 years ago
module-size-embed.php
161 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Embedded custom size settings. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.3.0 |
| 7 | */ |
| 8 | |
| 9 | // phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect |
| 10 | |
| 11 | $component = '.hustle-inline-content'; |
| 12 | |
| 13 | $is_desktop_custom = ( '1' === $design['customize_size'] ); |
| 14 | $is_mobile_custom = ( '1' === $design['customize_size_mobile'] ); |
| 15 | |
| 16 | // SETTINGS: Width. |
| 17 | $desktop_width = $design['custom_width']; |
| 18 | $desktop_width = ( '' !== $desktop_width ) ? $desktop_width . $design['custom_width_unit'] : '100%'; |
| 19 | $desktop_width = ( 'auto' !== $design['custom_width_unit'] ) ? $desktop_width : ''; |
| 20 | |
| 21 | $mobile_width = $design['custom_width_mobile']; |
| 22 | $mobile_width = ( '' !== $mobile_width ) ? $mobile_width . $design['custom_width_unit_mobile'] : ''; |
| 23 | $mobile_width = ( 'auto' !== $design['custom_width_unit_mobile'] ) ? $mobile_width : ''; |
| 24 | |
| 25 | // SETTINGS: Height. |
| 26 | $desktop_height = $design['custom_height']; |
| 27 | $desktop_height = ( '' !== $desktop_height ) ? $desktop_height . $design['custom_height_unit'] : ''; |
| 28 | $desktop_height = ( 'auto' !== $design['custom_height_unit'] ) ? $desktop_height : ''; |
| 29 | |
| 30 | $mobile_height = $design['custom_height_mobile']; |
| 31 | $mobile_height = ( '' !== $mobile_height ) ? $mobile_height . $design['custom_height_unit_mobile'] : ''; |
| 32 | $mobile_height = ( 'auto' !== $design['custom_height_unit_mobile'] ) ? $mobile_height : ''; |
| 33 | |
| 34 | // Check if module is inline. |
| 35 | if ( $is_embed ) { |
| 36 | |
| 37 | if ( ! $is_vanilla ) { |
| 38 | |
| 39 | $style .= ''; |
| 40 | |
| 41 | // Mobile styles. |
| 42 | if ( $is_mobile_enabled && $is_mobile_custom ) { |
| 43 | |
| 44 | if ( '' !== $mobile_width || '' !== $mobile_height ) { |
| 45 | $style .= $prefix_mobile . $component . ' {'; |
| 46 | $style .= ( '' !== $mobile_width ) ? 'max-width: ' . $mobile_width . ';' : ''; |
| 47 | $style .= ( '' !== $mobile_height ) ? 'max-height: ' . $mobile_height . ';' : ''; |
| 48 | $style .= ( '' !== $mobile_height ) ? 'overflow-y: auto;' : ''; |
| 49 | $style .= '}'; |
| 50 | |
| 51 | if ( '' !== $mobile_height ) { |
| 52 | |
| 53 | if ( $is_optin ) { |
| 54 | $style .= $prefix_mobile . $component . ' .hustle-layout {'; |
| 55 | $style .= 'max-height: calc(' . $mobile_height . ' - 30px);'; |
| 56 | $style .= '}'; |
| 57 | } else { |
| 58 | $style .= $prefix_mobile . $component . ' .hustle-info {'; |
| 59 | $style .= 'max-height: calc(100% - 30px);'; |
| 60 | $style .= '}'; |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // Desktop styles. |
| 67 | if ( $is_desktop_custom ) { |
| 68 | |
| 69 | if ( '' !== $desktop_width || '' !== $desktop_height ) { |
| 70 | |
| 71 | $style .= $breakpoint . ' {'; |
| 72 | $style .= $prefix_desktop . $component . ' {'; |
| 73 | $style .= ( '' !== $desktop_width ) ? 'max-width: ' . $desktop_width . ';' : ''; |
| 74 | $style .= ( '' !== $desktop_height ) ? 'max-height: ' . $desktop_height . ';' : ''; |
| 75 | $style .= ( '' !== $desktop_height ) ? 'overflow-y: auto;' : ''; |
| 76 | $style .= '}'; |
| 77 | $style .= '}'; |
| 78 | |
| 79 | if ( '' !== $desktop_height ) { |
| 80 | |
| 81 | if ( $is_optin ) { |
| 82 | $style .= $breakpoint . ' {'; |
| 83 | $style .= $prefix_desktop . $component . ' .hustle-layout {'; |
| 84 | $style .= 'max-height: calc(' . $desktop_height . ' - 30px);'; |
| 85 | $style .= '}'; |
| 86 | $style .= '}'; |
| 87 | } else { |
| 88 | $style .= $breakpoint . ' {'; |
| 89 | $style .= $prefix_desktop . $component . ' .hustle-info {'; |
| 90 | $style .= 'max-height: calc(100% - 30px);'; |
| 91 | $style .= '}'; |
| 92 | $style .= '}'; |
| 93 | } |
| 94 | } else { |
| 95 | $style .= $breakpoint . ' {'; |
| 96 | $style .= $prefix_desktop . $component . ' {'; |
| 97 | $style .= ( '' !== $mobile_height ) ? 'max-height: none;' : ''; |
| 98 | $style .= ( '' !== $mobile_height ) ? 'max-height: unset;' : ''; |
| 99 | $style .= ( '' !== $mobile_height ) ? 'overflow-y: initial;' : ''; |
| 100 | $style .= '}'; |
| 101 | $style .= ( $is_optin ) ? $prefix_desktop . $component . ' .hustle-layout {' : $prefix_desktop . $component . ' .hustle-info {'; |
| 102 | $style .= 'max-height: none;'; |
| 103 | $style .= 'max-height: unset;'; |
| 104 | $style .= '}'; |
| 105 | $style .= '}'; |
| 106 | } |
| 107 | } else { |
| 108 | |
| 109 | // Check if mobile settings and custom size for mobiles are enabled. |
| 110 | if ( $is_mobile_enabled && $is_mobile_custom ) { |
| 111 | |
| 112 | if ( '' !== $mobile_width || '' !== $mobile_height ) { |
| 113 | |
| 114 | $style .= $breakpoint . ' {'; |
| 115 | $style .= $prefix_desktop . $component . ' {'; |
| 116 | $style .= ( '' !== $mobile_width ) ? 'max-width: 100%;' : ''; |
| 117 | $style .= ( '' !== $mobile_height ) ? 'max-height: none;' : ''; |
| 118 | $style .= ( '' !== $mobile_height ) ? 'max-height: unset;' : ''; |
| 119 | $style .= ( '' !== $mobile_height ) ? 'overflow-y: initial;' : ''; |
| 120 | $style .= '}'; |
| 121 | $style .= '}'; |
| 122 | |
| 123 | if ( '' !== $mobile_height ) { |
| 124 | $style .= $breakpoint . ' {'; |
| 125 | $style .= ( $is_optin ) ? $prefix_desktop . $component . ' .hustle-layout {' : $prefix_desktop . $component . ' .hustle-info {'; |
| 126 | $style .= 'max-height: none;'; |
| 127 | $style .= 'max-height: unset;'; |
| 128 | $style .= '}'; |
| 129 | $style .= '}'; |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | } else { |
| 135 | |
| 136 | // Check if mobile settings and custom size for mobiles are enabled. |
| 137 | if ( $is_mobile_enabled && $is_mobile_custom ) { |
| 138 | |
| 139 | if ( '' !== $mobile_width || '' !== $mobile_height ) { |
| 140 | |
| 141 | $style .= $breakpoint . ' {'; |
| 142 | $style .= $prefix_desktop . $component . ' {'; |
| 143 | $style .= ( '' !== $mobile_width ) ? 'max-width: 100%;' : ''; |
| 144 | $style .= ( '' !== $mobile_height ) ? 'max-height: unset;' : ''; |
| 145 | $style .= ( '' !== $mobile_height ) ? 'overflow-y: initial;' : ''; |
| 146 | $style .= '}'; |
| 147 | $style .= '}'; |
| 148 | |
| 149 | if ( '' !== $mobile_height ) { |
| 150 | $style .= $breakpoint . ' {'; |
| 151 | $style .= ( $is_optin ) ? $prefix_desktop . $component . ' .hustle-layout {' : $prefix_desktop . $component . ' .hustle-info {'; |
| 152 | $style .= 'max-height: unset;'; |
| 153 | $style .= '}'; |
| 154 | $style .= '}'; |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 |