Skip to content

Commit

Permalink
Navigation: Remove tab filters for link and submenu (#47593)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored Feb 1, 2023
1 parent 2718f97 commit f52ddf3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
32 changes: 0 additions & 32 deletions packages/block-library/src/navigation-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,38 +372,6 @@ function register_block_core_navigation_link() {
}
add_action( 'init', 'register_block_core_navigation_link' );

/**
* Disables the display of block inspector tabs for the Navigation Link block.
*
* This is only a temporary measure until we have a TabPanel and mechanism that
* will allow the Navigation Link to programmatically select a tab when edited
* via a specific context.
*
* See:
* - https://github.com/WordPress/gutenberg/issues/45951
* - https://github.com/WordPress/gutenberg/pull/46321
* - https://github.com/WordPress/gutenberg/pull/46271
*
* @param array $settings Default editor settings.
* @return array Filtered editor settings.
*/
function gutenberg_disable_tabs_for_navigation_link_block( $settings ) {
$current_tab_settings = _wp_array_get(
$settings,
array( 'blockInspectorTabs' ),
array()
);

$settings['blockInspectorTabs'] = array_merge(
$current_tab_settings,
array( 'core/navigation-link' => false )
);

return $settings;
}

add_filter( 'block_editor_settings_all', 'gutenberg_disable_tabs_for_navigation_link_block' );

/**
* Enables animation of the block inspector for the Navigation Link block.
*
Expand Down
32 changes: 0 additions & 32 deletions packages/block-library/src/navigation-submenu/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,38 +290,6 @@ function register_block_core_navigation_submenu() {
}
add_action( 'init', 'register_block_core_navigation_submenu' );

/**
* Disables display of block inspector tabs for the Navigation Submenu block.
*
* This is only a temporary measure until we have a TabPanel and mechanism that
* will allow the Navigation Submenu to programmatically select a tab when
* edited via a specific context.
*
* See:
* - https://github.com/WordPress/gutenberg/issues/45951
* - https://github.com/WordPress/gutenberg/pull/46321
* - https://github.com/WordPress/gutenberg/pull/46271
*
* @param array $settings Default editor settings.
* @return array Filtered editor settings.
*/
function gutenberg_disable_tabs_for_navigation_submenu_block( $settings ) {
$current_tab_settings = _wp_array_get(
$settings,
array( 'blockInspectorTabs' ),
array()
);

$settings['blockInspectorTabs'] = array_merge(
$current_tab_settings,
array( 'core/navigation-submenu' => false )
);

return $settings;
}

add_filter( 'block_editor_settings_all', 'gutenberg_disable_tabs_for_navigation_submenu_block' );

/**
* Enables animation of the block inspector for the Navigation Submenu block.
*
Expand Down

0 comments on commit f52ddf3

Please sign in to comment.