Skip to content

Commit

Permalink
Prevent unwanted core/navigation-link variations #49
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Oct 7, 2021
1 parent 5e0f745 commit 36a3b6b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions oik-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ function oik_blocks_loaded() {
add_action( "plugins_loaded", "oik_blocks_plugins_loaded", 100 );
add_action( "init", "oik_blocks_register_dynamic_blocks" );
add_action( 'init', 'oik_blocks_register_block_patterns' );
add_action( 'init', 'oik_blocks_prevent_nav_link_variations', 19 );
add_action( "oik_pre_theme_field", "oik_blocks_pre_theme_field" );
}

Expand Down Expand Up @@ -338,6 +339,19 @@ function oik_blocks_register_block_patterns() {
}
}

/**
* Disables the creation of core/navigation-link variations.
*
* We hook into init at priority 19 in order to remove action hook that will register the
* navigation link variations. This is a bit draconian, but an easy first fix to showing too many Link blocks.
*/
function oik_blocks_prevent_nav_link_variations() {
$removed = remove_action( 'init', 'gutenberg_register_block_core_navigation_link', 20 );
if ( !$removed ) {
// That's interesting.
}
}

/**
* Implements 'plugins_loaded' action for oik-blocks
*
Expand Down

0 comments on commit 36a3b6b

Please sign in to comment.