[wp-trac] [WordPress Trac] #32470: Abstracting the Widget Classes

WordPress Trac noreply at wordpress.org
Mon May 25 16:18:30 UTC 2015


#32470: Abstracting the Widget Classes
------------------------------------+------------------------------
 Reporter:  welcher                 |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Widgets                 |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+------------------------------
Changes (by welcher):

 * keywords:  dev-feedback => dev-feedback has-patch


Comment:

 New patch in place that better demonstrates the changes proposed to
 `WP_Widget`

 I have done a first pass on the default widgets and this new approach
 removes a fair amount of duplication.

 Some of the widgets will need slight refactoring to accommodate using the
 new methods and I have left them as is for now.

 A few takeaways:
 1. We need a way of stopping the widget from rendering if there is no
 content without having to override the whole `widget()` method
 2.  I think we should abstract out the processing for the `title`
 parameter. Currently it is in the `before_widget()` method and it would be
 better to have access to it where ever needed - which will help the
 refactoring I mentioned earlier.
 3. We have not accounted for caching - but that might be better suited as
 a full override of `widget()` as it won't be needed on every Widget

 Any comments/suggestions/notes greatly appreciated!

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


More information about the wp-trac mailing list