| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace Opentalent\OtStats\ViewHelpers;
- use Closure;
- use Opentalent\OtCore\Page\OtPageRepository;
- use Opentalent\OtStats\Settings\StatsSettingsRepository;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
- use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
- /**
- * Returns the current site matomo's id if any, null else
- *
- * {namespace st=Opentalent\OtStats\ViewHelpers}
- *
- * {st:matomoSiteId(slug: 'foo')}
- *
- * @package Opentalent\OtTemplating\ViewHelpers
- */
- class MatomoSiteIdViewHelper extends AbstractViewHelper
- {
- /**
- * -- This method is expected by Fluid --
- * Renders the content as html
- *
- * @param array $arguments
- * @param Closure $renderChildrenClosure
- * @param RenderingContextInterface $renderingContext
- * @return int|null
- */
- public static function renderStatic(
- array $arguments,
- Closure $renderChildrenClosure,
- RenderingContextInterface $renderingContext
- ) {
- $otPageRepository = GeneralUtility::makeInstance(OtPageRepository::class);
- $rootPageUid = $otPageRepository->getCurrentSiteRootPageId();
- $statsSettingsRepository = GeneralUtility::makeInstance(StatsSettingsRepository::class);
- return $statsSettingsRepository->getMatomoSiteId($rootPageUid);
- }
- }
|