[wp-trac] [WordPress Trac] #35855: Let selective refresh component be required but be opt-in for sidebars/widgets (for now)

WordPress Trac noreply at wordpress.org
Thu Mar 17 16:13:55 UTC 2016


#35855: Let selective refresh component be required but be opt-in for
sidebars/widgets (for now)
----------------------------+--------------------------
 Reporter:  DrewAPicture    |       Owner:  westonruter
     Type:  task (blessed)  |      Status:  accepted
 Priority:  normal          |   Milestone:  4.5
Component:  Customize       |     Version:  trunk
 Severity:  blocker         |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+--------------------------

Comment (by westonruter):

 Replying to [comment:37 grapplerulrich]:
 > If I understand it correctly we are defining if that the widget is
 selective refresh ready using `$widget_ops` in the WP_Widget class. Could
 we not use `register_sidebar()` to define if the sidebar is selective
 refresh ready?

 There are two separate supports flags needed:

 1. A **theme** needs to indicate it supports selective refresh for the
 ''sidebars'' that it defines. Consider Twenty Thirteen which uses Masonry
 for the footer sidebar. For this I am proposing the `add_theme_support()`
 call. It's true that this could be defined at the individual sidebar level
 as a new argument passed into `register_sidebar()`, but I should think
 that “selectively” implementing selective refresh for one sidebar but not
 another wouldn't be something we want to encourage?
 2.  A **widget** needs to indicate it supports selective refresh in the
 common case for widgets that have dynamic elements that have to be
 initialized with JavaScript, such as the Twitter Timeline, Facebook Like
 Box, and Contact Info widgets in Jetpack. This is what the
 `$widget_options` argument for `WP_Widget` is proposed for.

 So selective refresh would be available for previewing a specific widget
 change only if these two conditions are met.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35855#comment:38>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list