public function HelperTrait::getSvgIconMarkup in Bootstrap Styles 1.0.x
Generates the svg markup from path.
Parameters
string $path: The path to the svg icon.
Return value
array Array of the SVG icon markup.
3 calls to HelperTrait::getSvgIconMarkup()
- BackgroundColor::buildStyleFormElements in src/
Plugin/ BootstrapStyles/ Style/ BackgroundColor.php - ResponsiveTrait::buildBreakpointsFields in src/
ResponsiveTrait.php - Build the breakpoints style form elements.
- ResponsiveTrait::buildResponsivePreviewer in src/
ResponsiveTrait.php - Build the responsive previewer form elements.
File
- src/
HelperTrait.php, line 21
Class
- HelperTrait
- A Trait for helper methods.
Namespace
Drupal\bootstrap_stylesCode
public function getSvgIconMarkup(string $path) {
$svg = file_get_contents(DRUPAL_ROOT . '/' . $path);
$svg = preg_replace([
'/<\\?xml.*\\?>/i',
'/<!DOCTYPE((.|\\n|\\r)*?)">/i',
], '', $svg);
$svg = trim($svg);
return Markup::create($svg);
}