From 6412e284635968125e5ce2140f8806978cf39aac Mon Sep 17 00:00:00 2001 From: Ian Belanger Date: Fri, 26 Jun 2020 14:40:27 +0000 Subject: [PATCH] Bundled Themes: Twenty Twenty Social Icons Filter. Adds a Social Icons Filter to Twenty Twenty that allows for new icons to be added to the theme by filter. Props JarretC, nielslange, acosmin, desrosj. Fixes #48713. git-svn-id: https://develop.svn.wordpress.org/trunk@48180 602fd350-edb4-49c9-b593-d223f7449a82 --- .../classes/class-twentytwenty-svg-icons.php | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php b/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php index 809f7c9fc2..21a8aee89e 100644 --- a/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php +++ b/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php @@ -29,6 +29,30 @@ if ( ! class_exists( 'TwentyTwenty_SVG_Icons' ) ) { } else { $arr = array(); } + + /** + * Filters Twenty Twenty's array of icons. + * + * The dynamic portion of the hook name, `$group`, refers to + * the name of the group of icons, either "ui" or "social". + * + * @since 1.5.0 + * + * @param array $arr Array of icons. + */ + $arr = apply_filters( "twentytwenty_svg_icons_{$group}", $arr ); + + /** + * Filters an SVG icon's color. + * + * @since 1.5.0 + * + * @param array $color The icon color. + * @param array $icon The icon name. + * @param array $group The icon group. + */ + $color = apply_filters( 'twentytwenty_svg_icon_color', $color, $icon, $group ); + if ( array_key_exists( $icon, $arr ) ) { $repl = '