<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[52145] trunk: Editor: Add Navigation Area infrastructure</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/52145">52145</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/52145","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>noisysocks</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-11-12 03:53:18 +0000 (Fri, 12 Nov 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Editor: Add Navigation Area infrastructure
Copies Navigation Area infrastrucutre from lib/navigation.php in Gutenberg. This
allows a Navigation block to be associated with a particular area which persists
when switching theme.
Props antonvlasenko, mamaduka, spacedmonkey.
See <a href="https://core.trac.wordpress.org/ticket/54337">#54337</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludespostphp">trunk/src/wp-admin/includes/post.php</a></li>
<li><a href="#trunksrcwpadminsiteeditorphp">trunk/src/wp-admin/site-editor.php</a></li>
<li><a href="#trunksrcwpincludesdefaultfiltersphp">trunk/src/wp-includes/default-filters.php</a></li>
<li><a href="#trunksrcwpincludesnavigationareasphp">trunk/src/wp-includes/navigation-areas.php</a></li>
<li><a href="#trunksrcwpincludespostphp">trunk/src/wp-includes/post.php</a></li>
<li><a href="#trunktestsqunitfixtureswpapigeneratedjs">trunk/tests/qunit/fixtures/wp-api-generated.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludespostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/post.php 2021-11-12 01:08:35 UTC (rev 52144)
+++ trunk/src/wp-admin/includes/post.php 2021-11-12 03:53:18 UTC (rev 52145)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2447,3 +2447,63 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'block_editor_meta_box_hidden_fields', $post );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Disable block editor for wp_navigation type posts so they can be managed via the UI.
+ *
+ * @since 5.9.0
+ * @access private
+ *
+ * @param bool $value Whether the CPT supports block editor or not.
+ * @param string $post_type Post type.
+ *
+ * @return bool
+ */
+function _disable_block_editor_for_navigation_post_type( $value, $post_type ) {
+ if ( 'wp_navigation' === $post_type ) {
+ return false;
+ }
+
+ return $value;
+}
+
+/**
+ * This callback disables the content editor for wp_navigation type posts.
+ * Content editor cannot handle wp_navigation type posts correctly.
+ * We cannot disable the "editor" feature in the wp_navigation's CPT definition
+ * because it disables the ability to save navigation blocks via REST API.
+ *
+ * @since 5.9.0
+ * @access private
+ *
+ * @param WP_Post $post An instance of WP_Post class.
+ */
+function _disable_content_editor_for_navigation_post_type( $post ) {
+ $post_type = get_post_type( $post );
+ if ( 'wp_navigation' !== $post_type ) {
+ return;
+ }
+
+ remove_post_type_support( $post_type, 'editor' );
+}
+
+/**
+ * This callback enables content editor for wp_navigation type posts.
+ * We need to enable it back because we disable it to hide
+ * the content editor for wp_navigation type posts.
+ *
+ * @since 5.9.0
+ * @access private
+ *
+ * @see _disable_content_editor_for_navigation_post_type
+ *
+ * @param WP_Post $post An instance of WP_Post class.
+ */
+function _enable_content_editor_for_navigation_post_type( $post ) {
+ $post_type = get_post_type( $post );
+ if ( 'wp_navigation' !== $post_type ) {
+ return;
+ }
+
+ add_post_type_support( $post_type, 'editor' );
+}
</ins></span></pre></div>
<a id="trunksrcwpadminsiteeditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/site-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/site-editor.php 2021-11-12 01:08:35 UTC (rev 52144)
+++ trunk/src/wp-admin/site-editor.php 2021-11-12 03:53:18 UTC (rev 52145)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -59,7 +59,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/global-styles/' . $active_global_styles_id,
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/themes/' . $active_theme . '/global-styles',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/block-navigation-areas?context=edit',
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+$areas = get_option( 'fse_navigation_areas', array() );
+$active_areas = array_intersect_key( $areas, get_navigation_areas() );
+foreach ( $active_areas as $post_id ) {
+ if ( $post_id ) {
+ $preload_paths[] = add_query_args( 'context', 'edit', rest_get_route_for_post( $post_id ) );
+ }
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> block_editor_rest_api_preload( $preload_paths, $block_editor_context );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $editor_settings = get_block_editor_settings(
</span></span></pre></div>
<a id="trunksrcwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/default-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/default-filters.php 2021-11-12 01:08:35 UTC (rev 52144)
+++ trunk/src/wp-includes/default-filters.php 2021-11-12 03:53:18 UTC (rev 52145)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -583,6 +583,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_footer-post-new.php', 'wp_add_iframed_editor_assets_html' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_footer-widgets.php', 'wp_add_iframed_editor_assets_html' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'use_block_editor_for_post_type', '_disable_block_editor_for_navigation_post_type', 10, 2 );
+add_action( 'edit_form_after_title', '_disable_content_editor_for_navigation_post_type' );
+add_action( 'edit_form_after_editor', '_enable_content_editor_for_navigation_post_type' );
+
+/*
+ * Disable "Post Attributes" for wp_navigation post type. The attributes are
+ * also conditionally enabled when a site has custom templates. Block Theme
+ * templates can be available for every post type.
+ */
+add_filter( 'theme_wp_navigation_templates', '__return_empty_array' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Taxonomy.
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init', 'create_initial_taxonomies', 0 ); // Highest priority.
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'change_locale', 'create_initial_taxonomies' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -670,6 +681,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'setup_theme', 'wp_enable_block_templates' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Navigation areas.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_action( 'setup_theme', '_register_default_navigation_areas' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'setup_theme', '_wp_register_default_navigation_areas' );
+add_action( 'switch_theme', '_wp_migrate_menu_to_navigation_post', 99, 3 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $filter, $action );
</span></span></pre></div>
<a id="trunksrcwpincludesnavigationareasphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/navigation-areas.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/navigation-areas.php 2021-11-12 01:08:35 UTC (rev 52144)
+++ trunk/src/wp-includes/navigation-areas.php 2021-11-12 03:53:18 UTC (rev 52145)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,7 +29,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function _register_default_navigation_areas() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _wp_register_default_navigation_areas() {
</ins><span class="cx" style="display: block; padding: 0 10px"> register_navigation_areas(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'primary' => _x( 'Primary', 'navigation area' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,3 +50,208 @@
</span><span class="cx" style="display: block; padding: 0 10px"> global $navigation_areas;
</span><span class="cx" style="display: block; padding: 0 10px"> return $navigation_areas;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Migrates classic menus to a block-based navigation post on theme switch.
+ * Assigns the created navigation post to the corresponding navigation area.
+ *
+ * @since 5.9.0
+ * @access private
+ *
+ * @param string $new_name Name of the new theme.
+ * @param WP_Theme $new_theme New theme.
+ * @param WP_Theme $old_theme Old theme.
+ */
+function _wp_migrate_menu_to_navigation_post( $new_name, WP_Theme $new_theme, WP_Theme $old_theme ) {
+ // Do nothing when switching to a theme that does not support site editor.
+ if ( ! wp_is_block_template_theme() ) {
+ return;
+ }
+
+ // get_nav_menu_locations() calls get_theme_mod() which depends on the stylesheet option.
+ // At the same time, switch_theme runs only after the stylesheet option was updated to $new_theme.
+ // To retrieve theme mods of the old theme, the getter is hooked to get_option( 'stylesheet' ) so that we
+ // get the old theme, which causes the get_nav_menu_locations to get the locations of the old theme.
+ $get_old_theme_stylesheet = static function() use ( $old_theme ) {
+ return $old_theme->get_stylesheet();
+ };
+ add_filter( 'option_stylesheet', $get_old_theme_stylesheet );
+
+ $locations = get_nav_menu_locations();
+ $area_mapping = get_option( 'fse_navigation_areas', array() );
+
+ foreach ( $locations as $location_name => $menu_id ) {
+ // Get the menu from the location, skipping if there is no
+ // menu or there was an error.
+ $menu = wp_get_nav_menu_object( $menu_id );
+ if ( ! $menu || is_wp_error( $menu ) ) {
+ continue;
+ }
+
+ $menu_items = _wp_get_menu_items_at_location( $location_name );
+ if ( empty( $menu_items ) ) {
+ continue;
+ }
+
+ $post_name = 'classic_menu_' . $menu_id;
+
+ // Get or create to avoid creating too many wp_navigation posts.
+ $query = new WP_Query;
+ $matching_posts = $query->query(
+ array(
+ 'name' => $post_name,
+ 'post_status' => 'publish',
+ 'post_type' => 'wp_navigation',
+ 'posts_per_page' => 1,
+ 'fields' => 'ids',
+ )
+ );
+
+ if ( ! empty( $matching_posts ) ) {
+ $navigation_post_id = $matching_posts[0]->ID;
+ } else {
+ $menu_items_by_parent_id = _wp_sort_menu_items_by_parent_id( $menu_items );
+ $parsed_blocks = _wp_parse_blocks_from_menu_items( $menu_items_by_parent_id[0], $menu_items_by_parent_id );
+ $post_data = array(
+ 'post_type' => 'wp_navigation',
+ 'post_title' => sprintf(
+ /* translators: %s: the name of the menu, e.g. "Main Menu". */
+ __( 'Classic menu: %s' ),
+ $menu->name
+ ),
+ 'post_name' => $post_name,
+ 'post_content' => serialize_blocks( $parsed_blocks ),
+ 'post_status' => 'publish',
+ );
+ $navigation_post_id = wp_insert_post( $post_data );
+ }
+
+ $area_mapping[ $location_name ] = $navigation_post_id;
+ }
+ remove_filter( 'option_stylesheet', $get_old_theme_stylesheet );
+
+ update_option( 'fse_navigation_areas', $area_mapping );
+}
+
+/**
+ * Returns the menu items for a WordPress menu location.
+ *
+ * @since 5.9.0
+ * @access private
+ *
+ * @param string $location The menu location.
+ * @return array Menu items for the location.
+ */
+function _wp_get_menu_items_at_location( $location ) {
+ if ( empty( $location ) ) {
+ return;
+ }
+
+ // Build menu data. The following approximates the code in `wp_nav_menu()`.
+
+ // Find the location in the list of locations, returning early if the
+ // location can't be found.
+ $locations = get_nav_menu_locations();
+ if ( ! isset( $locations[ $location ] ) ) {
+ return;
+ }
+
+ // Get the menu from the location, returning early if there is no
+ // menu or there was an error.
+ $menu = wp_get_nav_menu_object( $locations[ $location ] );
+ if ( ! $menu || is_wp_error( $menu ) ) {
+ return;
+ }
+
+ $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
+ _wp_menu_item_classes_by_context( $menu_items );
+
+ return $menu_items;
+}
+
+/**
+ * Sorts a standard array of menu items into a nested structure keyed by the
+ * id of the parent menu.
+ *
+ * @since 5.9.0
+ * @access private
+ *
+ * @param array $menu_items Menu items to sort.
+ * @return array An array keyed by the id of the parent menu where each element
+ * is an array of menu items that belong to that parent.
+ */
+function _wp_sort_menu_items_by_parent_id( $menu_items ) {
+ $sorted_menu_items = array();
+ foreach ( $menu_items as $menu_item ) {
+ $sorted_menu_items[ $menu_item->menu_order ] = $menu_item;
+ }
+ unset( $menu_items, $menu_item );
+
+ $menu_items_by_parent_id = array();
+ foreach ( $sorted_menu_items as $menu_item ) {
+ $menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item;
+ }
+
+ return $menu_items_by_parent_id;
+}
+
+/**
+ * Turns menu item data into a nested array of parsed blocks
+ *
+ * @since 5.9.0
+ * @access private
+ *
+ * @param array $menu_items An array of menu items that represent
+ * an individual level of a menu.
+ * @param array $menu_items_by_parent_id An array keyed by the id of the
+ * parent menu where each element is an
+ * array of menu items that belong to
+ * that parent.
+ * @return array An array of parsed block data.
+ */
+function _wp_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
+ if ( empty( $menu_items ) ) {
+ return array();
+ }
+
+ $blocks = array();
+
+ foreach ( $menu_items as $menu_item ) {
+ $class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null;
+ $id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null;
+ $opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target;
+ $rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null;
+ $kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom';
+
+ $block = array(
+ 'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link',
+ 'attrs' => array(
+ 'className' => $class_name,
+ 'description' => $menu_item->description,
+ 'id' => $id,
+ 'kind' => $kind,
+ 'label' => $menu_item->title,
+ 'opensInNewTab' => $opens_in_new_tab,
+ 'rel' => $rel,
+ 'title' => $menu_item->attr_title,
+ 'type' => $menu_item->object,
+ 'url' => $menu_item->url,
+ ),
+ );
+
+ if ( isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ) {
+ $block['innerBlocks'] = _wp_parse_blocks_from_menu_items(
+ $menu_items_by_parent_id[ $menu_item->ID ],
+ $menu_items_by_parent_id
+ );
+ } else {
+ $block['innerBlocks'] = array();
+ }
+
+ $block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] );
+
+ $blocks[] = $block;
+ }
+
+ return $blocks;
+}
</ins></span></pre></div>
<a id="trunksrcwpincludespostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/post.php 2021-11-12 01:08:35 UTC (rev 52144)
+++ trunk/src/wp-includes/post.php 2021-11-12 03:53:18 UTC (rev 52145)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -480,13 +480,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'labels' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'name' => __( 'Navigation Menus' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'singular_name' => __( 'Navigation Menu' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'menu_name' => _x( 'Navigation Menus', 'Admin Menu text' ),
</del><span class="cx" style="display: block; padding: 0 10px"> 'add_new' => _x( 'Add New', 'Navigation Menu' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'add_new_item' => __( 'Add New Navigation Menu' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'new_item' => __( 'New Navigation Menu' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'edit_item' => __( 'Edit Navigation Menu' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'view_item' => __( 'View Navigation Menu' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'all_items' => __( 'All Navigation Menus' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'all_items' => __( 'Navigation Menus' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'search_items' => __( 'Search Navigation Menus' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'parent_item_colon' => __( 'Parent Navigation Menu:' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'not_found' => __( 'No Navigation Menu found.' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -494,15 +493,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'archives' => __( 'Navigation Menu archives' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'insert_into_item' => __( 'Insert into Navigation Menu' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'uploaded_to_this_item' => __( 'Uploaded to this Navigation Menu' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Some of these are a bit weird, what are they for?
</del><span class="cx" style="display: block; padding: 0 10px"> 'filter_items_list' => __( 'Filter Navigation Menu list' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'items_list_navigation' => __( 'Navigation Menus list navigation' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'items_list' => __( 'Navigation Menus list' ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'description' => __( 'Navigation menus that can be inserted into your site.' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'public' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
</span><span class="cx" style="display: block; padding: 0 10px"> 'has_archive' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'show_ui' => false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'show_ui' => wp_is_block_template_theme(),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'show_in_menu' => 'themes.php',
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_in_admin_bar' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_in_rest' => true,
</span></span></pre></div>
<a id="trunktestsqunitfixtureswpapigeneratedjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/qunit/fixtures/wp-api-generated.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/fixtures/wp-api-generated.js 2021-11-12 01:08:35 UTC (rev 52144)
+++ trunk/tests/qunit/fixtures/wp-api-generated.js 2021-11-12 03:53:18 UTC (rev 52145)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11445,7 +11445,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "wp_navigation": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "description": "",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "description": "Navigation menus that can be inserted into your site.",
</ins><span class="cx" style="display: block; padding: 0 10px"> "hierarchical": false,
</span><span class="cx" style="display: block; padding: 0 10px"> "name": "Navigation Menus",
</span><span class="cx" style="display: block; padding: 0 10px"> "slug": "wp_navigation",
</span></span></pre>
</div>
</div>
</body>
</html>