[wp-trac] [WordPress Trac] #20788: Add widget instance argument to widget_links_args filter

WordPress Trac wp-trac at lists.automattic.com
Wed May 30 09:07:14 UTC 2012


#20788: Add widget instance argument to widget_links_args filter
-------------------------+-----------------------------
 Reporter:  ragulka      |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Widgets      |    Version:  3.3.2
 Severity:  normal       |   Keywords:  dev-feedback
-------------------------+-----------------------------
 Using the `widget_links_args` filter (used in the default Links Widget
 class) as it is right now is a bit useless because one does not have
 access to the widget instance that applies the filter.

 Widget instance may contain custom variables set by custom fields that may
 have been added to the widget form by plugins or themes using other
 filters.

 Being able to access widget instance from within the filter function gives
 developers lots of possibilities to customize the widget.

 My suggestion is simple: add `$instance` argument to the
 `widget_links_args` filter, like this (wp-includes/default-widget.php line
 113):
 {{{
 wp_list_bookmarks(apply_filters('widget_links_args', array(
         'title_before' => $before_title, 'title_after' => $after_title,
         'category_before' => $before_widget, 'category_after' =>
 $after_widget,
         'show_images' => $show_images, 'show_description' =>
 $show_description,
         'show_name' => $show_name, 'show_rating' => $show_rating,
         'category' => $category, 'class' => 'linkcat widget'
 ), $instance ));
 }}}

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


More information about the wp-trac mailing list