Changeset 49075
- Timestamp:
- 09/30/2020 01:52:24 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/api.js
r48651 r49075 364 364 * @param {number} modelId The model ID if the object to request 365 365 * @param {string} modelName The model name to use when constructing the model. 366 * @param {string} embedSourcePoint Where to check the embedd sobject for _embed data.366 * @param {string} embedSourcePoint Where to check the embedded object for _embed data. 367 367 * @param {string} embedCheckField Which model field to check to see if the model has data. 368 368 * … … 370 370 */ 371 371 buildModelGetter = function( parentModel, modelId, modelName, embedSourcePoint, embedCheckField ) { 372 var getModel, embedded s, attributes, deferred;373 374 deferred = jQuery.Deferred();375 embedded s = parentModel.get( '_embedded' ) || {};372 var getModel, embeddedObjects, attributes, deferred; 373 374 deferred = jQuery.Deferred(); 375 embeddedObjects = parentModel.get( '_embedded' ) || {}; 376 376 377 377 // Verify that we have a valid object id. … … 382 382 383 383 // If we have embedded object data, use that when constructing the getModel. 384 if ( embedded s[ embedSourcePoint ] ) {385 attributes = _.findWhere( embedded s[ embedSourcePoint ], { id: modelId } );384 if ( embeddedObjects[ embedSourcePoint ] ) { 385 attributes = _.findWhere( embeddedObjects[ embedSourcePoint ], { id: modelId } ); 386 386 } 387 387 … … 417 417 * @param {string} parentModel The parent model. 418 418 * @param {string} collectionName The name to use when constructing the collection. 419 * @param {string} embedSourcePoint Where to check the embedd sobject for _embed data.420 * @param {string} embedIndex An addi itonal optional index for the _embed data.419 * @param {string} embedSourcePoint Where to check the embedded object for _embed data. 420 * @param {string} embedIndex An additional optional index for the _embed data. 421 421 * 422 422 * @return {Deferred.promise} A promise which resolves to the constructed collection. … … 426 426 * Returns a promise that resolves to the requested collection 427 427 * 428 * Uses the embedded data if available, otherwise sfetches the428 * Uses the embedded data if available, otherwise fetches the 429 429 * data from the server. 430 430 * … … 432 432 * collection. 433 433 */ 434 var postId, embedded s, getObjects,434 var postId, embeddedObjects, getObjects, 435 435 classProperties = '', 436 436 properties = '', 437 437 deferred = jQuery.Deferred(); 438 438 439 postId = parentModel.get( 'id' );440 embedded s = parentModel.get( '_embedded' ) || {};439 postId = parentModel.get( 'id' ); 440 embeddedObjects = parentModel.get( '_embedded' ) || {}; 441 441 442 442 // Verify that we have a valid post ID. … … 447 447 448 448 // If we have embedded getObjects data, use that when constructing the getObjects. 449 if ( ! _.isUndefined( embedSourcePoint ) && ! _.isUndefined( embedded s[ embedSourcePoint ] ) ) {449 if ( ! _.isUndefined( embedSourcePoint ) && ! _.isUndefined( embeddedObjects[ embedSourcePoint ] ) ) { 450 450 451 451 // Some embeds also include an index offset, check for that. … … 453 453 454 454 // Use the embed source point directly. 455 properties = embedded s[ embedSourcePoint ];455 properties = embeddedObjects[ embedSourcePoint ]; 456 456 } else { 457 457 458 458 // Add the index to the embed source point. 459 properties = embedded s[ embedSourcePoint ][ embedIndex ];459 properties = embeddedObjects[ embedSourcePoint ][ embedIndex ]; 460 460 } 461 461 } else { … … 1058 1058 } 1059 1059 1060 // Continue by calling Bac ckbone's sync.1060 // Continue by calling Backbone's sync. 1061 1061 return Backbone.sync( method, model, options ); 1062 1062 }, -
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r48982 r49075 494 494 * 495 495 * @type array $_links Links. 496 * @type array $_embedded Embedded s.496 * @type array $_embedded Embedded objects. 497 497 * } 498 498 */ … … 618 618 * 619 619 * @type array $_links Links. 620 * @type array $_embedded Embedded s.620 * @type array $_embedded Embedded objects. 621 621 * } 622 622 */
Note: See TracChangeset
for help on using the changeset viewer.