System\Twig\Extension

Overview

Extension implements common Twig functions and filters for the system twig environment.

Extends
  • Twig\Extension\AbstractExtension
Implements
  • Twig\Extension\ExtensionInterface

Protected Properties

protected System\Classes\MarkupManager $markupManager

markupManager reference.


Public Methods

public __construct()

public __construct(): void

__construct the extension instance.

public static addExtensionToTwig()

public static addExtensionToTwig($twig): void

addExtensionToTwig adds this extension to the Twig environment and also creates a hook for others.

public ajaxPagerFunction()

public ajaxPagerFunction($paginator, $options = []): void

public appFilter()

public appFilter(mixed $url): string 

appFilter converts supplied URL to one relative to the website root.

public carbonFunction()

public carbonFunction($value): void

carbonFunction returns a Carbon function with timezone preference applied.

public collectFunction()

public collectFunction(mixed $value = null): void

collectFunction spawns a new collection

public getFilters()

public getFilters(): array 

getFilters returns a list of filters this extensions provides.

public getFunctions()

public getFunctions(): array 

getFunctions returns a list of functions to add to the existing list.

public getTokenParsers()

public getTokenParsers(): array 

getTokenParsers returns a list of token parsers this extensions provides.

public pagerFunction()

public pagerFunction(mixed $paginator, $options = []): void

pagerFunction converts a pagination instance to usable attributes

public resizeFilter()

public resizeFilter($image, $width = null, $height = null, $options = []): void

resizeFilter converts supplied input into a URL that will return the desired resized image. The image can be either a file model, absolute path, or URL.

Show inherited public methods

Inherited Public Methods

  • getNodeVisitors() - (defined in Twig\Extension\AbstractExtension)
  • getOperators() - (defined in Twig\Extension\AbstractExtension)
  • getTests() - (defined in Twig\Extension\AbstractExtension)