Page Methods
Custom font product, font bundle and font family methods.
Unique product name used with forms fields. Returns the product id, prefixed with product_.
$page->getProductFormName();
Product value used in forms. There are two snippet depending on what kind of license you use, to see what you need to loop: site/plugins/fountain/snippets/entity-fonts.php and tier-fonts.php. In the same folder you see snippets for bundles, if you have bundles.
<?php foreach( $licenses as $key => $entity ) : ?>
<?php $levels = $entity->licenseEntityLevels()->toStructure() ?>
<select name="<?= $font->getLicenseFormName( $key ) ?>">
<option selected>—</option>
<?php foreach ( $levels as $level ) : ?>
<option value="<?= $font->getLicenseFormValue( $level->licenseEntityLevelId() ) ?>">
<?= $font->getLicenseTitle( $level->licenseEntityLevelId() ) ?>
</option>
<?php endforeach ?>
</select>
<?php endforeach ?>
Returns addon title and price, based on id and font product.
<?= $font->getAddon( $addonId )->title() ?>
| Name |
Type |
Info |
| $addonId |
string |
|
| Returns |
price() |
float |
title() |
string |
Returns a script element with json.
| Name |
Type |
Info |
| $$fontFiles |
Kirby\Cms\Files |
|
Returns a list of webfont files.
This method only returns webfonts for font-index blueprint. To add additional fonts, e.g … supply a collection of font-family pages as `$additionalFonts’
Font index blueprint
<?= $fontFiles = $page->getFontFiles(); ?>
Other blueprint
<?= $fontFiles = $page->getFontFiles( $page->featuredFonts()->toPages() ); ?>
| Name |
Type |
Info |
| $additionalFonts |
Kirby\Cms\Pages |
Has to be font-families |
| Returns |
price() |
float |
title() |
string |
| Templates |
font, font-bundle
|
Returns addon price, formated with currency if second parameter is true.
<?= $font->getAddonPrice( $addonId, true ) ?>
Returns addon title.
<?= $font->getAddonTitle( $addonid ) ?>
| Returns |
string |
| Templates |
font, font-bundle
|
Returns form name for each license entity. Key allows for unlimited entities.
<?php foreach( $addons as $key => $addon ) : ?>
Addon form name: <?= $font->getAddonFormName( $key ) ?>
<?php endforeach ?>
| Returns |
string |
| Templates |
font, font-bundle
|
Returns form value for addon.
<?php foreach( $addons as $key => $addon ) : ?>
<?php foreach( $addon->addonLevels()->toStructure() as $level ) : ?>
<input
type="radio"
name="<?= $font->getAddonFormName( $key ) ?>"
value="<?= $font->getAddonFormValue( $level->addonLevelId() ) ?>">
<?php endforeach ?>
<?php endforeach ?>
| Returns |
string |
| Templates |
font, font-bundle
|
Returns name of font family.
<?= $font->getFamilyTitle() ?>
| Returns |
string |
| Templates |
font, font-bundle, font-family, |
Returns file font name, often used with CSS Font-face when linking web fonts.
<?= $font->getFontName() ?>
| Returns |
string |
| Templates |
font, font-bundle, font-family, |
Returns number value for font weight. Selects weight for preview font, otherwise first static font.
<?= $font->getFontWeight() ?>
| Returns |
string |
| Templates |
font |
Returns Kirby\Toolkit\Obj with license data.
<?php foreach( $licenses as $key => $entity ) : ?>
<select name="<?= $font->getLicenseFormName( $key ) ?>">
<option selected>—</option>
<?php foreach ( $entity->licenseEntityLevels()->toStructure() as $level ) : ?>
<option value="<?= $font->getLicenseFormValue( $level->licenseEntityLevelId() ) ?>">
<?= $font->getLicense( $level->licenseEntityLevelId() )->title() ?>
</option>
<?php endforeach ?>
</select>
<?php endforeach ?>
| Returns |
title() |
string |
price() |
float |
entity() |
string |
tier() |
string |
| Templates |
font, font-bundle
|
Returns license price, formated with currency if second parameter is true.
<?= $font->getLicensePrice( $licenseId, true ) ?>
Returns addon title.
<?= $font->getLicenseTitle( $licenseId ) ?>
| Returns |
string |
| Templates |
font, font-bundle
|
Returns form name for each license entity. Key allows for unlimited entities.
| Returns |
string |
| Templates |
font, font-bundle
|
Returns form value for license.
| Returns |
string |
| Templates |
font, font-bundle
|
Return multiplication base for font product or bundle.
| Returns |
float |
| Templates |
font, font-bundle
|
Return Kirby\Cms\File for preview font.
| Returns |
Kirby\Cms\File |
| Templates |
font, font-bundle, font-family
|
Return custom text string for preview font. Fallback is font name.
| Returns |
string |
| Templates |
font, font-bundle, font-family |
Returns a string with all prices. All prices are separated with separator set in config. Can be used to store a reference for prices for javascript. Default looks lite "30|90|270".
| Name |
Type |
Default |
Info |
| $currency |
bool |
false |
Add currency symbol before each value. |
| Returns |
string |
| Templates |
font, font-bundle
|
Return product id.
<?= $font->getProductId() ?>
| Returns |
string |
| Templates |
font, font-bundle
|
Returns form name for product. Prefixed with product_
| Returns |
string |
| Templates |
font, font-bundle
|
Returns form value for product.
| Returns |
string |
| Templates |
font, font-bundle
|
Return bool if product is in cart.
| Name |
Type |
Info |
| $cart |
NymarkType\Fountain\Cart |
|
| Returns |
bool |
| Templates |
font, font-bundle
|
Check if font is italic.
$page->isItalic();
| Returns |
boolean |
| Templates |
font |
Check if font has Opentype feature, via feature tag.
$page->hasOpentypeFeature( 'dlig' );
| Name |
Type |
Info |
| $tag |
String |
Opentype feature tag |
| Returns |
boolean |
| Templates |
font |