| @@ -867,11 +867,8 @@ | ||
| 867 | 867 | $color = trim( $color ); |
| 868 | 868 | |
| 869 | 869 | if ( ! $color ) { |
| 870 | 870 | $color = $default; |
| 871 | - } elseif ( str_contains( $color, 'rgb(' ) ) { | |
| 872 | - $color = str_replace( 'rgb(', 'rgba(', $color ); | |
| 873 | - $color = str_replace( ')', ',1)', $color ); | |
| 874 | 871 | } elseif ( ! str_contains( $color, '#' ) && self::is_hex( $color ) ) { |
| 875 | 872 | $color = '#' . $color; |
| 876 | 873 | } |
| 877 | 874 | } |
| @@ -887,8 +884,9 @@ | ||
| 887 | 884 | * @return bool |
| 888 | 885 | */ |
| 889 | 886 | private static function is_hex( $color ) { |
| 890 | 887 | $non_hex_substrings = array( |
| 888 | + 'rgb(', | |
| 891 | 889 | 'rgba(', |
| 892 | 890 | 'hsl(', |
| 893 | 891 | 'hsla(', |
| 894 | 892 | 'hwb(', |
| @@ -925,8 +923,24 @@ | ||
| 925 | 923 | $change_margin = '650px'; |
| 926 | 924 | } |
| 927 | 925 | |
| 928 | 926 | return $change_margin; |
| 927 | + } | |
| 928 | + | |
| 929 | + /** | |
| 930 | + * Get the raw alignment value stored in the active style for a radio or checkbox field. | |
| 931 | + * | |
| 932 | + * @since 6.32 | |
| 933 | + * | |
| 934 | + * @param array|int $field The 'field' array. | |
| 935 | + * | |
| 936 | + * @return string | |
| 937 | + */ | |
| 938 | + public static function get_align_from_active_style( $field ) { | |
| 939 | + $field_type = FrmField::is_checkbox( $field ) ? 'checkbox' : 'radio'; | |
| 940 | + $key = FrmStylesController::get_align_key_for_style_settings( $field_type ); | |
| 941 | + | |
| 942 | + return FrmStylesController::get_active_style( $field )->post_content[ $key ] ?? ''; | |
| 929 | 943 | } |
| 930 | 944 | |
| 931 | 945 | /** |
| 932 | 946 | * @since 2.3 |