get_bs_icon_svg()
protected function get_bs_icon_svg( string $icon, int|string $size = '16', string $class = '', string $label = '', bool $hidden = false )
This method retrieves, modifies, and returns the svg for a Bootstrap icon.
#
Arguments$icon
(string) (required) The name of the icon that you would like to retrieve the svg for. (ex: 'alarm', 'chat-square-fill', 'share')
$size
(string / int) (optional) The number of pixels that you would like the width and height of the icon to be (ex: '20')
Default: '16'
$class
(string) (optional) Any additional CSS classes to add to the svg
Default: ''
$label
(string) (optional) If you need to set the aria-label attribute for the svg (in some cases, needed for accessibility), provide a label.
Default: ''$hidden
(bool) (optional) Whether or not to hide the svg from screen readers. If true,aria-hidden="true"
will be added to the svg tag.
Default: false
#
ExampleTake the following code:
This would output the following markup: