You appear to be a bot. Output may be restricted
Description
Gets the SVG code for a given icon.
Usage
TwentyNineteen_SVG_Icons::get_svg( $group, $icon, $size );
Parameters
- $group
- ( mixed ) required –
- $icon
- ( mixed ) required –
- $size
- ( mixed ) required –
Returns
void
Source
File name: twentynineteen/classes/class-twentynineteen-svg-icons.php
Lines:
1 to 17 of 17
public static function get_svg( $group, $icon, $size ) { if ( 'ui' === $group ) { $arr = self::$ui_icons; } elseif ( 'social' === $group ) { $arr = self::$social_icons; } else { $arr = array(); } if ( array_key_exists( $icon, $arr ) ) { $repl = sprintf( '<svg class="svg-icon" width="%d" height="%d" aria-hidden="true" role="img" focusable="false" ', $size, $size ); $svg = preg_replace( '/^<svg /', $repl, trim( $arr[ $icon ] ) ); // Add extra attributes to SVG code. $svg = preg_replace( "/([\n\t]+)/", ' ', $svg ); // Remove newlines & tabs. $svg = preg_replace( '/>\s*</', '><', $svg ); // Remove whitespace between SVG tags. return $svg; } return null; }