GetPreferencesViewHelper.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Opentalent\OtTemplating\ViewHelpers\Template;
  3. use Closure;
  4. use Opentalent\OtCore\Page\OtPageRepository;
  5. use Opentalent\OtCore\ViewHelpers\OtAbstractViewHelper;
  6. use Opentalent\OtTemplating\Templating\TemplateRepository;
  7. use TYPO3\CMS\Core\Utility\GeneralUtility;
  8. use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
  9. /**
  10. * Returns the recorded preferences
  11. *
  12. * {namespace ot=Opentalent\OtTemplating\ViewHelpers}
  13. *
  14. * {ot:template.preferences()}
  15. *
  16. * @package Opentalent\OtTemplating\ViewHelpers\Template
  17. */
  18. class PreferencesViewHelper extends OtAbstractViewHelper
  19. {
  20. /**
  21. * -- This method is expected by Fluid --
  22. * Renders the content as html
  23. *
  24. * @param array $arguments
  25. * @param Closure $renderChildrenClosure
  26. * @param RenderingContextInterface $renderingContext
  27. * @return array
  28. */
  29. public static function renderStatic(
  30. array $arguments,
  31. Closure $renderChildrenClosure,
  32. RenderingContextInterface $renderingContext
  33. ) {
  34. $pageRepository = GeneralUtility::makeInstance(OtPageRepository::class);
  35. $rootUid = $pageRepository->getCurrentSiteRootPageId();
  36. $templateRepository = GeneralUtility::makeInstance(TemplateRepository::class);
  37. return $templateRepository->getTemplatePreferences($rootUid);
  38. }
  39. }