silverstripe / fontpicker
Adds a fontpicker field for selecting fonts
Installs: 1 713
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 8
Forks: 1
Open Issues: 18
Language:JavaScript
Type:silverstripe-vendormodule
Requires
- silverstripe/framework: ^4.1
Requires (Dev)
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^3
- dev-master / 1.x-dev
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/async-2.6.4
- dev-dependabot/npm_and_yarn/tmpl-1.0.5
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/tar-2.2.2
- dev-dependabot/npm_and_yarn/merge-2.1.1
- dev-dependabot/npm_and_yarn/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/handlebars-4.7.7
- dev-dependabot/npm_and_yarn/ua-parser-js-0.7.28
- dev-dependabot/npm_and_yarn/ssri-6.0.2
- dev-dependabot/npm_and_yarn/y18n-3.2.2
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/ini-1.3.7
- dev-dependabot/npm_and_yarn/npm-user-validate-1.0.1
- dev-dependabot/npm_and_yarn/node-sass-4.14.1
- dev-dependabot/npm_and_yarn/npm-registry-fetch-4.0.5
- dev-dependabot/npm_and_yarn/npm-6.14.6
This package is auto-updated.
Last update: 2024-10-09 21:24:13 UTC
README
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.