[wp-trac] [WordPress Trac] #27603: fields added with action 'in_widget_form' disappear after update in customizer

WordPress Trac noreply at wordpress.org
Mon Mar 31 08:22:34 UTC 2014


#27603: fields added with action 'in_widget_form' disappear after update in
customizer
--------------------------+------------------------------
 Reporter:  Chouby        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Widgets       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by Chouby):

 There is nothing private. the plugin is
 [http://wordpress.org/plugins/polylang/ Polylang].
 In a class PLL_Admin_Filters, I have the method:

 {{{
 public function in_widget_form($widget) {
         $dropdown = new PLL_Walker_Dropdown();
         printf('<p><label for="%1$s">%2$s %3$s</label></p>',
                 esc_attr( $widget->id.'_lang_choice'),
                 __('The widget is displayed for:', 'polylang'),
                 $dropdown->walk(
                         array_merge(
                                 array((object) array('slug' => 0, 'name'
 => __('All languages', 'polylang'))),
                                 $this->model->get_languages_list()
                         ),
                         array(
                                 'name'        =>
 $widget->id.'_lang_choice',
                                 'class'       => 'tags-input',
                                 'selected'    =>
 empty($this->options['widgets'][$widget->id]) ? '' :
 $this->options['widgets'][$widget->id]
                         )
                 )
         );
 }
 }}}
 The method is hooked to the action in the class constructor

 {{{
 add_action('in_widget_form', array(&$this, 'in_widget_form'));
 }}}

 However, looking back at my code I see that the object itself is created
 in a method hooked to 'wp_loaded'. Could it be too late?

 I will look at jetpack to compare.

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


More information about the wp-trac mailing list