[wp-trac] [WordPress Trac] #26661: Add before/after hooks to override output of wp_widget_control()

WordPress Trac noreply at wordpress.org
Tue Dec 17 00:45:16 UTC 2013


#26661: Add before/after hooks to override output of wp_widget_control()
-------------------------+-----------------------------
 Reporter:  westonruter  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Widgets      |    Version:
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 As part of the widgets improvements being worked on for core, we need to
 override the default output of `wp_widget_control()`. One way to do this
 is to add a before/after actions around the output generated by the
 function:

 {{{#!diff
 Index: src/wp-admin/includes/widgets.php
 ===================================================================
 --- src/wp-admin/includes/widgets.php   (revision 26862)
 +++ src/wp-admin/includes/widgets.php   (working copy)
 @@ -188,6 +188,7 @@
         $widget_title = esc_html( strip_tags( $sidebar_args['widget_name']
 ) );
         $has_form = 'noform';

 +       do_action( 'temp_wp_widget_control_before', $sidebar_args );
         echo $sidebar_args['before_widget']; ?>
         <div class="widget-top">
         <div class="widget-title-action">
 @@ -237,5 +238,6 @@
         </div>
  <?php
         echo $sidebar_args['after_widget'];
 +       do_action( 'temp_wp_widget_control_after', $sidebar_args,
 $has_form !== 'noform' );
         return $sidebar_args;
  }
 }}}

 Such hooks seem useful on a permanent basis as well, so perhaps the
 `temp_` prefix can be dropped to begin with.

 See related discussion on IRC (up until the end of the day):
 https://irclogs.wordpress.org/chanlog.php?channel=wordpress-
 ui&day=2013-12-16&sort=asc#m144514

 Related to #25368

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26661>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list