Astra_Builder_UI_Controller::fetch_svg_icon( string $icon = '', bool $base = true )

Get an SVG Icon


Description


Parameters

$icon

(string) (Optional) the icon name.

Default value: ''

$base

(bool) (Optional) if the baseline class should be added.

Default value: true


Source

File: inc/builder/controllers/class-astra-builder-ui-controller.php

		public static function fetch_svg_icon( $icon = '', $base = true ) {
			$output = '<span class="ahfb-svg-iconset ast-inline-flex' . ( $base ? ' svg-baseline' : '' ) . '">';

			if ( ! self::$ast_svgs ) {
				ob_start();
				include_once ASTRA_THEME_DIR . 'assets/svg/svgs.json'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
				self::$ast_svgs = json_decode( ob_get_clean(), true );
				self::$ast_svgs = apply_filters( 'astra_svg_icons', self::$ast_svgs );
			}

			$output .= isset( self::$ast_svgs[ $icon ] ) ? self::$ast_svgs[ $icon ] : '';
			$output .= '</span>';

			return $output;
		}


User Contributed Notes

You must log in before being able to contribute a note or feedback.