<!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>[52184] trunk: REST API: Remove experimental block menu item types.</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/52184">52184</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/52184","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>spacedmonkey</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-11-16 17:07:43 +0000 (Tue, 16 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'>REST API: Remove experimental block menu item types.
The menu items REST API controller was added in <a href="https://core.trac.wordpress.org/changeset/52079">[52079]</a>. This included functionality to add a "block" menu item type. This functionality is experimental and not currently used in WordPress core, so should be removed.
Props noisysocks.
See <a href="https://core.trac.wordpress.org/ticket/40878">#40878</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesnavmenuphp">trunk/src/wp-includes/nav-menu.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestmenuitemscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapiwpRestMenuItemsControllerphp">trunk/tests/phpunit/tests/rest-api/wpRestMenuItemsController.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="trunksrcwpincludesnavmenuphp"></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/nav-menu.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/nav-menu.php 2021-11-16 16:08:03 UTC (rev 52183)
+++ trunk/src/wp-includes/nav-menu.php 2021-11-16 17:07:43 UTC (rev 52184)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -406,11 +406,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Save the properties of a menu item or create a new one.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The menu-item-title, menu-item-description, menu-item-attr-title, and menu-item-content are expected
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The menu-item-title, menu-item-description and menu-item-attr-title are expected
</ins><span class="cx" style="display: block; padding: 0 10px"> * to be pre-slashed since they are passed directly to APIs that expect slashed data.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 5.9.0 Added the menu-item-content parameter.
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $menu_id The ID of the menu. Required. If "0", makes the menu item a draft orphan.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $menu_item_db_id The ID of the menu item. If "0", creates a new menu item.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -449,7 +448,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-attr-title' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-target' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-classes' => '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'menu-item-content' => '',
</del><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-xfn' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-status' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-post-date' => '',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -574,7 +572,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] );
</span><span class="cx" style="display: block; padding: 0 10px"> update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] );
</span><span class="cx" style="display: block; padding: 0 10px"> update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw( $args['menu-item-url'] ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_post_meta( $menu_item_db_id, '_menu_item_content', $args['menu-item-content'] );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 0 == $menu_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> update_post_meta( $menu_item_db_id, '_menu_item_orphaned', (string) time() );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -913,10 +910,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $menu_item->title = ( '' === $menu_item->post_title ) ? $original_title : $menu_item->post_title;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( 'block' === $menu_item->type ) {
- $menu_item->type_label = __( 'Block' );
- $menu_item->title = $menu_item->post_title;
- $menu_item->menu_item_content = ! isset( $menu_item->menu_item_content ) ? get_post_meta( $menu_item->ID, '_menu_item_content', true ) : $menu_item->menu_item_content;
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $menu_item->type_label = __( 'Custom Link' );
</span><span class="cx" style="display: block; padding: 0 10px"> $menu_item->title = $menu_item->post_title;
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestmenuitemscontrollerphp"></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/rest-api/endpoints/class-wp-rest-menu-items-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 2021-11-16 16:08:03 UTC (rev 52183)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 2021-11-16 17:07:43 UTC (rev 52184)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -339,7 +339,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-title' => $menu_item_obj->title,
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-url' => $menu_item_obj->url,
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-description' => $menu_item_obj->description,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'menu-item-content' => $menu_item_obj->menu_item_content,
</del><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-attr-title' => $menu_item_obj->attr_title,
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-target' => $menu_item_obj->target,
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-classes' => $menu_item_obj->classes,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -360,7 +359,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-title' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-url' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-description' => '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'menu-item-content' => '',
</del><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-attr-title' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-target' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> 'menu-item-classes' => array(),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -409,15 +407,6 @@
</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">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Nav menu content.
- if ( ! empty( $schema['properties']['content'] ) && isset( $request['content'] ) ) {
- if ( is_string( $request['content'] ) ) {
- $prepared_nav_item['menu-item-content'] = $request['content'];
- } elseif ( isset( $request['content']['raw'] ) ) {
- $prepared_nav_item['menu-item-content'] = $request['content']['raw'];
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $error = new WP_Error();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Check if object id exists before saving.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -460,11 +449,6 @@
</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">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If menu item is type block, then content is required.
- if ( 'block' === $prepared_nav_item['menu-item-type'] && empty( $prepared_nav_item['menu-item-content'] ) ) {
- $error->add( 'rest_content_required', __( 'The content is required when using a block menu item type.' ), array( 'status' => 400 ) );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( $error->has_errors() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $error;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -566,23 +550,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $data['object_id'] = absint( $menu_item->object_id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( rest_is_field_included( 'content', $fields ) ) {
- $data['content'] = array();
- }
-
- if ( rest_is_field_included( 'content.raw', $fields ) ) {
- $data['content']['raw'] = $menu_item->menu_item_content;
- }
-
- if ( rest_is_field_included( 'content.rendered', $fields ) ) {
- /** This filter is documented in wp-includes/post-template.php */
- $data['content']['rendered'] = apply_filters( 'the_content', $menu_item->menu_item_content );
- }
-
- if ( rest_is_field_included( 'content.block_version', $fields ) ) {
- $data['content']['block_version'] = block_version( $menu_item->menu_item_content );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( rest_is_field_included( 'parent', $fields ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Same as post_parent, exposed as an integer.
</span><span class="cx" style="display: block; padding: 0 10px"> $data['parent'] = (int) $menu_item->menu_item_parent;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -781,7 +748,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $schema['properties']['type'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'The family of objects originally represented, such as "post_type" or "taxonomy".' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'enum' => array( 'taxonomy', 'post_type', 'post_type_archive', 'custom', 'block' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'enum' => array( 'taxonomy', 'post_type', 'post_type_archive', 'custom' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'context' => array( 'view', 'edit', 'embed' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'custom',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -859,31 +826,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => 0,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $schema['properties']['content'] = array(
- 'description' => __( 'HTML content to display for this block menu item.' ),
- 'context' => array( 'view', 'edit', 'embed' ),
- 'type' => array( 'string', 'object' ),
- 'properties' => array(
- 'raw' => array(
- 'description' => __( 'HTML content, as it exists in the database.' ),
- 'type' => 'string',
- 'context' => array( 'edit' ),
- ),
- 'rendered' => array(
- 'description' => __( 'HTML content, transformed for display.' ),
- 'type' => 'string',
- 'context' => array( 'view', 'edit' ),
- 'readonly' => true,
- ),
- 'block_version' => array(
- 'description' => __( 'Version of the block format used in the HTML content.' ),
- 'type' => 'integer',
- 'context' => array( 'edit' ),
- 'readonly' => true,
- ),
- ),
- );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $schema['properties']['target'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'The target attribute of the link element for this menu item.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapiwpRestMenuItemsControllerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php 2021-11-16 16:08:03 UTC (rev 52183)
+++ trunk/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php 2021-11-16 17:07:43 UTC (rev 52184)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -608,49 +608,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"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Tests that a block menu item can be created.
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @ticket 40878
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @covers ::create_item
- */
- public function test_create_item_block() {
- wp_set_current_user( self::$admin_id );
- $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
- $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
- $params = $this->set_menu_item_data(
- array(
- 'type' => 'block',
- 'content' => '<!-- wp:paragraph --><p>Block content</p><!-- /wp:paragraph -->',
- )
- );
- $request->set_body_params( $params );
- $response = rest_get_server()->dispatch( $request );
-
- $this->check_create_menu_item_response( $response );
- }
-
- /**
- * Tests that a block menu item can be created.
- *
- * @ticket 40878
- * @covers ::create_item
- */
- public function test_create_item_invalid_block_content() {
- wp_set_current_user( self::$admin_id );
- $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
- $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
- $params = $this->set_menu_item_data(
- array(
- 'type' => 'block',
- )
- );
- $request->set_body_params( $params );
- $response = rest_get_server()->dispatch( $request );
- $this->assertErrorResponse( 'rest_content_required', $response, 400 );
- }
-
- /**
- * @ticket 40878
</del><span class="cx" style="display: block; padding: 0 10px"> * @covers ::update_item
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_update_item() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -683,43 +641,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 40878
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers ::update_item
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function test_update_item_preserves_type() {
- wp_set_current_user( self::$admin_id );
-
- $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $this->menu_item_id ) );
- $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
- $params = array(
- 'status' => 'draft',
- 'type' => 'block',
- 'title' => 'TEST',
- 'content' => '<!-- wp:paragraph --><p>Block content</p><!-- /wp:paragraph -->',
- );
- $request->set_body_params( $params );
- $response = rest_get_server()->dispatch( $request );
- $this->check_update_menu_item_response( $response );
- $new_data = $response->get_data();
- $this->assertSame( 'block', $new_data['type'] );
-
- $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $this->menu_item_id ) );
- $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
- $params = array(
- 'status' => 'draft',
- 'title' => 'TEST2',
- 'content' => '<!-- wp:paragraph --><p>Block content</p><!-- /wp:paragraph -->',
- );
- $request->set_body_params( $params );
- $response = rest_get_server()->dispatch( $request );
- $this->check_update_menu_item_response( $response );
- $new_data = $response->get_data();
-
- // The type shouldn't change just because it was missing from request args.
- $this->assertSame( 'block', $new_data['type'] );
- }
-
- /**
- * @ticket 40878
- * @covers ::update_item
- */
</del><span class="cx" style="display: block; padding: 0 10px"> public function test_update_item_clean_xfn() {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( self::$admin_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -825,12 +746,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $response = rest_get_server()->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> $properties = $data['schema']['properties'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertSame( 19, count( $properties ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertSame( 18, count( $properties ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'type_label', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'attr_title', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'classes', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'description', $properties );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertArrayHasKey( 'content', $properties );
</del><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'id', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'url', $properties );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'meta', $properties );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -957,20 +877,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( isset( $data['title'] ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Check content.
- if ( 'block' === $data['type'] ) {
- $menu_item_content = get_post_meta( $post->ID, '_menu_item_content', true );
- $this->assertSame( apply_filters( 'the_content', $menu_item_content ), $data['content']['rendered'] );
- if ( 'edit' === $context ) {
- $this->assertSame( $menu_item_content, $data['content']['raw'] );
- } else {
- $this->assertFalse( isset( $data['title']['raw'] ) );
- }
- $this->assertSame( 1, $data['content']['block_version'] );
- } else {
- $this->assertEmpty( $data['content']['rendered'] );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> // post_parent.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey( 'parent', $data );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $post->post_parent ) {
</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-16 16:08:03 UTC (rev 52183)
+++ trunk/tests/qunit/fixtures/wp-api-generated.js 2021-11-16 17:07:43 UTC (rev 52184)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3705,8 +3705,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "taxonomy",
</span><span class="cx" style="display: block; padding: 0 10px"> "post_type",
</span><span class="cx" style="display: block; padding: 0 10px"> "post_type_archive",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "custom",
- "block"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "custom"
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> "required": false
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3767,40 +3766,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "minimum": 0,
</span><span class="cx" style="display: block; padding: 0 10px"> "required": false
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "content": {
- "description": "HTML content to display for this block menu item.",
- "type": [
- "string",
- "object"
- ],
- "properties": {
- "raw": {
- "description": "HTML content, as it exists in the database.",
- "type": "string",
- "context": [
- "edit"
- ]
- },
- "rendered": {
- "description": "HTML content, transformed for display.",
- "type": "string",
- "context": [
- "view",
- "edit"
- ],
- "readonly": true
- },
- "block_version": {
- "description": "Version of the block format used in the HTML content.",
- "type": "integer",
- "context": [
- "edit"
- ],
- "readonly": true
- }
- },
- "required": false
- },
</del><span class="cx" style="display: block; padding: 0 10px"> "target": {
</span><span class="cx" style="display: block; padding: 0 10px"> "description": "The target attribute of the link element for this menu item.",
</span><span class="cx" style="display: block; padding: 0 10px"> "type": "string",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3931,8 +3896,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "taxonomy",
</span><span class="cx" style="display: block; padding: 0 10px"> "post_type",
</span><span class="cx" style="display: block; padding: 0 10px"> "post_type_archive",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "custom",
- "block"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "custom"
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> "required": false
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3989,40 +3953,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "minimum": 0,
</span><span class="cx" style="display: block; padding: 0 10px"> "required": false
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "content": {
- "description": "HTML content to display for this block menu item.",
- "type": [
- "string",
- "object"
- ],
- "properties": {
- "raw": {
- "description": "HTML content, as it exists in the database.",
- "type": "string",
- "context": [
- "edit"
- ]
- },
- "rendered": {
- "description": "HTML content, transformed for display.",
- "type": "string",
- "context": [
- "view",
- "edit"
- ],
- "readonly": true
- },
- "block_version": {
- "description": "Version of the block format used in the HTML content.",
- "type": "integer",
- "context": [
- "edit"
- ],
- "readonly": true
- }
- },
- "required": false
- },
</del><span class="cx" style="display: block; padding: 0 10px"> "target": {
</span><span class="cx" style="display: block; padding: 0 10px"> "description": "The target attribute of the link element for this menu item.",
</span><span class="cx" style="display: block; padding: 0 10px"> "type": "string",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4157,8 +4087,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "taxonomy",
</span><span class="cx" style="display: block; padding: 0 10px"> "post_type",
</span><span class="cx" style="display: block; padding: 0 10px"> "post_type_archive",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "custom",
- "block"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "custom"
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> "required": false
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4209,40 +4138,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "minimum": 0,
</span><span class="cx" style="display: block; padding: 0 10px"> "required": false
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "content": {
- "description": "HTML content to display for this block menu item.",
- "type": [
- "string",
- "object"
- ],
- "properties": {
- "raw": {
- "description": "HTML content, as it exists in the database.",
- "type": "string",
- "context": [
- "edit"
- ]
- },
- "rendered": {
- "description": "HTML content, transformed for display.",
- "type": "string",
- "context": [
- "view",
- "edit"
- ],
- "readonly": true
- },
- "block_version": {
- "description": "Version of the block format used in the HTML content.",
- "type": "integer",
- "context": [
- "edit"
- ],
- "readonly": true
- }
- },
- "required": false
- },
</del><span class="cx" style="display: block; padding: 0 10px"> "target": {
</span><span class="cx" style="display: block; padding: 0 10px"> "description": "The target attribute of the link element for this menu item.",
</span><span class="cx" style="display: block; padding: 0 10px"> "type": "string",
</span></span></pre>
</div>
</div>
</body>
</html>