@@ -12,10 +12,6 @@ class Stackable_Editor_Settings {
1212 * Add our hooks.
1313 */
1414 function __construct () {
15- // Migrate settings.
16- add_action ( 'admin_init ' , array ( $ this , 'migrate_block_states ' ) );
17- add_action ( 'rest_api_init ' , array ( $ this , 'migrate_block_states ' ) );
18-
1915 // Register settings.
2016 add_action ( 'admin_init ' , array ( $ this , 'register_settings ' ) );
2117 add_action ( 'rest_api_init ' , array ( $ this , 'register_settings ' ) );
@@ -233,7 +229,7 @@ public function register_settings() {
233229 'default ' => true ,
234230 )
235231 );
236-
232+
237233 register_setting (
238234 'stackable_editor_settings ' ,
239235 'stackable_enable_text_default_block ' ,
@@ -272,7 +268,7 @@ public function add_settings( $settings ) {
272268 $ settings ['stackable_enable_reset_layout ' ] = get_option ( 'stackable_enable_reset_layout ' );
273269 $ settings ['stackable_enable_save_as_default_block ' ] = get_option ( 'stackable_enable_save_as_default_block ' );
274270 $ settings ['stackable_enable_text_default_block ' ] = get_option ( 'stackable_enable_text_default_block ' );
275-
271+
276272 return $ settings ;
277273 }
278274
@@ -302,32 +298,6 @@ public function add_nested_block_width( $css ) {
302298
303299 return $ css ;
304300 }
305-
306- /**
307- * Migrate from disabled blocks array to block states object.
308- *
309- * @return void
310- */
311- function migrate_block_states () {
312- $ old_setting_name = 'stackable_disabled_blocks ' ;
313- $ new_setting_name = 'stackable_block_states ' ;
314-
315- // Check if the old setting exists and the new setting is empty.
316- if ( get_option ( $ old_setting_name ) !== false && empty ( get_option ( $ new_setting_name , [] ) ) ) {
317- $ old_disabled_blocks = get_option ( $ old_setting_name , [] );
318- $ new_block_states = [];
319-
320- if ( is_array ( $ old_disabled_blocks ) ) {
321- foreach ( $ old_disabled_blocks as $ block_name ) {
322- // In the block_states, hidden is 2 and disabled is 3
323- $ new_block_states [ $ block_name ] = 2 ;
324- }
325- }
326-
327- update_option ( $ new_setting_name , $ new_block_states );
328- delete_option ( $ old_setting_name );
329- }
330- }
331301 }
332302
333303 new Stackable_Editor_Settings ();
0 commit comments