Opened 12 years ago
Closed 12 years ago
#26661 closed enhancement (fixed)
Add before/after hooks to override output of wp_widget_control()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Widgets | Keywords: | has-patch docs-feedback |
| Focuses: | Cc: |
Description
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:
-
src/wp-admin/includes/widgets.php
188 188 $widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) ); 189 189 $has_form = 'noform'; 190 190 191 do_action( 'temp_wp_widget_control_before', $sidebar_args ); 191 192 echo $sidebar_args['before_widget']; ?> 192 193 <div class="widget-top"> 193 194 <div class="widget-title-action"> … … 237 238 </div> 238 239 <?php 239 240 echo $sidebar_args['after_widget']; 241 do_action( 'temp_wp_widget_control_after', $sidebar_args, $has_form !== 'noform' ); 240 242 return $sidebar_args; 241 243 }
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
Attachments (4)
Change History (16)
This ticket was mentioned in IRC in #wordpress-dev by westonruter. View the logs.
12 years ago
#7
@
12 years ago
On second thought, 'noform' !== $has_form seems to make sense, so I decided to leave it as is.
We'd need to document the new hooks if they are going to stay.
@
12 years ago
Remove temp_ prefixes and add docs to new action hooks wp_widget_control_before and wp_widget_control_after
#9
@
12 years ago
- Resolution set to maybelater
- Status changed from new to closed
It turns out that we actually didn't need this, since the widget icons are being supplied via CSS as dashicons instead of as inline image elements.
#10
follow-up:
↓ 11
@
12 years ago
- Resolution maybelater deleted
- Status changed from closed to reopened
Do we still need temporary hooks added in [26865]? If not, let's remove them.
Can we just pass
$has_formrather than$has_form !== 'noform'as the last argument towp_widget_control_after?