lukasbableck / contao-svg-icon-picker-bundle
This bundle adds a svg icon picker widget to Contao.
Fund package maintenance!
lukasbableck
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:contao-bundle
Requires
- php: ^8.1
- contao/core-bundle: ^5.3
- enshrined/svg-sanitize: ^0.22
- symfony/asset: ^6.4 || ^7.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/http-kernel: ^6.4 || ^7.0
- twig/cache-extra: ^3.10
- twig/twig: ^3.10
Requires (Dev)
- contao/manager-plugin: ^2.0
- friendsofphp/php-cs-fixer: ^3.86
- vincentlanglet/twig-cs-fixer: ^3.9
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
README
This bundle adds a svg icon picker widget to Contao.
Configuration
Create a field in your DCA/RSCE/...
'icon' => [ 'inputType' => 'svgIconPicker', 'eval' => [ 'sourceDirectory' => 'files/icons', 'metadataDirectory' => 'files/icons/metadata', 'tl_class' => 'clr' ], 'sql' => 'blob NULL', ],
Put your SVG icons in the specified sourceDirectory
.
Icon metadata like search terms and labels can be provided via an icons.json, which has to be placed in the metadataDirectory
. Providing metadata is completely optional.
Currently only an icons.json file in the scheme of the FontAwesome icons.json is supported.
Glyphs are not supported yet.
Usage
This extension provides a Twig function to render the SVG icon in your templates.
{{ svg_icon(icon) }}