Page methods
Custom page methods. Available on pages using Fountain templates. Each method has one or more assigned templates it works for.
getProductFormName
Unique product name used with forms fields. Returns the product id, prefixed with product_.
$page->getProductFormName();
| Returns | string |
|---|---|
| Templates |
font, font-bundle
|
getProductFormValue
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 | string |
|---|---|
| Templates |
font, font-bundle
|
getAddon
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 |
|
| Templates |
font, font-bundle
|
|
getFontFiles
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
|
|
getAddonPrice
Returns addon price, formated with currency if second parameter is true.
<?= $font->getAddonPrice( $addonId, true ) ?>
getAddonTitle
Returns addon title.
<?= $font->getAddonTitle( $addonid ) ?>
| Returns | string |
|---|---|
| Templates |
font, font-bundle
|
getAddonFormName
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
|
getAddonFormValue
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
|
getFamilyTitle
Returns name of font family.
<?= $font->getFamilyTitle() ?>
| Returns | string |
|---|---|
| Templates |
font, font-bundle, font-family, |
getFontName
Returns file font name, often used with CSS Font-face when linking web fonts.
<?= $font->getFontName() ?>
| Returns | string |
|---|---|
| Templates |
font, font-bundle, font-family, |
getFontWeight
Returns number value for font weight. Selects weight for preview font, otherwise first static font.
<?= $font->getFontWeight() ?>
| Returns | string |
|---|---|
| Templates | font |
getLicense
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
|
|
getLicensePrice
Returns license price, formated with currency if second parameter is true.
<?= $font->getLicensePrice( $licenseId, true ) ?>
getLicenseTitle
Returns addon title.
<?= $font->getLicenseTitle( $licenseId ) ?>
| Returns | string |
|---|---|
| Templates |
font, font-bundle
|
getLicenseFormName
Returns form name for each license entity. Key allows for unlimited entities.
| Returns | string |
|---|---|
| Templates |
font, font-bundle
|
getLicenseFormValue
Returns form value for license.
| Returns | string |
|---|---|
| Templates |
font, font-bundle
|
getMultiBase
Return multiplication base for font product or bundle.
| Returns | float |
|---|---|
| Templates |
font, font-bundle
|
getPreviewFont
Return Kirby\Cms\File for preview font.
| Returns | Kirby\Cms\File |
|---|---|
| Templates |
font, font-bundle, font-family
|
getPreviewText
Return custom text string for preview font. Fallback is font name.
| Returns | string |
|---|---|
| Templates |
font, font-bundle, font-family |
getPriceString
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
|
getProductId
Return product id.
<?= $font->getProductId() ?>
| Returns | string |
|---|---|
| Templates |
font, font-bundle
|
getProductFormName
Returns form name for product. Prefixed with product_
| Returns | string |
|---|---|
| Templates |
font, font-bundle
|
getProductFormValue
Returns form value for product.
| Returns | string |
|---|---|
| Templates |
font, font-bundle
|
isInCart
Return bool if product is in cart.
| Name | Type | Info |
|---|---|---|
| $cart | AndreasNymark\Fountain\Cart |
| Returns | bool |
|---|---|
| Templates |
font, font-bundle
|