mzdani / yii2-webfont-loader
Yii2 Web Font Loader Wrapper
1.0.0
2016-01-03 02:59 UTC
Requires
- yiisoft/yii2: ~2.0.6
This package is auto-updated.
Last update: 2024-11-29 04:57:53 UTC
README
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist "mzdani/yii2-webfont-loader" "dev-master"
or add
"mzdani/yii2-webfont-loader": "dev-master"
to the require section of your composer.json
file.
Usage
Below is some example how to use the wrapper.
#!php
<?php
use \mdscomp\WebFontLoader;
WebFontLoader::widget([
'classes' => false,
'event' => false,
'timeout' => 2000,
'context' => "frames['my-child']",
'text' => 'abcdefghijklmnopqrstuvwxyz!',
'callback' => [
'loading' => 'function(){}',
'active' => 'function(){}',
'inactive' => 'function(){}',
'fontloading' => 'function(familyName, fvd) {}',
'fontactive' => 'function(familyName, fvd) {console.log(\'font name\'+familyName);}',
'fontinactive' => 'function(familyName, fvd) {}',
],
'CssFontName' => 'Roboto Condensed',
'type' => 'google',
'families' => ['Roboto+Condensed:400,700,300:latin'],
]);
WebFontLoader::widget([
'CssFontName' => 'Roboto Condensed',
'type' => 'typekit',
'families' => 'xxxx',
]);
WebFontLoader::widget([
'CssFontName' => 'Roboto Condensed',
'type' => 'fontdeck',
'families' => 'xxxx',
]);
WebFontLoader::widget([
'CssFontName' => 'Roboto Condensed',
'type' => 'monotype',
'families' => [
'id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'ver' => 12345
],
]);
?>
You must use `
CssFontNamebecause the script automatically create