WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/02/2014 05:03:14 PM (6 years ago)
Author:
ocean90
Message:

Widget Customizer: Improve plugin compatibility.

Some plugins are using custom scripts and styles for there widgets. These are available on the Widgets screens, but not in the Customizer yet.
Scripts and styles can be enqueued via:

  • admin_enqueue_scripts
  • admin_print_scripts and admin_print_scripts-widgets.php
  • admin_print_styles and admin_print_styles-widgets.php
  • admin_print_footer_scripts and admin_footer-widgets.php

All this hooks are now called in the Customizer too.

Previously we have add the #widgets-right ID to a container div via jQuery. Remember: #widgets-right exists on the Widgets screen and is used by many plugins to do event delegation from that element.
But since our script files are loaded in the footer, the JavaScript way is a bit late for some plugins.
We have decided to add a div#widgets-right container element to customizer. "Less hacky hack."

props westonruter, ocean90. Thanks dpe415 for testing.
fixes #27619.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/customize.php

    r27695 r27907  
    119119        ?>
    120120
     121        <div id="widgets-right"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the customizer for compat -->
    121122        <div class="wp-full-overlay-sidebar-content accordion-container" tabindex="-1">
    122123            <div id="customize-info" class="accordion-section <?php if ( $cannot_expand ) echo ' cannot-expand'; ?>">
     
    147148            </ul></div>
    148149        </div>
     150        </div>
    149151
    150152        <div id="customize-footer-actions" class="wp-full-overlay-footer">
Note: See TracChangeset for help on using the changeset viewer.