[wp-trac] [WordPress Trac] #34738: Customizer preview elements lose or misplace their preview data

WordPress Trac noreply at wordpress.org
Fri Nov 20 02:11:06 UTC 2015


#34738: Customizer preview elements lose or misplace their preview data
-------------------------------------------------+-------------------------
 Reporter:  Clorith                              |       Owner:
     Type:  defect (bug)                         |  westonruter
 Priority:  normal                               |      Status:  accepted
Component:  Customize                            |   Milestone:  4.4
 Severity:  normal                               |     Version:  trunk
 Keywords:  has-patch needs-unit-tests dev-      |  Resolution:
  feedback                                       |     Focuses:
-------------------------------------------------+-------------------------
Changes (by valendesigns):

 * keywords:  has-patch needs-testing needs-unit-tests dev-feedback => has-
     patch needs-unit-tests dev-feedback


Comment:

 @westonruter the patch looks good, and is also working for me using the
 test widget.

 @pagelab Your test widget has a couple errors I had to fix before I could
 use it since my environment is in debug mode. The most important being
 that you can't convert `$instance` to a string. So you're CSS id should be
 something like this `$id = "{$this->id_base}-toggle-{$this->number}";`.
 The other two are on line 58 & 149 `$instance['title']` doesn't exist when
 you first create a widget so you need to do a ternary `isset` check like
 so `$title  = isset( $instance['title'] ) ? esc_attr( $instance['title'] )
 : '';` to avoid PHP warnings. At any rate, thank you for supplying
 something to test with.

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


More information about the wp-trac mailing list