Extension
The System Twig extension class implements common Twig functions and filters.
class System\Twig\Extension
extends Twig\Extension\AbstractExtension
Extends
Class | Description |
---|---|
Twig\Extension\AbstractExtension
|
Properties
protected $markupManager : System\Classes\MarkupManager
A reference to the markup manager instance.
Methods
public __construct ()
Creates the extension instance.
public appFilter (mixed $url) : string
Converts supplied URL to one relative to the website root.
Property | Type | Description |
---|---|---|
$url | mixed |
mixed
Specifies the application-relative URL |
public assetFilter (string $file) : string
Converts supplied file to a URL relative to the app.asset_url
config.
Property | Type | Description |
---|---|---|
$file | string |
string
Specifies the asset-relative file |
public getFilters () : array
Returns a list of filters this extensions provides.
An array of filters
public getFunctions () : array
Returns a list of functions to add to the existing list.
An array of functions
public getTokenParsers () : array
Returns a list of token parsers this extensions provides.
An array of token parsers
public imageHeightFilter (mixed $image) : int
Gets the height in pixels of the provided image source
Property | Type | Description |
---|---|---|
$image | mixed |
mixed
Supported values below: ['disk' => Illuminate\Filesystem\FilesystemAdapter, 'path' => string, 'source' => string, 'fileModel' => FileModel|void], instance of Winter\Storm\Database\Attach\File, string containing URL or path accessible to the application's filesystem manager |
public imageWidthFilter (mixed $image) : int
Gets the width in pixels of the provided image source
Property | Type | Description |
---|---|---|
$image | mixed |
mixed
Supported values below: ['disk' => Illuminate\Filesystem\FilesystemAdapter, 'path' => string, 'source' => string, 'fileModel' => FileModel|void], instance of Winter\Storm\Database\Attach\File, string containing URL or path accessible to the application's filesystem manager |
public mediaFilter (string $file) : string
Converts supplied file to a URL relative to the media library.
Property | Type | Description |
---|---|---|
$file | string |
string
Specifies the media-relative file |
public
resizeFilter (mixed $image, int | bool | null $width = null
, int | bool | null $height = null
, array $options = []
)
: string
Converts supplied input into a URL that will return the desired resized image
Property | Type | Description |
---|---|---|
$image | mixed |
mixed
Supported values below: ['disk' => Illuminate\Filesystem\FilesystemAdapter, 'path' => string, 'source' => string, 'fileModel' => FileModel|void], instance of Winter\Storm\Database\Attach\File, string containing URL or path accessible to the application's filesystem manager |
$width | int | bool | null |
int | bool | null
Desired width of the resized image |
$height | int | bool | null |
int | bool | null
Desired height of the resized image |
$options | array |
array
Array of options to pass to the resizer |