View helper reference
Condition/String
Contains
Description
Usage examples
{pvh:condition.string.contains(haystack: haystack, needle: needle, then: 'then', else: 'else')}
Copied!
Condition/Variable
IsNull
Description
Usage examples
{pvh:condition.variable.isNull(variable: variable, then: 'then', else: 'else')}
Copied!
Core
Version
Description
Returns the core version number in the format M.
. The version 11.
would
result in 11005021
.
Usage examples
{pvh:core.version()}
{pvh:core.version(as: '_version')}
Copied!
Format
Eliminate
Description
Usage examples
{content -> pvh:format.eliminate(whitespace: true)}
{pvh:format.eliminate(content: someContent, whitespace: true)}
Copied!
PregReplace
Description
Usage examples
{pvh:format.pregReplace(subject: subject, pattern: pattern, replacement: replacement)}
{subject -> pvh:format.pregReplace(pattern: pattern, replacement: replacement)}
{pvh:format.pregReplace(subject: subject, pattern: pattern, replacement: replacement, as: '_as')}
Copied!
Replace
Description
Usage examples
{content -> pvh:format.replace(substring: 'foo', replacement: 'bar')}
{pvh:format.replace(content: someContent, substring: 'foo', replacement: 'bar', count: 1)}
Copied!
Trim
Description
Usage examples
{content -> pvh:format.trim()}
{content -> pvh:format.trim(characters: 'ab')}
{pvh:format.trim(content: someContent)}
{pvh:format.trim(content: someContent, characters: 'ab')}
Copied!
Iterator
Merge
Description
Usage examples
{pvh:iterator.merge(a: a, b: b, useKeys: useKeys, as: 'merged')}
{pvh:iterator.merge(a: a, b: b, useKeys: useKeys) -> f:format.json()}
Copied!
Random
Description
Select random elements from a coma separated list, array, traversable or query result.
Parameter | Description | Default |
---|---|---|
subject | The subject Traversable/Array instance from which to select random elements. | |
count | Number of randomly selected elements to be returned. | 1 |
shuffle | Shuffle the selected elements. | true |
as | Template variable name to assign. If not specified the ViewHelper returns the variable instead. |
Usage examples
{pvh:iterator.random(subject: someArray, count: 3, as: 'randoms')}
{someArray -> pvh:iterator.random(count: 3, as: 'randoms')}
{pvh:iterator.random(subject: someArray, count: 3) -> f:variable(name: 'randoms')}
Copied!
Transform
Flexform
Description
Transforms flexform data to an array.
Usage examples
{pvh:transform.flexform(data: pi_flexform, as: 'pi_flexform_transformed')}
Copied!
Variable
Get
Description
Usage examples
{pvh:variable.get(name: 'my.template.var.{index}')}
Copied!
Set
Description
Usage examples
{value -> pvh:variable.set(name: name)}
{pvh:variable.set(name: name, value: value)}
Copied!