Menus: Deprecate block_core_navigation_submenu_render_submenu_icon() rather than removing it#11914
Conversation
… deprecated shim. The function was removed from src/wp-includes/blocks/navigation-submenu.php in [60810] (Gutenberg PR #74853, wordpress-develop PR WordPress#10865) without a _deprecated_function() notice, causing fatal errors on sites whose themes or plugins call it from a render_block_core/navigation-submenu filter. This restores the function as a thin wrapper that triggers _deprecated_function() and returns block_core_shared_navigation_render_submenu_icon(), the new shared helper that replaced it. Includes a phpunit test asserting the deprecation notice fires and the return value matches the new helper. Props ecairol. See https://core.trac.wordpress.org/ticket/65287.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Closing — wrong repo for this fix. CI surfaced the actual situation: Re-opening as a Gutenberg PR against |
Good call. I guess the deprecation wrapper can be packages/block-library/src/navigation-link/shared/render-submenu-icon.php. Same fix as here. Thank you for handling this! |
I withdraw that. What you've done in WordPress/gutenberg#78484 LGTM. Thanks again |
Summary
block_core_navigation_submenu_render_submenu_icon()was removed fromsrc/wp-includes/blocks/navigation-submenu.phpin [60810] (Gutenberg PR #74853, synced via wordpress-develop PR #10865) as part of consolidating submenu icon rendering into the new shared helperblock_core_shared_navigation_render_submenu_icon().The removal landed without a
_deprecated_function()notice or a backwards-compatible shim, so any theme or plugin that previously called the function — for example from arender_block_core/navigation-submenufilter to customise the dropdown chevron — now triggers a fatal PHP error on 7.0.This PR restores the function as a thin deprecation shim:
_deprecated_function()so callers see actionable guidance to migrate toblock_core_shared_navigation_render_submenu_icon().Trac ticket: https://core.trac.wordpress.org/ticket/65287
Test plan
php -l src/wp-includes/blocks/navigation-submenu.phppasses (verified locally).phpunit --filter Tests_Blocks_NavigationSubmenuRenderSubmenuIconpasses.block_core_navigation_submenu_render_submenu_icon(), the page renders without a fatal and a deprecation notice is logged.Props ecairol.