‪TYPO3CMS  ‪main
TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator Class Reference

Public Member Functions

 getAllowedLinkVarsFromRequest (string $linkVarsSetting, array $queryParams, Context $context)
 

Protected Member Functions

 splitLinkVarsString (string $string)
 
bool isAllowedLinkVarValue (string $haystack, string $value)
 

Detailed Description

Class to calculate so-called "linkVars", which is a TypoScript setting to always append these query parameters (if available in an existing request) to a URL when using TypoLink for pages.

Definition at line 30 of file LinkVarsCalculator.php.

Member Function Documentation

◆ getAllowedLinkVarsFromRequest()

TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator::getAllowedLinkVarsFromRequest ( string  $linkVarsSetting,
array  $queryParams,
Context  $context 
)

Calculates and sets the internal linkVars based upon the current request's GET parameters and the setting "config.linkVars".

Definition at line 36 of file LinkVarsCalculator.php.

References TYPO3\CMS\Core\Utility\HttpUtility\buildQueryString(), TYPO3\CMS\Core\Context\Context\getAspect(), TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator\isAllowedLinkVarValue(), and TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator\splitLinkVarsString().

◆ isAllowedLinkVarValue()

bool TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator::isAllowedLinkVarValue ( string  $haystack,
string  $value 
)
protected

Checks if the value defined in "config.linkVars" contains an allowed value. Otherwise, return FALSE which means the value will not be added to any links.

Parameters
string$haystack‪The string in which to find $value
string$value‪The string to find in $haystack
Returns
‪bool Returns TRUE if $value matches or is found in $haystack

Definition at line 137 of file LinkVarsCalculator.php.

References TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger().

Referenced by TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator\getAllowedLinkVarsFromRequest().

◆ splitLinkVarsString()

TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator::splitLinkVarsString ( string  $string)
protected

Split the link vars string by "," but not if the "," is inside of braces

Definition at line 114 of file LinkVarsCalculator.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator\getAllowedLinkVarsFromRequest().