PHP Class Frontend\Core\Engine\TemplateModifiers

Inheritance: extends Common\Core\Twig\Extensions\BaseTwigModifiers
Datei anzeigen Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method 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 method

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.
return string

count() public static method

Returns the count of the count of the array.
public static count ( array $data ) : integer
$data array
return integer

formatDate() public static method

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
return string

formatDateTime() public static method

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
return string

formatFloat() public static method

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.
return string

formatNumber() public static method

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
return string

formatTime() public static method

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
return string

getNavigation() public static method

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.
return string

getPageInfo() public static method

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.
return string

getPath() public static method

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.
return string

getSubNavigation() public static method

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.
return string

getURL() public static method

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.
return string

getURLForBlock() public static method

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.
return string

getURLForExtraId() public static method

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.
return string

parseWidget() public static method

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).
return null | string

profileSetting() public static method

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
return string

timeAgo() public static method

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.
return string

toLabel() public static method

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

userSetting() public static method

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.
return string