public function StylePluginBase::getSvgIconMarkup in Bootstrap Styles 1.0.x
Helper function to get SVG Markup.
Parameters
string $path: The absolute path to the SVG icon.
Return value
string The icon markup.
2 calls to StylePluginBase::getSvgIconMarkup()
- BackgroundMedia::buildStyleFormElements in src/
Plugin/ BootstrapStyles/ Style/ BackgroundMedia.php - Border::buildStyleFormElements in src/
Plugin/ BootstrapStyles/ Style/ Border.php
File
- src/
Style/ StylePluginBase.php, line 110
Class
- StylePluginBase
- A base class to help developers implement their own Styles Group plugins.
Namespace
Drupal\bootstrap_styles\StyleCode
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);
}