Skip to main content

GravityKit\GravityView\Template\TemplateContext

A template Context class.

This is provided to most template files as a global.

Source: src/Template/TemplateContext.php:18

Details​

  • Kind: class
  • Namespace: GravityKit\GravityView\Template
  • Extends: GV\Context

Properties​

PropertyTypeDescription
$template\GV\TemplateThe template.
$view\GV\ViewThe view.
$entry\GV\EntryThe entry. If single-entry view.
$entries\GV\Entry_CollectionThe entries. If directory view.
$fields\GV\Field_CollectionThe fields.
$field\GV\FieldThe field. When rendering a single field.
$source\GV\SourceThe data source for a field.
$display_valuemixedThe display value for a field.
$valuemixedThe raw value for a field.
$request\GV\RequestThe request.

Methods​

MethodDescription
from_template()Create a context from a Template

Method Reference​

from_template()​

public static function from_template( $template, $data=[] )

Create a context from a Template

Parameters​

NameTypeDefaultDescription
$template\GV\Template | arrayThe template or array with values expected in a template
$dataarray[]Additional data not tied to the template object.

Returns​

Source: src/Template/TemplateContext.php:77