Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions classes/helpers/FrmStylesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,7 @@ public static function output_vars( $settings, $defaults = array(), $vars = arra
$vars = self::get_css_vars( array_keys( $settings ) );
}

$remove = array( 'remove_box_shadow', 'remove_box_shadow_active', 'theme_css', 'theme_name', 'theme_selector', 'important_style', 'submit_style', 'collapse_icon', 'center_form', 'custom_css', 'style_class', 'submit_bg_img', 'change_margin', 'repeat_icon', 'use_base_font_size', 'field_shape_type' );
$vars = array_diff( $vars, $remove );
$vars = array_diff( $vars, self::get_style_keys_to_remove_from_output_vars() );

foreach ( $vars as $var ) {
if ( ! isset( $settings[ $var ] ) || ! self::css_key_is_valid( $var ) ) {
Expand All @@ -504,6 +503,35 @@ public static function output_vars( $settings, $defaults = array(), $vars = arra
}
}

/**
* None of these style settings are used as CSS variables, so we want to exclude them to keep the CSS output clean.
*
* @since x.x
*
* @return array<string>
*/
private static function get_style_keys_to_remove_from_output_vars() {
return array(
'remove_box_shadow',
'remove_box_shadow_active',
'theme_css',
'theme_name',
'theme_selector',
'important_style',
'submit_style',
'collapse_icon',
'center_form',
'custom_css',
'style_class',
'submit_bg_img',
'change_margin',
'repeat_icon',
'use_base_font_size',
'field_shape_type',
'bg_image_id',
);
}

/**
* Check if a CSS variable setting is not blank, doesn't match the default, and doesn't include invalid substrings.
*
Expand Down