Make WordPress Core


Ignore:
Timestamp:
08/31/2021 07:57:20 PM (3 years ago)
Author:
hellofromTonya
Message:

Widgets: Rename and soft deprecate retrieve_widgets().

The original name retrieve_widgets() was unclear as it suggested it was a getter, i.e. getting the widgets. This function does more than get: finds orphaned widgets, assigns them to the inactive sidebar, and updates the database.

The new name is sync_registered_widgets() which better represents what happens when this function is invoked.

The original retrieve_widgets() function is soft deprecated to avoid unnecessary code churn downstream for developers that support more than the latest version of WordPress.

Follow-up to [18630].

Props zieladam, timothyblynjacobs, andraganescu, hellofromTonya.
See #53811.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php

    r51657 r51705  
    110110     */
    111111    public function get_items( $request ) {
    112         retrieve_widgets();
     112        sync_registered_widgets();
    113113
    114114        $prepared = array();
     
    152152     */
    153153    public function get_item( $request ) {
    154         retrieve_widgets();
     154        sync_registered_widgets();
    155155
    156156        $widget_id  = $request['id'];
     
    238238
    239239        /*
    240          * retrieve_widgets() contains logic to move "hidden" or "lost" widgets to the
     240         * sync_registered_widgets() contains logic to move "hidden" or "lost" widgets to the
    241241         * wp_inactive_widgets sidebar based on the contents of the $sidebars_widgets global.
    242242         *
     
    249249        wp_get_sidebars_widgets();
    250250
    251         retrieve_widgets();
     251        sync_registered_widgets();
    252252
    253253        $widget_id  = $request['id'];
     
    314314
    315315        /*
    316          * retrieve_widgets() contains logic to move "hidden" or "lost" widgets to the
     316         * sync_registered_widgets() contains logic to move "hidden" or "lost" widgets to the
    317317         * wp_inactive_widgets sidebar based on the contents of the $sidebars_widgets global.
    318318         *
     
    325325        wp_get_sidebars_widgets();
    326326
    327         retrieve_widgets();
     327        sync_registered_widgets();
    328328
    329329        $widget_id  = $request['id'];
Note: See TracChangeset for help on using the changeset viewer.