PHP Класс Common\Core\Twig\Extensions\BaseTwigModifiers

These filters work independent of front/backend.
Показать файл Открыть проект

Открытые методы

Метод Описание
camelCase ( string $string ) : string CamelCase Converter.
formatCurrency ( string $string, string $currency = 'EUR', integer $decimals = null ) : string Format a number as currency syntax: {{ $string|formatcurrency($currency, $decimals) }}.
formatNumber ( string $number, integer $decimals = null ) : string Fallback for if our parent functions don't implement this method
highlightCode ( string $string ) : string Highlights all strings in tags.
lowercase ( string $string ) : string Makes this string lowercase.
random ( integer $min, integer $max ) : integer Get a random var between a min and max syntax: {{ rand($min, $max) }}.
showBool ( string | boolean $status, boolean $reverse = false ) : string Shows a v or x to indicate the boolean state (Y|N, j|n, true|false).
snakeCase ( string $string ) : string snakeCase Converter.
spoonDate ( mixed $timestamp, string[optional] $format = 'Y-m-d H:i:s', string[optional] $language = 'en' ) : string Formats a language specific date.
stripNewlines ( string $string ) : string Convert a multi line string into a string without newlines so it can be handles by JS syntax: {{ $string|stripnewlines }}.
truncate ( string $string, integer $length, boolean $useHellip = true, boolean $closestWord = false ) : string Truncate a string syntax: {{ $string|truncate($max-length, $append-hellip, $closest-word) }}.
uppercase ( string $string ) : string Transform the string to uppercase.

Описание методов

camelCase() публичный статический Метод

syntax: {{ $string|camelcase }}.
public static camelCase ( string $string ) : string
$string string
Результат string

formatCurrency() публичный статический Метод

Format a number as currency syntax: {{ $string|formatcurrency($currency, $decimals) }}.
public static formatCurrency ( string $string, string $currency = 'EUR', integer $decimals = null ) : string
$string string The string to form.
$currency string The currency to will be used to format the number.
$decimals integer The number of decimals to show.
Результат string

formatNumber() публичный статический Метод

Fallback for if our parent functions don't implement this method
public static formatNumber ( string $number, integer $decimals = null ) : string
$number string
$decimals integer
Результат string

highlightCode() публичный статический Метод

syntax: {{ $string|highlight }}.
public static highlightCode ( string $string ) : string
$string string The string passed from the template.
Результат string

lowercase() публичный статический Метод

syntax: {{ $string|lowercase }}.
public static lowercase ( string $string ) : string
$string string The string that you want to apply this method on.
Результат string The string, completely lowercased.

random() публичный статический Метод

Get a random var between a min and max syntax: {{ rand($min, $max) }}.
public static random ( integer $min, integer $max ) : integer
$min integer The minimum random number.
$max integer The maximum random number.
Результат integer

showBool() публичный статический Метод

syntax: {{ showbool($status, $reverse) }}.
public static showBool ( string | boolean $status, boolean $reverse = false ) : string
$status string | boolean
$reverse boolean show the opposite of the status
Результат string

snakeCase() публичный статический Метод

syntax: {{ $string|snakecase }}.
public static snakeCase ( string $string ) : string
$string string
Результат string

spoonDate() публичный статический Метод

syntax: {{ $timestamp|spoondate($format, $language) }}.
public static spoonDate ( mixed $timestamp, string[optional] $format = 'Y-m-d H:i:s', string[optional] $language = 'en' ) : string
$timestamp mixed The timestamp or date that you want to apply the format to.
$format string[optional]
$language string[optional]
Результат string The formatted date according to the timestamp, format and provided language.

stripNewlines() публичный статический Метод

Convert a multi line string into a string without newlines so it can be handles by JS syntax: {{ $string|stripnewlines }}.
public static stripNewlines ( string $string ) : string
$string string The variable that should be processed.
Результат string

truncate() публичный статический Метод

Truncate a string syntax: {{ $string|truncate($max-length, $append-hellip, $closest-word) }}.
public static truncate ( string $string, integer $length, boolean $useHellip = true, boolean $closestWord = false ) : string
$string string The string passed from the template.
$length integer The maximum length of the truncated string.
$useHellip boolean Should a hellip be appended if the length exceeds the requested length?
$closestWord boolean Truncate on exact length or on closest word?
Результат string

uppercase() публичный статический Метод

syntax: {{ $string|uppercase }}.
public static uppercase ( string $string ) : string
$string string The string that you want to apply this method on.
Результат string The string, completly uppercased.