@@ -1036,7 +1036,8 @@ private function process_edit_field( $post_submission ){
10361036 //restore field icon
10371037 if ( isset ( $ post_submission ['restore_field_icon ' ] ) ) {
10381038 $ restore_icon_defaults = apply_filters ( 'dt_custom_fields_settings ' , [], $ post_type );
1039- $ custom_field ['icon ' ] = $ restore_icon_defaults [ $ field_key ]['icon ' ];
1039+ $ custom_field ['icon ' ] = $ restore_icon_defaults [ $ field_key ]['icon ' ] ?? null ;
1040+ $ custom_field ['font-icon ' ] = $ restore_icon_defaults [ $ field_key ]['font-icon ' ] ?? null ;
10401041 }
10411042
10421043 // number field options
@@ -1138,10 +1139,8 @@ private function process_edit_field( $post_submission ){
11381139 $ null_icon_key = ( $ icon_key === 'font-icon ' ) ? 'icon ' : 'font-icon ' ;
11391140
11401141 // Update icon accordingly and nullify alternative
1141- if ( ! isset ( $ field_options [ $ option_key ][ $ icon_key ] ) || $ field_options [ $ option_key ][ $ icon_key ] != $ val ) {
1142- $ custom_field ['default ' ][ $ option_key ][ $ icon_key ] = $ val ;
1143- $ custom_field ['default ' ][ $ option_key ][ $ null_icon_key ] = null ;
1144- }
1142+ $ custom_field ['default ' ][ $ option_key ][ $ icon_key ] = $ val ;
1143+ $ custom_field ['default ' ][ $ option_key ][ $ null_icon_key ] = null ;
11451144 $ field_options [ $ option_key ][ $ icon_key ] = $ val ;
11461145 }
11471146 } else {
@@ -1179,14 +1178,23 @@ private function process_edit_field( $post_submission ){
11791178 }
11801179 //delete icon
11811180 if ( isset ( $ post_submission ['delete_icon ' ] ) ) {
1182- $ custom_field ['default ' ][ $ post_submission ['delete_icon ' ] ]['icon ' ] = '' ;
1183- $ field_options [ $ post_submission ['delete_icon ' ] ]['icon ' ] = '' ;
1181+ $ option_key = $ post_submission ['delete_icon ' ];
1182+ $ custom_field ['default ' ][ $ option_key ]['icon ' ] = null ;
1183+ $ custom_field ['default ' ][ $ option_key ]['font-icon ' ] = null ;
1184+ $ field_options [ $ option_key ]['icon ' ] = null ;
1185+ $ field_options [ $ option_key ]['font-icon ' ] = null ;
11841186 }
11851187 //restore icon
11861188 if ( isset ( $ post_submission ['restore_icon ' ] ) ) {
1187- $ restore_icon_defaults = apply_filters ( 'dt_custom_fields_settings ' , [], $ post_type );
1188- $ custom_field ['default ' ][ $ post_submission ['restore_icon ' ] ]['icon ' ] = $ restore_icon_defaults [ $ field_key ]['default ' ][ $ post_submission ['restore_icon ' ] ]['icon ' ];
1189- $ field_options [ $ post_submission ['restore_icon ' ] ]['icon ' ] = $ restore_icon_defaults [ $ field_key ]['default ' ][ $ post_submission ['restore_icon ' ] ]['icon ' ];
1189+ $ option_key = $ post_submission ['restore_icon ' ];
1190+ $ restore_icon_defaults = apply_filters ( 'dt_custom_fields_settings ' , [], $ post_type );
1191+ $ default_icon = $ restore_icon_defaults [ $ field_key ]['default ' ][ $ option_key ]['icon ' ] ?? '' ;
1192+ $ default_font_icon = $ restore_icon_defaults [ $ field_key ]['default ' ][ $ option_key ]['font-icon ' ] ?? null ;
1193+
1194+ $ custom_field ['default ' ][ $ option_key ]['icon ' ] = $ default_icon ;
1195+ $ custom_field ['default ' ][ $ option_key ]['font-icon ' ] = $ default_font_icon ;
1196+ $ field_options [ $ option_key ]['icon ' ] = $ default_icon ;
1197+ $ field_options [ $ option_key ]['font-icon ' ] = $ default_font_icon ;
11901198 }
11911199 //delete option
11921200 if ( isset ( $ post_submission ['delete_option ' ] ) ){
0 commit comments