|
|
@@ -13,7 +13,7 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
|
|
|
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
|
|
|
|
|
/**
|
|
|
- * Returns the value of the requested preference
|
|
|
+ * Returns the value of the requested preference, or null if the key does not exist.
|
|
|
*
|
|
|
* {namespace ot=Opentalent\OtTemplating\ViewHelpers}
|
|
|
*
|
|
|
@@ -32,7 +32,7 @@ class GetPreferenceViewHelper extends OtAbstractViewHelper
|
|
|
* -- This method is expected by Fluid --
|
|
|
* Declares the viewhelper's parameters
|
|
|
*/
|
|
|
- public function initializeArguments()
|
|
|
+ public function initializeArguments(): void
|
|
|
{
|
|
|
$this->registerArgument(
|
|
|
'key',
|
|
|
@@ -46,16 +46,15 @@ class GetPreferenceViewHelper extends OtAbstractViewHelper
|
|
|
* -- This method is expected by Fluid --
|
|
|
* Renders the content as html
|
|
|
*
|
|
|
- * @return string
|
|
|
+ * @return string | null
|
|
|
* @throws NoSuchWebsiteException
|
|
|
*/
|
|
|
- public function render(): string
|
|
|
+ public function render(): ?string
|
|
|
{
|
|
|
$website = $this->otWebsiteRepository->getCurrentWebsiteFromFEGlobals();
|
|
|
$preferences = $this->templateRepository->getTemplatePreferences($website);
|
|
|
|
|
|
- $key = $this->arguments['key'];
|
|
|
+ $key = $this->arguments['key'] ?? null;
|
|
|
return $preferences[$key];
|
|
|
}
|
|
|
-
|
|
|
}
|