|
@@ -8,6 +8,7 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Returns the current url with a 'page=' argument set up or updated
|
|
* Returns the current url with a 'page=' argument set up or updated
|
|
|
|
|
+ * Warning: this viewhelper will also add a 'no_cache=1' argument to the query
|
|
|
*
|
|
*
|
|
|
* {namespace ot=Opentalent\OtTemplating\ViewHelpers}
|
|
* {namespace ot=Opentalent\OtTemplating\ViewHelpers}
|
|
|
*
|
|
*
|
|
@@ -27,6 +28,12 @@ class WithPageViewHelper extends AbstractViewHelper {
|
|
|
'int',
|
|
'int',
|
|
|
"The page's number",
|
|
"The page's number",
|
|
|
true);
|
|
true);
|
|
|
|
|
+ $this->registerArgument('nocache',
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ "If true, adds a no_cache parameter to the query",
|
|
|
|
|
+ false,
|
|
|
|
|
+ 1
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -44,6 +51,7 @@ class WithPageViewHelper extends AbstractViewHelper {
|
|
|
RenderingContextInterface $renderingContext
|
|
RenderingContextInterface $renderingContext
|
|
|
) {
|
|
) {
|
|
|
$page = $arguments['page'];
|
|
$page = $arguments['page'];
|
|
|
|
|
+ $nocache = $arguments['nocache'];
|
|
|
|
|
|
|
|
$request = $GLOBALS['TYPO3_REQUEST'];
|
|
$request = $GLOBALS['TYPO3_REQUEST'];
|
|
|
$uri = $request->getUri();
|
|
$uri = $request->getUri();
|
|
@@ -60,6 +68,11 @@ class WithPageViewHelper extends AbstractViewHelper {
|
|
|
} else {
|
|
} else {
|
|
|
$query .= "page=" . $page;
|
|
$query .= "page=" . $page;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ $query = preg_replace("/&no_cache=1/", "", $query);
|
|
|
|
|
+ if ($nocache) {
|
|
|
|
|
+ $query .= '&no_cache=1';
|
|
|
|
|
+ }
|
|
|
return (string)$uri->withQuery($query);
|
|
return (string)$uri->withQuery($query);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|