0, 'right' => 0, 'bottom' => 0, 'left' => 0 ) ); return array( 'visibility_style' => $should_hide ? 'display: none;' : '', 'custom_class' => $J::truthy( $f( 'cssClassName' ) ) ? ' ' . $J::str( $f( 'cssClassName' ) ) : '', 'label_font_size' => ! $J::is_nullish( $J::nc( $f( 'wpvfbLabelFontSize' ), $f( 'fontSize' ) ) ) ? $J::nc( $f( 'wpvfbLabelFontSize' ), $f( 'fontSize' ) ) : $J::or_( $g( 'labelFontSize' ), 15 ), 'label_line_height' => ( is_int( $label_lh_value ) || is_float( $label_lh_value ) ) ? $J::str( $label_lh_value ) . 'px' : $label_lh_value, 'label_font_weight' => $J::defined( $field, 'labelFontWeight' ) ? $f( 'labelFontWeight' ) : $J::or_( $g( 'labelFontWeight' ), 600 ), 'label_font_style' => $J::or_( $f( 'labelFontStyle' ), 'normal' ), 'desc_font_size' => ! $J::is_nullish( $f( 'descriptionFontSize' ) ) ? $f( 'descriptionFontSize' ) : $J::or_( $g( 'descriptionFontSize' ), $g( 'fontSize' ), 14 ), 'desc_line_height' => ( is_int( $desc_lh_value ) || is_float( $desc_lh_value ) ) ? $J::str( $desc_lh_value ) . 'px' : $desc_lh_value, 'desc_font_weight' => $J::defined( $field, 'descriptionFontWeight' ) ? $f( 'descriptionFontWeight' ) : 400, 'desc_font_style' => $J::or_( $f( 'descriptionFontStyle' ), 'normal' ), 'desc_color' => $J::or_( $f( 'descriptionColor' ), $g( 'descriptionColor' ), '#9CA3AF' ), 'margin_css' => 'margin: ' . $J::str( $J::get( $margin, 'top' ) ) . 'px ' . $J::str( $J::get( $margin, 'right' ) ) . 'px ' . $J::str( $J::defined( $margin, 'bottom' ) ? $J::get( $margin, 'bottom' ) : 15 ) . 'px ' . $J::str( $J::get( $margin, 'left' ) ) . 'px;', ); } /** `margin-top: …; margin-right: …; margin-bottom: …; margin-left: …;` from field.labelMargin. */ protected function misc_label_margin( $field ) { $J = 'WPVFB_JS'; $lm_bottom = $J::defined( $field, 'labelMargin.bottom' ) ? $J::get( $field, 'labelMargin.bottom' ) : 10; return 'margin-top: ' . $J::str( $J::or_( $J::get( $field, 'labelMargin.top' ), 0 ) ) . 'px; margin-right: ' . $J::str( $J::or_( $J::get( $field, 'labelMargin.right' ), 0 ) ) . 'px; margin-bottom: ' . $J::str( $lm_bottom ) . 'px; margin-left: ' . $J::str( $J::or_( $J::get( $field, 'labelMargin.left' ), 0 ) ) . 'px;'; } /** The full description
(font size/line-height/weight/style + margin) used by most fields. */ protected function misc_desc_p( $field, $gs, $c, $above, $p_class ) { $J = 'WPVFB_JS'; return '
' . $this->t( $J::get( $field, 'description' ) ) . '
'; } /** The short description(global font size / label line-height) used by url/email. */ protected function misc_desc_p_short( $field, $gs, $desc_color, $p_class ) { $J = 'WPVFB_JS'; return '
' . $this->t( $J::get( $field, 'description' ) ) . '
'; } /** Label style block shared by url/email and add-on fields (without color / margins). */ protected function misc_label_style( $gs, $color, $c ) { $J = 'WPVFB_JS'; $left = 'left' === $J::get( $gs, 'labelPlacement' ); return 'color:' . $J::str( $color ) . '; font-size:' . $J::str( $c['label_font_size'] ) . 'px; font-weight:' . $J::str( $c['label_font_weight'] ) . '; font-style:' . $J::str( $c['label_font_style'] ) . '; line-height:' . $J::str( $c['label_line_height'] ) . '; letter-spacing:' . $J::str( $J::get( $gs, 'letterSpacing' ) ) . 'px; width:' . ( $left ? '130px' : 'auto' ) . '; min-width:' . ( $left ? '130px' : 'auto' ) . '; max-width:' . ( $left ? '130px' : 'none' ) . '; text-align:left; overflow-wrap: break-word; white-space: normal;'; } /** Hardcoded red asterisk used by url/captcha and add-on fields (they do not call renderRequiredAsterisk). */ protected function misc_red_asterisk( $field ) { return WPVFB_JS::truthy( WPVFB_JS::get( $field, 'required' ) ) ? '*' : ''; } /** Global (unscoped) placeholder styles of url/email. */ protected function misc_placeholder_styles( $color ) { $ph = $this->css( $color ); return " ::placeholder { color: {$ph} !important; } :-ms-input-placeholder { color: {$ph} !important; } ::-ms-input-placeholder { color: {$ph} !important; } "; } protected function misc_icon_html( $field ) { $J = 'WPVFB_JS'; $has_icon = $J::truthy( $J::get( $field, 'fieldIcon' ) ) && 'none' !== $J::get( $field, 'fieldIcon' ); if ( ! $has_icon ) { return ''; } $icon_position = $J::or_( $J::get( $field, 'iconPosition' ), 'left' ); $icon_color = $J::or_( $J::get( $field, 'iconColor' ), '#6B7280' ); return ''; } /** renderUrlField — route.ts lines 1695-1861 */ public function render_url_field( $field, $gs ) { $J = 'WPVFB_JS'; $f = function ( $p ) use ( $field ) { return WPVFB_JS::get( $field, $p ); }; $g = function ( $p ) use ( $gs ) { return WPVFB_JS::get( $gs, $p ); }; $c = $this->misc_common( $field, $gs ); $input_border_color = $J::or_( $f( 'inputBorderColor' ), $g( 'inputBorderColor' ), '#D1D5DB' ); $hover_border_color = $J::or_( $f( 'hoverBorderColor' ), $g( 'hoverBorderColor' ), '#6B7280' ); $focus_border_color = $J::or_( $f( 'focusBorderColor' ), $g( 'focusBorderColor' ), '#3B82F6' ); $input_background_color = $J::or_( $f( 'inputBackgroundColor' ), $g( 'inputBackgroundColor' ), '#F9FAFB' ); $placeholder_text_color = $J::or_( $f( 'placeholderTextColor' ), $g( 'placeholderTextColor' ), '#9CA3AF' ); $text_color = $J::or_( $f( 'textColor' ), $g( 'inputTextColor' ), $g( 'primaryTextColor' ), '#000000' ); $desc_color = $c['desc_color']; $label_class = 'left' === $g( 'labelPlacement' ) ? 'flex items-start space-x-4 w-full' : 'flex flex-col'; $has_icon = $J::truthy( $f( 'fieldIcon' ) ) && 'none' !== $f( 'fieldIcon' ); $icon_position = $J::or_( $f( 'iconPosition' ), 'left' ); $input_padding = $has_icon ? ( 'left' === $icon_position ? '8px 8px 8px 32px' : '8px 32px 8px 8px' ) : '8px'; $input_style = ' background-color: ' . $J::str( $J::or_( $f( 'inputBackgroundColor' ), $input_background_color ) ) . '; border-color: ' . $J::str( $input_border_color ) . '; border-width: ' . $J::str( $J::or_( $g( 'inputSettings.borderWidth' ), 1 ) ) . 'px; border-radius: ' . $J::str( $J::or_( $g( 'inputSettings.borderRadius' ), 4 ) ) . 'px; border-style: solid !important; font-family: inherit !important; color: ' . $J::str( $text_color ) . '; font-size: ' . $J::str( $g( 'fontSize' ) ) . 'px; line-height: ' . $J::str( $g( 'lineHeight' ) ) . 'px; letter-spacing: ' . $J::str( $g( 'letterSpacing' ) ) . 'px; padding: ' . $input_padding . '; width: ' . $J::str( $J::or_( $f( 'width' ), '100%' ) ) . '; outline: none; box-shadow: none; transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out; '; $label_html = ''; if ( 'none' !== $g( 'labelPlacement' ) && 'hidden' !== $f( 'labelVisibility' ) ) { $label_html = ''; } $has_desc = $J::truthy( $f( 'description' ) ); $desc_above = ( 'above' === $g( 'descriptionPlacement' ) && $has_desc ) ? $this->misc_desc_p_short( $field, $gs, $desc_color, 'text-sm mb-2' ) : ''; $desc_below = ( 'below' === $g( 'descriptionPlacement' ) && $has_desc ) ? $this->misc_desc_p( $field, $gs, $c, false, 'text-sm mt-1' ) : ''; $fb = $this->a( $focus_border_color ); $ib = $this->a( $input_border_color ); $hb = $this->a( $hover_border_color ); return '' . $this->t( $f( 'description' ) ) . '
'; }; $desc_above = ( 'above' === $g( 'descriptionPlacement' ) && $has_desc ) ? $desc( 'text-sm mb-2' ) : ''; $desc_below = ( 'below' === $g( 'descriptionPlacement' ) && $has_desc ) ? $desc( 'text-sm mt-2' ) : ''; $captcha_html = $is_v3 ? '' : ' '; return '