PHP Class Bolt\Twig\Handler\RecordHandler

Afficher le fichier Open project: bolt/bolt Class Usage Examples

Méthodes publiques

Méthode Description
__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.

Method Details

__construct() public méthode

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

current() public méthode

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
Résultat boolean True if the given content is on the curent page.

excerpt() public méthode

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
Résultat string Resulting excerpt

fields() public méthode

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
Résultat string

listTemplates() public méthode

Lists templates, optionally filtered by $filter.
public listTemplates ( string $filter = null, boolean $safe = false ) : array
$filter string
$safe boolean
Résultat array Sorted and possibly filtered templates

pager() public méthode

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
Résultat string The rendered pager HTML

selectField() public méthode

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
Résultat array