-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Navigation: Fallback to a classic menu if one is available (#44173)
* Navigation: Fallback to a classic menu if one is availiable * only use classic menus if there is one * only import classic menus if there's only one of them * fix gutenberg_convert_menu_items_to_blocks * refactor * only create navigation once, and create it published * remove the code that makes the block dirty * convert navigation with submenu items correctly * php lint * use a different function to convert classic menus to blocks * add error handling * Update packages/block-library/src/navigation/index.php Co-authored-by: Dave Smith <getdavemail@gmail.com> * Update packages/block-library/src/navigation/index.php Co-authored-by: Dave Smith <getdavemail@gmail.com> * Update packages/block-library/src/navigation/index.php Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com> * pass second param as true * Use existing classic menu conversion state * Update packages/block-library/src/navigation/edit/index.js Co-authored-by: Dave Smith <getdavemail@gmail.com> * rename function * Fixes multiple menu creation on import. Also: - refactores the effects for block menu fallback and classic menu fallback Co-authored-by: Dave Smith <444434+getdave@users.noreply.github.com> Co-authored-by: Ben Dwyer <275961+scruffian@users.noreply.github.com> * return early when we won't continue * a comment about where the duplicated code starts * Update packages/block-library/src/navigation/index.php Co-authored-by: Dave Smith <getdavemail@gmail.com> * Update packages/block-library/src/navigation/index.php Co-authored-by: Dave Smith <getdavemail@gmail.com> * make the callback from the useEffect return a function not a promise * remove await as this doesn't need to be async * Prevent classic menus from importing twice' * revert unnecessary changes * lint fix * Rename variable for clarity * Fix var rename * Reset the menu id on error * Revert testing code * serialize blocks in the function that gets the classic menu Co-authored-by: Dave Smith <getdavemail@gmail.com> Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com> Co-authored-by: Andrei Draganescu <andrei.draganescu@automattic.com> Co-authored-by: Dave Smith <444434+getdave@users.noreply.github.com> Co-authored-by: Ben Dwyer <275961+scruffian@users.noreply.github.com>
- Loading branch information
1 parent
7f3993f
commit 8e0515c
Showing
4 changed files
with
181 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters