Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.
/ magento2-svghelper Public archive

Simple module that provides a block level helper for reading in an SVG files source from a theme in Magento 2.

License

Notifications You must be signed in to change notification settings

meanbee/magento2-svghelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magento 2 SVG Helper

Simple module that provides a block level helper for reading in an SVG files source from a theme in Magento 2.

Installation

Install this extension via Composer:

composer require meanbee/magento2-svghelper

Development

Setting up a development environment

A Docker development environment is included with the project:

docker-compose run --rm cli magento-extension-installer Meanbee_SVGHelper \
&& docker-compose up -d

Usage

The SVGHelper is set as data on every block. This means that in your template you can call:

<?php echo $block->getData('svgHelper')->getViewSvg('pathtofile.svg') ?>

or

<?php echo $block->getData('svgHelper')->getViewSvg('Magento_Module::pathtofile.svg') ?>

This will output the raw contents of the svg file.

About

Simple module that provides a block level helper for reading in an SVG files source from a theme in Magento 2.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages