toastnz / svg
A skeleton for Silverstripe CMS modules.
Installs: 2 372
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- silverstripe/admin: ^1.0 || ^2.0
- silverstripe/framework: ^4.0 || ^5.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.7
README
This module enables the usage of the $SVG('SVG_FILE_NAME')
variable in SilverStripe templates and block templates. It allows you to easily include SVG files within your templates by referencing their file names.
Installation
To install this module, you can use Composer:
composer require toastnz/svg
Configuration
To set up the module, you need to specify the svg_base_path under the Page class in your YAML configuration file (app/_config/config.yml).
Page:
svg_base_path: '/path/to/svg-folder/'
Make sure to replace '/path/to/svg-folder/' with the actual path to your SVG files.
Usage
Once the module is installed and configured, you can use the $SVG('SVG_FILE_NAME') variable in your SilverStripe templates. Here's an example of how to include an SVG file:
$SVG('logo')