From 4bdda75696aeacee28846a9d3419c15d1fe09c3d Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 9 Sep 2015 04:42:24 +0000 Subject: [PATCH] `WP_Widget_Links`: pass widget instance to `widget_links_args` filter Props SergeyBiryukov, MikeHansenMe, DrewAPicture. Fixes #20788. Built from https://develop.svn.wordpress.org/trunk@33971 git-svn-id: http://core.svn.wordpress.org/trunk@33940 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/widgets/class-wp-widget-links.php | 30 ++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 9255b55f24..1152e10a3b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33970'; +$wp_version = '4.4-alpha-33971'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widgets/class-wp-widget-links.php b/wp-includes/widgets/class-wp-widget-links.php index 804153c718..e61e72c7bb 100644 --- a/wp-includes/widgets/class-wp-widget-links.php +++ b/wp-includes/widgets/class-wp-widget-links.php @@ -29,24 +29,34 @@ class WP_Widget_Links extends WP_Widget { $before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] ); + $widget_links_args = array( + 'title_before' => $args['before_title'], + 'title_after' => $args['after_title'], + 'category_before' => $before_widget, + 'category_after' => $args['after_widget'], + 'show_images' => $show_images, + 'show_description' => $show_description, + 'show_name' => $show_name, + 'show_rating' => $show_rating, + 'category' => $category, + 'class' => 'linkcat widget', + 'orderby' => $orderby, + 'order' => $order, + 'limit' => $limit, + ); + /** * Filter the arguments for the Links widget. * * @since 2.6.0 + * @since 4.4.0 The `$instance` parameter was added. * * @see wp_list_bookmarks() * - * @param array $args An array of arguments to retrieve the links list. + * @param array $args An array of arguments to retrieve the links list. + * @param array $instance The settings for the particular instance of the widget. */ - wp_list_bookmarks( apply_filters( 'widget_links_args', array( - 'title_before' => $args['before_title'], 'title_after' => $args['after_title'], - 'category_before' => $before_widget, 'category_after' => $args['after_widget'], - 'show_images' => $show_images, 'show_description' => $show_description, - 'show_name' => $show_name, 'show_rating' => $show_rating, - 'category' => $category, 'class' => 'linkcat widget', - 'orderby' => $orderby, 'order' => $order, - 'limit' => $limit, - ) ) ); + wp_list_bookmarks( apply_filters( 'widget_links_args', $widget_links_args, $instance ) ); } /**