PHP Class Frontend\Core\Engine\TemplateModifiers

Inheritance: extends Common\Core\Twig\Extensions\BaseTwigModifiers
Afficher le fichier Open project: forkcms/forkcms Class Usage Examples

Méthodes publiques

Méthode Description
cleanupPlainText ( string $string ) : string Formats plain text as HTML, links will be detected, paragraphs will be inserted syntax: {{ $string|cleanupPlainText }}.
count ( array $data ) : integer Returns the count of the count of the array.
formatDate ( integer $var ) : string Format a UNIX-timestamp as a date syntax: {{ $var|formatdate }}
formatDateTime ( integer $var ) : string Format a UNIX-timestamp as a date syntax: {{ $var|formatdatetime }}
formatFloat ( float $number, integer $decimals = 2 ) : string Format a number as a float syntax: {{ $number|formatfloat($decimals) }}
formatNumber ( float $string, integer $decimals = null ) : string Format a number syntax: {{ $string|formatnumber($decimals) }}
formatTime ( integer $var ) : string Format a UNIX-timestamp as a date syntax: {{ $var|formatdate }}
getNavigation ( string $type = 'page', integer $parentId, integer $depth = null, string $excludeIds = null, string $template = '/Core/Layout/Templates/Navigation.html.twig' ) : string Get the navigation html syntax: {{ getnavigation($type, $parentId, $depth, $excludeIds-splitted-by-dash, $template) }}
getPageInfo ( integer $pageId, string $field = 'title' ) : string Get a given field for a page-record syntax: {{ $pageId|getpageinfo($field) }}
getPath ( string $file ) : string Fetch the path for an include (theme file if available, core file otherwise) syntax: {{ getpath($file) }}
getSubNavigation ( string $type = 'page', integer $pageId, integer $startDepth = 1, integer $endDepth = null, string $excludeIds = null, string $template = '/Core/Layout/Templates/Navigation.html.twig' ) : string Get the subnavigation html syntax: {{ getsubnavigation($type, $parentId, $startdepth, $enddepth, $excludeIds-splitted-by-dash, $template) }}
getURL ( integer $pageId, string $language = null ) : string Get the URL for a given pageId & language syntax: {{ geturl($pageId, $language) }}
getURLForBlock ( string $module, string $action = null, string $language = null, array $data = null ) : string Get the URL for a give module & action combination syntax: {{ geturlforblock($module, $action, $language, $data) }}
getURLForExtraId ( integer $extraId, string $language = null ) : string Fetch an URL based on an extraId syntax: {{ geturlforextraid($extraId, $language) }}
parseWidget ( string $module, string $action, string $id = null ) : null | string Parse a widget straight from the template, rather than adding it through pages.
profileSetting ( string $string, string $name ) : string Output a profile setting syntax: {{ profilesetting($string, $name) }}
timeAgo ( string $string = null ) : string Formats a timestamp as a string that indicates the time ago syntax: {{ $string|timeago }}.
toLabel ( string $value ) : string Convert this string into a well formed label.
userSetting ( string $string = null, string $setting, integer $userId = null ) : string Get the value for a user-setting syntax {{ usersetting($setting, $userId) }}

Method Details

cleanupPlainText() public static méthode

Formats plain text as HTML, links will be detected, paragraphs will be inserted syntax: {{ $string|cleanupPlainText }}.
public static cleanupPlainText ( string $string ) : string
$string string The text to cleanup.
Résultat string

count() public static méthode

Returns the count of the count of the array.
public static count ( array $data ) : integer
$data array
Résultat integer

formatDate() public static méthode

Format a UNIX-timestamp as a date syntax: {{ $var|formatdate }}
public static formatDate ( integer $var ) : string
$var integer The UNIX-timestamp to format or \DateTime
Résultat string

formatDateTime() public static méthode

Format a UNIX-timestamp as a date syntax: {{ $var|formatdatetime }}
public static formatDateTime ( integer $var ) : string
$var integer The UNIX-timestamp to format or \DateTime
Résultat string

formatFloat() public static méthode

Format a number as a float syntax: {{ $number|formatfloat($decimals) }}
public static formatFloat ( float $number, integer $decimals = 2 ) : string
$number float The number to format.
$decimals integer The number of decimals.
Résultat string

formatNumber() public static méthode

Format a number syntax: {{ $string|formatnumber($decimals) }}
public static formatNumber ( float $string, integer $decimals = null ) : string
$string float The number to format.
$decimals integer The number of decimals
Résultat string

formatTime() public static méthode

Format a UNIX-timestamp as a date syntax: {{ $var|formatdate }}
public static formatTime ( integer $var ) : string
$var integer The UNIX-timestamp to format or \DateTime
Résultat string

getNavigation() public static méthode

Get the navigation html syntax: {{ getnavigation($type, $parentId, $depth, $excludeIds-splitted-by-dash, $template) }}
public static getNavigation ( string $type = 'page', integer $parentId, integer $depth = null, string $excludeIds = null, string $template = '/Core/Layout/Templates/Navigation.html.twig' ) : string
$type string The type of navigation, possible values are: page, footer.
$parentId integer The parent wherefore the navigation should be build.
$depth integer The maximum depth that has to be build.
$excludeIds string Which pageIds should be excluded (split them by -).
$template string The template that will be used.
Résultat string

getPageInfo() public static méthode

Get a given field for a page-record syntax: {{ $pageId|getpageinfo($field) }}
public static getPageInfo ( integer $pageId, string $field = 'title' ) : string
$pageId integer The id of the page to build the URL for.
$field string The field to get.
Résultat string

getPath() public static méthode

Fetch the path for an include (theme file if available, core file otherwise) syntax: {{ getpath($file) }}
public static getPath ( string $file ) : string
$file string The base path.
Résultat string

getSubNavigation() public static méthode

NOTE: When supplying more than 1 ID to exclude, the single quotes around the dash-separated list are mandatory.
public static getSubNavigation ( string $type = 'page', integer $pageId, integer $startDepth = 1, integer $endDepth = null, string $excludeIds = null, string $template = '/Core/Layout/Templates/Navigation.html.twig' ) : string
$type string The type of navigation, possible values are: page, footer.
$pageId integer The parent wherefore the navigation should be build.
$startDepth integer The depth to start from.
$endDepth integer The maximum depth that has to be build.
$excludeIds string Which pageIds should be excluded (split them by -).
$template string The template that will be used.
Résultat string

getURL() public static méthode

Get the URL for a given pageId & language syntax: {{ geturl($pageId, $language) }}
public static getURL ( integer $pageId, string $language = null ) : string
$pageId integer The id of the page to build the URL for.
$language string The language to use, if not provided we will use the loaded language.
Résultat string

getURLForBlock() public static méthode

Get the URL for a give module & action combination syntax: {{ geturlforblock($module, $action, $language, $data) }}
public static getURLForBlock ( string $module, string $action = null, string $language = null, array $data = null ) : string
$module string The module wherefore the URL should be build.
$action string A specific action wherefore the URL should be build, otherwise the default will be used.
$language string The language to use, if not provided we will use the loaded language.
$data array An array with keys and values that partially or fully match the data of the block. If it matches multiple versions of that block it will just return the first match.
Résultat string

getURLForExtraId() public static méthode

Fetch an URL based on an extraId syntax: {{ geturlforextraid($extraId, $language) }}
public static getURLForExtraId ( integer $extraId, string $language = null ) : string
$extraId integer The id of the extra.
$language string The language to use, if not provided we will use the loaded language.
Résultat string

parseWidget() public static méthode

syntax: {{ parsewidget($module, $action, $id) }}
public static parseWidget ( string $module, string $action, string $id = null ) : null | string
$module string The module whose module we want to execute.
$action string The action to execute.
$id string The widget id (saved in data-column).
Résultat null | string

profileSetting() public static méthode

Output a profile setting syntax: {{ profilesetting($string, $name) }}
public static profileSetting ( string $string, string $name ) : string
$string string The variable
$name string The name of the setting
Résultat string

timeAgo() public static méthode

Formats a timestamp as a string that indicates the time ago syntax: {{ $string|timeago }}.
public static timeAgo ( string $string = null ) : string
$string string A UNIX-timestamp that will be formatted as a time-ago-string.
Résultat string

toLabel() public static méthode

syntax: {{ var|tolabel }}.
public static toLabel ( string $value ) : string
$value string The value to convert to a label.
Résultat string

userSetting() public static méthode

Get the value for a user-setting syntax {{ usersetting($setting, $userId) }}
public static userSetting ( string $string = null, string $setting, integer $userId = null ) : string
$string string The string passed from the template.
$setting string The name of the setting you want.
$userId integer The userId, if not set by $string.
Résultat string