Skip to content

Commit

Permalink
fix: run the migration script, old disabled block represents hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
Arukuen committed Nov 19, 2024
1 parent 052d5ef commit e0f6cb4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class Stackable_Editor_Settings {
* Add our hooks.
*/
function __construct() {
// Migrate settings.
add_action( 'admin_init', array( $this, 'migrate_block_states' ) );
add_action( 'rest_api_init', array( $this, 'migrate_block_states' ) );

// Register settings.
add_action( 'admin_init', array( $this, 'register_settings' ) );
add_action( 'rest_api_init', array( $this, 'register_settings' ) );
Expand Down Expand Up @@ -315,8 +319,8 @@ function migrate_block_states() {

if ( is_array( $old_disabled_blocks ) ) {
foreach ( $old_disabled_blocks as $block_name ) {
// In the block_states, disabled is 1 and hidden is 2
$new_block_states[ $block_name ] = 1;
// In the block_states, hidden is 2 and disabled is 3
$new_block_states[ $block_name ] = 2;
}
}

Expand Down

0 comments on commit e0f6cb4

Please sign in to comment.