[wp-trac] [WordPress Trac] #44098: Widget classes when custom widget class is namespaced

WordPress Trac noreply at wordpress.org
Tue May 15 21:04:14 UTC 2018


#44098: Widget classes when custom widget class is namespaced
--------------------------+-----------------------------
 Reporter:  rogerlos      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Widgets output from a namespaced class have a class added to the
 {{{before_widget}}} argument in a way which is potentially confusing and
 messy to work with.

 The {{{before_widget}}} value within the arguments array sent to the
 {{{widget()}}} method within {{{WP_Widget}}} looks something like this
 when using a namespaced custom widget class:

 {{{
 <aside class="widget \myplugin\My_Widget" id="mywidgetname_widget-1">'
 }}}

 Given my understanding of WP's "normal" escaping of attributes, I would
 have expected {{{myplugin-My_Widget}}}, {{{mywidgetname myplugin-
 My_Widget}}} or maybe {{{mypluginMy_Widget}}}.

 I believe that ''technically'' the two escape characters make the WP
 output the equivalent to the latter, but it's a bit messy and potentially
 confusing to folks looking to style the output, or find the {{{aside}}}
 using JS.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44098>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list