Skip to content
No description, website, or topics provided.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_config
src forTemplate Jul 26, 2019
.editorconfig
.gitignore init Jul 21, 2019
.scrutinizer.yml
.travis.yml codecov Jul 28, 2019
LICENSE init Jul 21, 2019
README.md codecov Jul 28, 2019
_config.php init Jul 21, 2019
composer.json codecov Jul 28, 2019
phpunit.xml.dist

README.md

SilverStripe SVG GO

Build Status Scrutinizer Code Quality SilverStripe supported module

Basic SVG support for SilverStripe

Requirements

SilverStripe 4 or higher

Installation

composer require magnum34/silverstripe-svg-go

Usage


use Magnum34\SilverStripeSVGGO\Models\IconSVG

class CustomPage extends Page {
    
    
    private static $many_many = [
        'Icon' => IconSVG::class
    ];
    
    public function getCMSFields()
    {
        $fields =  parent::getCMSFields();
        $select = AjaxSelect2Field::create('IconID','Icon');
        $select->setConfig('multiple',false);
        $select->setConfig('resultsFormat', '<strong>$Title</strong><br />$Thumbnail');
        $select->setConfig('classToSearch', IconSVG::class);
        $select->setConfig('minimumInputLength', 0);
        $select->setConfig('placeholder', 'Search for a Icon...');
        $select->setConfig('selectionFormat', '<strong>$Title </strong>');
        $fields->addFieldToTab('Root.Icon',$select);
        $fields->addFieldToTab('Root.Icon',
                    HasOneButtonField::create($this, 'Icon',"Icon",'Icon (only .svg, .png, .jpg, .jpeg)'),
                    'Content');
        
        
        
        return $fields;
        
    }

}

for Template

$Icon

Adding custom class to SVG or image

$Icon.setCSSClass('test')

TODO

SVGField

License

MIT license. See the LICENSE file for more details.

You can’t perform that action at this time.