Make WordPress Core

Changeset 49075


Ignore:
Timestamp:
09/30/2020 01:52:24 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Fix typos in some DocBlocks in js/_enqueues/wp/api.js.

Additionally, rename a variable for clarity.

Props mukesh27.
Fixes #51420.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/api.js

    r48651 r49075  
    364364             * @param {number} modelId          The model ID if the object to request
    365365             * @param {string} modelName        The model name to use when constructing the model.
    366              * @param {string} embedSourcePoint Where to check the embedds object for _embed data.
     366             * @param {string} embedSourcePoint Where to check the embedded object for _embed data.
    367367             * @param {string} embedCheckField  Which model field to check to see if the model has data.
    368368             *
     
    370370             */
    371371            buildModelGetter = function( parentModel, modelId, modelName, embedSourcePoint, embedCheckField ) {
    372                 var getModel, embeddeds, attributes, deferred;
    373 
    374                 deferred  = jQuery.Deferred();
    375                 embeddeds = parentModel.get( '_embedded' ) || {};
     372                var getModel, embeddedObjects, attributes, deferred;
     373
     374                deferred        = jQuery.Deferred();
     375                embeddedObjects = parentModel.get( '_embedded' ) || {};
    376376
    377377                // Verify that we have a valid object id.
     
    382382
    383383                // If we have embedded object data, use that when constructing the getModel.
    384                 if ( embeddeds[ embedSourcePoint ] ) {
    385                     attributes = _.findWhere( embeddeds[ embedSourcePoint ], { id: modelId } );
     384                if ( embeddedObjects[ embedSourcePoint ] ) {
     385                    attributes = _.findWhere( embeddedObjects[ embedSourcePoint ], { id: modelId } );
    386386                }
    387387
     
    417417             * @param {string} parentModel      The parent model.
    418418             * @param {string} collectionName   The name to use when constructing the collection.
    419              * @param {string} embedSourcePoint Where to check the embedds object for _embed data.
    420              * @param {string} embedIndex       An addiitonal 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.
    421421             *
    422422             * @return {Deferred.promise} A promise which resolves to the constructed collection.
     
    426426                 * Returns a promise that resolves to the requested collection
    427427                 *
    428                  * Uses the embedded data if available, otherwises fetches the
     428                 * Uses the embedded data if available, otherwise fetches the
    429429                 * data from the server.
    430430                 *
     
    432432                 * collection.
    433433                 */
    434                 var postId, embeddeds, getObjects,
     434                var postId, embeddedObjects, getObjects,
    435435                    classProperties = '',
    436436                    properties      = '',
    437437                    deferred        = jQuery.Deferred();
    438438
    439                 postId    = parentModel.get( 'id' );
    440                 embeddeds = parentModel.get( '_embedded' ) || {};
     439                postId          = parentModel.get( 'id' );
     440                embeddedObjects = parentModel.get( '_embedded' ) || {};
    441441
    442442                // Verify that we have a valid post ID.
     
    447447
    448448                // If we have embedded getObjects data, use that when constructing the getObjects.
    449                 if ( ! _.isUndefined( embedSourcePoint ) && ! _.isUndefined( embeddeds[ embedSourcePoint ] ) ) {
     449                if ( ! _.isUndefined( embedSourcePoint ) && ! _.isUndefined( embeddedObjects[ embedSourcePoint ] ) ) {
    450450
    451451                    // Some embeds also include an index offset, check for that.
     
    453453
    454454                        // Use the embed source point directly.
    455                         properties = embeddeds[ embedSourcePoint ];
     455                        properties = embeddedObjects[ embedSourcePoint ];
    456456                    } else {
    457457
    458458                        // Add the index to the embed source point.
    459                         properties = embeddeds[ embedSourcePoint ][ embedIndex ];
     459                        properties = embeddedObjects[ embedSourcePoint ][ embedIndex ];
    460460                    }
    461461                } else {
     
    10581058                }
    10591059
    1060                 // Continue by calling Bacckbone's sync.
     1060                // Continue by calling Backbone's sync.
    10611061                return Backbone.sync( method, model, options );
    10621062            },
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r48982 r49075  
    494494     *
    495495     *     @type array $_links    Links.
    496      *     @type array $_embedded Embeddeds.
     496     *     @type array $_embedded Embedded objects.
    497497     * }
    498498     */
     
    618618     *
    619619     *     @type array $_links    Links.
    620      *     @type array $_embedded Embeddeds.
     620     *     @type array $_embedded Embedded objects.
    621621     * }
    622622     */
Note: See TracChangeset for help on using the changeset viewer.