Docs: Fix typos in some DocBlocks in `js/_enqueues/wp/api.js`.
Additionally, rename a variable for clarity. Props mukesh27. Fixes #51420. Built from https://develop.svn.wordpress.org/trunk@49075 git-svn-id: http://core.svn.wordpress.org/trunk@48837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
36c3a480c8
commit
09570be924
|
@ -363,16 +363,16 @@
|
||||||
* @param {string} parentModel The parent model.
|
* @param {string} parentModel The parent model.
|
||||||
* @param {number} modelId The model ID if the object to request
|
* @param {number} modelId The model ID if the object to request
|
||||||
* @param {string} modelName The model name to use when constructing the model.
|
* @param {string} modelName The model name to use when constructing the model.
|
||||||
* @param {string} embedSourcePoint Where to check the embedds object for _embed data.
|
* @param {string} embedSourcePoint Where to check the embedded object for _embed data.
|
||||||
* @param {string} embedCheckField Which model field to check to see if the model has data.
|
* @param {string} embedCheckField Which model field to check to see if the model has data.
|
||||||
*
|
*
|
||||||
* @return {Deferred.promise} A promise which resolves to the constructed model.
|
* @return {Deferred.promise} A promise which resolves to the constructed model.
|
||||||
*/
|
*/
|
||||||
buildModelGetter = function( parentModel, modelId, modelName, embedSourcePoint, embedCheckField ) {
|
buildModelGetter = function( parentModel, modelId, modelName, embedSourcePoint, embedCheckField ) {
|
||||||
var getModel, embeddeds, attributes, deferred;
|
var getModel, embeddedObjects, attributes, deferred;
|
||||||
|
|
||||||
deferred = jQuery.Deferred();
|
deferred = jQuery.Deferred();
|
||||||
embeddeds = parentModel.get( '_embedded' ) || {};
|
embeddedObjects = parentModel.get( '_embedded' ) || {};
|
||||||
|
|
||||||
// Verify that we have a valid object id.
|
// Verify that we have a valid object id.
|
||||||
if ( ! _.isNumber( modelId ) || 0 === modelId ) {
|
if ( ! _.isNumber( modelId ) || 0 === modelId ) {
|
||||||
|
@ -381,8 +381,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have embedded object data, use that when constructing the getModel.
|
// If we have embedded object data, use that when constructing the getModel.
|
||||||
if ( embeddeds[ embedSourcePoint ] ) {
|
if ( embeddedObjects[ embedSourcePoint ] ) {
|
||||||
attributes = _.findWhere( embeddeds[ embedSourcePoint ], { id: modelId } );
|
attributes = _.findWhere( embeddedObjects[ embedSourcePoint ], { id: modelId } );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise use the modelId.
|
// Otherwise use the modelId.
|
||||||
|
@ -416,8 +416,8 @@
|
||||||
*
|
*
|
||||||
* @param {string} parentModel The parent model.
|
* @param {string} parentModel The parent model.
|
||||||
* @param {string} collectionName The name to use when constructing the collection.
|
* @param {string} collectionName The name to use when constructing the collection.
|
||||||
* @param {string} embedSourcePoint Where to check the embedds object for _embed data.
|
* @param {string} embedSourcePoint Where to check the embedded object for _embed data.
|
||||||
* @param {string} embedIndex An addiitonal optional index for the _embed data.
|
* @param {string} embedIndex An additional optional index for the _embed data.
|
||||||
*
|
*
|
||||||
* @return {Deferred.promise} A promise which resolves to the constructed collection.
|
* @return {Deferred.promise} A promise which resolves to the constructed collection.
|
||||||
*/
|
*/
|
||||||
|
@ -425,19 +425,19 @@
|
||||||
/**
|
/**
|
||||||
* Returns a promise that resolves to the requested collection
|
* Returns a promise that resolves to the requested collection
|
||||||
*
|
*
|
||||||
* Uses the embedded data if available, otherwises fetches the
|
* Uses the embedded data if available, otherwise fetches the
|
||||||
* data from the server.
|
* data from the server.
|
||||||
*
|
*
|
||||||
* @return {Deferred.promise} promise Resolves to a wp.api.collections[ collectionName ]
|
* @return {Deferred.promise} promise Resolves to a wp.api.collections[ collectionName ]
|
||||||
* collection.
|
* collection.
|
||||||
*/
|
*/
|
||||||
var postId, embeddeds, getObjects,
|
var postId, embeddedObjects, getObjects,
|
||||||
classProperties = '',
|
classProperties = '',
|
||||||
properties = '',
|
properties = '',
|
||||||
deferred = jQuery.Deferred();
|
deferred = jQuery.Deferred();
|
||||||
|
|
||||||
postId = parentModel.get( 'id' );
|
postId = parentModel.get( 'id' );
|
||||||
embeddeds = parentModel.get( '_embedded' ) || {};
|
embeddedObjects = parentModel.get( '_embedded' ) || {};
|
||||||
|
|
||||||
// Verify that we have a valid post ID.
|
// Verify that we have a valid post ID.
|
||||||
if ( ! _.isNumber( postId ) || 0 === postId ) {
|
if ( ! _.isNumber( postId ) || 0 === postId ) {
|
||||||
|
@ -446,17 +446,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have embedded getObjects data, use that when constructing the getObjects.
|
// If we have embedded getObjects data, use that when constructing the getObjects.
|
||||||
if ( ! _.isUndefined( embedSourcePoint ) && ! _.isUndefined( embeddeds[ embedSourcePoint ] ) ) {
|
if ( ! _.isUndefined( embedSourcePoint ) && ! _.isUndefined( embeddedObjects[ embedSourcePoint ] ) ) {
|
||||||
|
|
||||||
// Some embeds also include an index offset, check for that.
|
// Some embeds also include an index offset, check for that.
|
||||||
if ( _.isUndefined( embedIndex ) ) {
|
if ( _.isUndefined( embedIndex ) ) {
|
||||||
|
|
||||||
// Use the embed source point directly.
|
// Use the embed source point directly.
|
||||||
properties = embeddeds[ embedSourcePoint ];
|
properties = embeddedObjects[ embedSourcePoint ];
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Add the index to the embed source point.
|
// Add the index to the embed source point.
|
||||||
properties = embeddeds[ embedSourcePoint ][ embedIndex ];
|
properties = embeddedObjects[ embedSourcePoint ][ embedIndex ];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1057,7 +1057,7 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Continue by calling Bacckbone's sync.
|
// Continue by calling Backbone's sync.
|
||||||
return Backbone.sync( method, model, options );
|
return Backbone.sync( method, model, options );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -493,7 +493,7 @@ class WP_REST_Server {
|
||||||
* Data with sub-requests embedded.
|
* Data with sub-requests embedded.
|
||||||
*
|
*
|
||||||
* @type array $_links Links.
|
* @type array $_links Links.
|
||||||
* @type array $_embedded Embeddeds.
|
* @type array $_embedded Embedded objects.
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
public function response_to_data( $response, $embed ) {
|
public function response_to_data( $response, $embed ) {
|
||||||
|
@ -617,7 +617,7 @@ class WP_REST_Server {
|
||||||
* Data with sub-requests embedded.
|
* Data with sub-requests embedded.
|
||||||
*
|
*
|
||||||
* @type array $_links Links.
|
* @type array $_links Links.
|
||||||
* @type array $_embedded Embeddeds.
|
* @type array $_embedded Embedded objects.
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
protected function embed_links( $data, $embed = true ) {
|
protected function embed_links( $data, $embed = true ) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.6-alpha-49074';
|
$wp_version = '5.6-alpha-49075';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue