PHP Класс Bolt\Twig\Handler\RecordHandler

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( Silex\Application $app )
current ( Content | array $content ) : boolean Returns true, if the given content is the current content.
excerpt ( Content | array | string $content, integer $length = 200, array | string | null $focus = null ) : string Create an excerpt for the given content.
fields ( Twig_Environment $env, Content $record = null, boolean $common = true, boolean $extended = false, boolean $repeaters = true, boolean $templateFields = true, string $template = '_sub_fields.twig', string | array $exclude = null, boolean $skip_uses = true ) : string Output all (relevant) fields to the browser. Convenient for dumping the content in order in, say, a record.twig template, without having to iterate over them in the browser.
listTemplates ( string $filter = null, boolean $safe = false ) : array Lists templates, optionally filtered by $filter.
pager ( Twig_Environment $env, string $pagerName = '', integer $surr = 4, string $template = '_sub_pager.twig', string $class = '' ) : string Output a simple pager, for paginated listing pages.
selectField ( array $content, array | string $fieldName, boolean $startempty = false, string $keyName = 'id' ) : array Return a selected field from a contentset.

Описание методов

__construct() публичный Метод

public __construct ( Silex\Application $app )
$app Silex\Application

current() публичный Метод

If we're on page/foo, and content is that page, you can use {% is page|current %}class='active'{% endif %}
public current ( Content | array $content ) : boolean
$content Bolt\Legacy\Content | array
Результат boolean True if the given content is on the curent page.

excerpt() публичный Метод

Create an excerpt for the given content.
public excerpt ( Content | array | string $content, integer $length = 200, array | string | null $focus = null ) : string
$content Bolt\Legacy\Content | array | string
$length integer Defaults to 200 characters
$focus array | string | null
Результат string Resulting excerpt

fields() публичный Метод

Output all (relevant) fields to the browser. Convenient for dumping the content in order in, say, a record.twig template, without having to iterate over them in the browser.
public fields ( Twig_Environment $env, Content $record = null, boolean $common = true, boolean $extended = false, boolean $repeaters = true, boolean $templateFields = true, string $template = '_sub_fields.twig', string | array $exclude = null, boolean $skip_uses = true ) : string
$env Twig_Environment
$record Bolt\Legacy\Content
$common boolean
$extended boolean
$repeaters boolean
$templateFields boolean
$template string
$exclude string | array
$skip_uses boolean
Результат string

listTemplates() публичный Метод

Lists templates, optionally filtered by $filter.
public listTemplates ( string $filter = null, boolean $safe = false ) : array
$filter string
$safe boolean
Результат array Sorted and possibly filtered templates

pager() публичный Метод

Output a simple pager, for paginated listing pages.
public pager ( Twig_Environment $env, string $pagerName = '', integer $surr = 4, string $template = '_sub_pager.twig', string $class = '' ) : string
$env Twig_Environment
$pagerName string
$surr integer
$template string The template to apply
$class string
Результат string The rendered pager HTML

selectField() публичный Метод

Return a selected field from a contentset.
public selectField ( array $content, array | string $fieldName, boolean $startempty = false, string $keyName = 'id' ) : array
$content array A Bolt record array
$fieldName array | string Name of a field, or array of field names to return from each record
$startempty boolean Whether or not the array should start with an empty element
$keyName string Name of the key in the array
Результат array