Template

Type
Class
Namespace
craft\helpers
Inherits
craft\helpers\Template
Since
3.0

Class Template

View source

Public Methods

MethodDescription
attribute()Returns the attribute value for a given array/object.
paginateCriteria()Paginates an element query's results
raw()Returns a string wrapped in a \Twig_Markup object

attribute()

Returns the attribute value for a given array/object.

View source

Arguments

  • $env (Twig_Environment)
  • $source (Twig_Source)
  • $object (mixed) – The object or array from where to get the item
  • $item (mixed) – The item to get from the array or object
  • $arguments (array) – An array of arguments to pass if the item is an object method
  • $type (string) – The type of attribute (@see Twig_Template constants)
  • $isDefinedTest (boolean) – Whether this is only a defined check
  • $ignoreStrictCheck (boolean) – Whether to ignore the strict attribute check or not

Returns

mixed – The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true

Throws

  • Twig_Error_Runtime
    if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false

Signature

public static mixed attribute ( Twig_Environment $env, Twig_Source $source, $object, $item, array $arguments = [], \craft\helpers\string $type = \Twig_Template::ANY_CALL, \craft\helpers\bool $isDefinedTest = false, \craft\helpers\bool $ignoreStrictCheck = false )

paginateCriteria()

Paginates an element query's results

View source

Arguments

Returns

array

Signature

public static array paginateCriteria ( craft\elements\db\ElementQueryInterface $query )

raw()

Returns a string wrapped in a \Twig_Markup object

View source

Arguments

Returns

Twig_Markup

Signature

public static Twig_Markup raw ( \craft\helpers\string $value )