[wp-trac] [WordPress Trac] #32474: Facilitate widgets to be stored in posts instead of options

WordPress Trac noreply at wordpress.org
Fri May 29 22:16:21 UTC 2015


#32474: Facilitate widgets to be stored in posts instead of options
------------------------------+--------------------------
 Reporter:  westonruter       |       Owner:  westonruter
     Type:  enhancement       |      Status:  reopened
 Priority:  normal            |   Milestone:  4.3
Component:  Widgets           |     Version:  2.8
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:
------------------------------+--------------------------
Changes (by azaozz):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 I'm not sure this should be in core. Don't see what is fixed by adding
 that conditional. If a plugin or a theme wants to use the (hacky) way of
 intercepting options get and set, why should this be in core and not in
 the plugin?

 {{{
 // When $settings is an array-like object, get an intrinsic array for use
 with array_keys().
 if ( $settings instanceof ArrayObject || $settings instanceof
 ArrayIterator ) {
     $settings = $settings->getArrayCopy();
 }

 return $settings;
 }}}

 Also if we ever change the way widgets data is saved (using CPTs sounds
 like a good idea), this will have no backwards compatibility. If we need
 to let plugins change the way widgets data is stored, a much better way
 would be to use actual filters, like we do in so many other places. Then
 we can maintain backwards compatibility.

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


More information about the wp-trac mailing list