[wp-trac] Re: [WordPress Trac] #6549: Output broken in wp-admin/widgets.php

WordPress Trac wp-trac at lists.automattic.com
Thu Apr 3 00:06:50 GMT 2008


#6549: Output broken in wp-admin/widgets.php
---------------------+------------------------------------------------------
 Reporter:  hakre    |        Owner:  anonymous
     Type:  defect   |       Status:  new      
 Priority:  normal   |    Milestone:  2.5.1    
Component:  General  |      Version:           
 Severity:  normal   |   Resolution:           
 Keywords:  Output   |  
---------------------+------------------------------------------------------
Comment (by hakre):

 Okay, now I have got more Infos on the Issue:

 This is "by Design". The %i% inside the ID is part of a codeblock that is
 used by some javascript as a pattern to create valid sourcecode later on.
 See line 62ff in widgets.js (?ver=20080319).

 One solution which comes into my tired getting mind is to put the pattern-
 sourcecode inside a html comment (<!-- ... -->) and then use jQuery to
 create the elements later on. This would only slightly modify the code and
 would work quite the same. The only problem that comes into my mind is
 when a widget has got a HTML comment in it's own output.

 I could verify this Idea by modifying the source:

 wp-admin/includes/widgets.php line 91 ff
 {{{
 $widget_control_template = sprintf('%s<!-- %s -->%s',
 $sidebar_args['before_widget'], $widget_control_template,
 $sidebar_args['after_widget']);
 }}}

 wp-admin/js/widget.js: ~ line 63
 {{{
                 var oldLi = $(this).parents('li:first').find('ul.widget-
 control-info li');
                 var comment = oldLi.html();
                 var pattern = comment.substr(5, comment.length - 8);
                 var newLi = oldLi.clone();
                 newLi.html(pattern);
 }}}

 I dunno wether this work with "multi widgets" because I know none sothat I
 could test it against it. But if I read the code right, it should work.
 With all the other widgets, this worked.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6549#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list