wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php:28GET SVG CODE Get the SVG code for the specified icon
$iconstring$groupstringoptional'ui'$colorstringoptional'#1A1A1B'2 hooks fire while TwentyTwenty_SVG_Icons::get_svg() runs, in this order:
Filters Twenty Twenty's array of icons.
Filters an SVG icon's color.
public static function get_svg( $icon, $group = 'ui', $color = '#1A1A1B' ) { if ( 'ui' === $group ) { $arr = self::$ui_icons; } elseif ( 'social' === $group ) { $arr = self::$social_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 Twenty Twenty 1.5 * * @param array $arr Array of icons. */ $arr = apply_filters( "twentytwenty_svg_icons_{$group}", $arr ); /** * Filters an SVG icon's color. * * @since Twenty Twenty 1.5 * * @param string $color The icon color. * @param string $icon The icon name. * @param string $group The icon group. */ $color = apply_filters( 'twentytwenty_svg_icon_color', $color, $icon, $group ); if ( array_key_exists( $icon, $arr ) ) { $repl = '<svg class="svg-icon" aria-hidden="true" role="img" focusable="false" '; $svg = preg_replace( '/^<svg /', $repl, trim( $arr[ $icon ] ) ); // Add extra attributes to SVG code. $svg = str_replace( '#1A1A1B', $color, $svg ); // Replace the color. $svg = str_replace( '#', '%23', $svg ); // Urlencode hashes. $svg = preg_replace( "/([\n\t]+)/", ' ', $svg ); // Remove newlines & tabs. $svg = preg_replace( '/>\s*</', '><', $svg ); // Remove whitespace between SVG tags. return $svg; } return null; }Introduced in Twenty Twenty 1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.