silverstripe/fontpicker
Adds a fontpicker field for selecting fonts
Package info
github.com/silverstripe/silverstripe-fontpicker
Language:JavaScript
Type:silverstripe-vendormodule
pkg:composer/silverstripe/fontpicker
Requires
- silverstripe/framework: ^4.1
Requires (Dev)
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^3
Suggests
None
Provides
None
Conflicts
None
Replaces
None
BSD-3-Clause 229b62bcd7bba6bc4dd2ee33a68ecb5d2057c933
This package is auto-updated.
Last update: 2026-06-10 00:39:07 UTC
README
👁 Build Status
👁 Scrutinizer Code Quality
👁 codecov
This module adds a font picker field which can be added anywhere and is used to pick and preview a font.
Usage
To add a FontPickerField you can write the following:
public function getCMSFields() { $fields = parent::getCMSFields(); $fonts = [ 'nunito-sans' => 'Nunito Sans', 'fira-sans' => 'Fira Sans', 'merriweather' => 'Merriweather', ]; // Import each font via the google fonts api to render font preview foreach ($fonts as $fontTitle) { $fontFamilyName = str_replace('', '+', $fontTitle); Requirements::css("//fonts.googleapis.com/css?family=$fontFamilyName"); } $fields->addFieldsToTab( 'Root.Main', [ FontPickerField::create( 'MainFontFamily', _t( __CLASS__ . '.MainFontFamily', 'Main font family' ), $fonts ) ] ); return $fields; }
See silverstripe/theme-fontpicker for an example.
Versioning
This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library.
All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading.
