[wp-trac] [WordPress Trac] #28216: Allow to register pre-instantiated widgets

WordPress Trac noreply at wordpress.org
Mon Apr 25 09:35:44 UTC 2016


#28216: Allow to register pre-instantiated widgets
-------------------------------+--------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:  westonruter
     Type:  defect (bug)       |      Status:  accepted
 Priority:  normal             |   Milestone:  4.6
Component:  Widgets            |     Version:  3.9.1
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+--------------------------

Comment (by PeterRKnight):

 Replying to [comment:11 mdwheele]:
 > I've added two possible implementations that vary on whether branching
 or exiting-early is preferred in the widget factory register and
 unregister methods. This includes a test that has been tagged with this
 ticket number. Tests are passing. The third patch updates the
 `register_widget` and `unregister_widget` functions to reflect the change
 in argument type expectation.

 Your patch allows for pre-initialized widgets but if you try to
 instantiate multiple widgets of a certain class with arguments, they
 overwrite each other as far as I can see. So it doesn't cover the example
 given by @Denis-de-Bernardy here
 https://core.trac.wordpress.org/ticket/28216?replyto=11#comment:3

 I would love to see core support for creating dynamic widgets make it into
 4.6!

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


More information about the wp-trac mailing list